TW202336602A - Method of transmitting data and command through rs232 serial port - Google Patents

Method of transmitting data and command through rs232 serial port Download PDF

Info

Publication number
TW202336602A
TW202336602A TW111108733A TW111108733A TW202336602A TW 202336602 A TW202336602 A TW 202336602A TW 111108733 A TW111108733 A TW 111108733A TW 111108733 A TW111108733 A TW 111108733A TW 202336602 A TW202336602 A TW 202336602A
Authority
TW
Taiwan
Prior art keywords
counter
client device
data
server device
serial port
Prior art date
Application number
TW111108733A
Other languages
Chinese (zh)
Other versions
TWI806483B (en
Inventor
張永良
Original Assignee
台達電子工業股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 台達電子工業股份有限公司 filed Critical 台達電子工業股份有限公司
Priority to TW111108733A priority Critical patent/TWI806483B/en
Application granted granted Critical
Publication of TWI806483B publication Critical patent/TWI806483B/en
Publication of TW202336602A publication Critical patent/TW202336602A/en

Links

Images

Landscapes

  • Computer And Data Communications (AREA)
  • Communication Control (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

A method of transmitting data and command through an RS232 serial port incorporated with a user-end device and a server-end device connected through the RS232 serial port is disclosed and includes following steps: accumulating a value of a first counter of the user-end device and a value of a second counter of the server-end device whenever a data is sent from the server-end device to the user-end device; controlling the server-end device to stop transmitting the data and to wait when both of the two values reach a triggering threshold; controlling the user-end device to transmit a control command to the server-end device through the RS232 serial port while the server-end device is waiting; and, resetting the first and the second counter and controlling the server-end device to restore transmitting the data to the user-end device after a waiting time is elapsed.

Description

基於RS232序列埠實現的資料與指令傳輸方法Data and command transmission method based on RS232 serial port

本發明涉及資料與指令的傳輸方法,尤其涉及基於RS232序列埠實現的資料與指令的傳輸方法。The present invention relates to a data and instruction transmission method, and in particular to a data and instruction transmission method based on an RS232 serial port.

於工業環境下,用戶端設備(例如工業電腦)與伺服端設備(例如伺服電機(Servo))經常會使用RS232序列埠來連接,藉此傳遞資料與控制指令。In an industrial environment, client equipment (such as industrial computers) and server equipment (such as servo motors) are often connected using RS232 serial ports to transmit data and control instructions.

RS232序列埠的標準資料傳輸程序,必須經過交握(Hand-shaking)。具體地,當發送方發送資料給接收方後,接收方必須回覆確認訊號給發送方,才算完成一筆資料的傳輸程序。然而,這樣一來一回的交握程序實相當浪費通訊時間,造成單位時間中可以傳輸的資料量下降。也因此,RS232序列埠並不適合被用來執行即時(real-time)的資料傳輸工作。The standard data transmission procedure of the RS232 serial port must go through handshaking. Specifically, when the sender sends data to the receiver, the receiver must reply with a confirmation signal to the sender to complete the data transmission process. However, such a back-and-forth handshaking process is a waste of communication time, resulting in a decrease in the amount of data that can be transmitted per unit time. Therefore, the RS232 serial port is not suitable for performing real-time data transmission.

參閱圖1,為相關技術的RS232序列埠傳輸示意圖。如圖1所示,當用戶端設備1與伺服端設備2通過RS232序列埠3連接並且執行標準傳輸程序時,若用戶端設備1發送控制指令11給伺服端設備2,伺服端設備2就必須在接收後回覆確認封包12給用戶端設備1。同樣地,當伺服端設備2發送資料21給用戶端設備1時,用戶端設備1也必須在接收後回覆確認封包12給伺服端設備2。Refer to Figure 1, which is a schematic diagram of RS232 serial port transmission in related technology. As shown in Figure 1, when the client device 1 and the server device 2 are connected through the RS232 serial port 3 and execute the standard transmission procedure, if the client device 1 sends the control command 11 to the server device 2, the server device 2 must After receiving, a confirmation packet 12 is sent back to the client device 1 . Similarly, when the server device 2 sends data 21 to the client device 1, the client device 1 must also reply a confirmation packet 12 to the server device 2 after receiving it.

一般來說,伺服端設備2可被用來連接工廠內的工業設備,以搜集並記錄工業設備的即時資料。伺服端設備2將所記錄的資料回傳給用戶端設備1,藉此使用者可以通過用戶端設備1來對工業設備進行即時監控。於上述使用環境中,伺服端設備2傳送的資料21可能很大(例如每一筆資料為1~64KB),若需經過上述標準傳輸程序,必然無法在有限的時間(例如1000ms)內傳輸完畢。如此一來,將無法達到使用者對於即時監控的需求。Generally speaking, the server device 2 can be used to connect to industrial equipment in a factory to collect and record real-time data of the industrial equipment. The server device 2 sends the recorded data back to the client device 1, so that the user can monitor the industrial equipment in real time through the client device 1. In the above-mentioned usage environment, the data 21 transmitted by the server device 2 may be very large (for example, each piece of data is 1~64KB). If it needs to go through the above-mentioned standard transmission procedure, it will definitely not be transmitted within a limited time (for example, 1000ms). As a result, users' needs for real-time monitoring will not be met.

有鑑於此,如何修改RS232序列埠的傳輸程序,以提高傳輸資料量,即可為領域技術人員潛心研究的課題。In view of this, how to modify the transmission program of the RS232 serial port to increase the amount of transmitted data has become a subject of intensive research by those skilled in the field.

本發明提供一種基於RS232序列埠實現的資料與指令傳輸方法,可以令使用RS232序列埠的用戶端設備在最短的時間內收到最大的資料量。The present invention provides a data and instruction transmission method based on the RS232 serial port, which can enable the client device using the RS232 serial port to receive the maximum amount of data in the shortest time.

於本發明的一個實施例中,所述傳輸方法應用於通過一RS232序列埠連接的一用戶端設備及一伺服端設備,並且包括下列步驟:In one embodiment of the present invention, the transmission method is applied to a client device and a server device connected through an RS232 serial port, and includes the following steps:

a)於該伺服端設備傳送資料至該用戶端設備時,控制該用戶端設備的一第一計數器及該伺服端設備的一第二計數器的計數進行同步累加;a) When the server device transmits data to the client device, control the counts of a first counter of the client device and a second counter of the server device to synchronously accumulate;

b)於該第一計數器及該第二計數器的計數到達一觸發門檻值之前重覆執行該步驟a);b) Repeat step a) before the counts of the first counter and the second counter reach a trigger threshold;

c)於該第一計數器及該第二計數器的計數到達該觸發門檻值時,該伺服端設備於一等待時間內停止傳送資料至該用戶端設備,並且該伺服端設備暫存該等待時間內欲傳送的資料;c) When the counts of the first counter and the second counter reach the trigger threshold, the server device stops transmitting data to the client device within a waiting time, and the server device temporarily stores the data within the waiting time. the information to be transmitted;

d)該用戶端設備於該等待時間內發送一控制指令至該伺服端設備;及d) The client device sends a control command to the server device within the waiting time; and

e)於該等待時間過後清除該第一計數器及該第二計數器,並且該伺服端設備恢復傳送資料至該用戶端設備。e) Clear the first counter and the second counter after the waiting time, and the server device resumes transmitting data to the client device.

於本發明的另一個實施例中,所述傳輸方法應用於通過一RS232序列埠連接一伺服端設備的一用戶端設備,並且包括下列步驟:In another embodiment of the present invention, the transmission method is applied to a client device connected to a server device through an RS232 serial port, and includes the following steps:

a)於接收該伺服端設備傳送的資料時,控制一第一計數器進行累加,其中該第一計數器與該伺服端設備中的一第二計數器同步;a) When receiving data sent by the server device, control a first counter to accumulate, wherein the first counter is synchronized with a second counter in the server device;

b)於欲傳送一控制指令至該伺服端設備時,將該控制指令儲存於一指令佇列;b) When sending a control command to the server device, store the control command in a command queue;

c)於該第一計數器的計數到達一觸發門檻值之前重覆執行該步驟a)及該步驟b);c) Repeat step a) and step b) before the count of the first counter reaches a trigger threshold;

d)於該第一計數器的計數到達該觸發門檻值時,將該指令佇列中的該控制指令發送至該伺服端設備;及d) When the count of the first counter reaches the trigger threshold, send the control command in the command queue to the server device; and

e)該步驟d)後清除該第一計數器,並且再次執行該步驟a)至該步驟d)。e) Clear the first counter after step d), and perform steps a) to step d) again.

於本發明的另一個實施例中,所述傳輸方法應用於通過一RS232序列埠連接一用戶端設備的一伺服端設備,並且包括下列步驟:In another embodiment of the present invention, the transmission method is applied to a server device connected to a client device through an RS232 serial port, and includes the following steps:

a)於發送資料至該用戶端設備時,控制一第二計數器進行累加,其中該第二計數器與該用戶端設備中的一第一計數器同步;a) When sending data to the client device, control a second counter to accumulate, wherein the second counter is synchronized with a first counter in the client device;

b)於該第二計數器的計數到達一觸發門檻值之前重覆執行該步驟a);b) Repeat step a) before the count of the second counter reaches a trigger threshold;

c)於該第二計數器的計數到達該觸發門檻值時,停止發送資料至該用戶端設備並維持一等待時間,並且暫存該等待時間內欲發送的資料;及c) When the count of the second counter reaches the trigger threshold, stop sending data to the client device and maintain a waiting time, and temporarily store the data to be sent during the waiting time; and

d)於該等待時間過後清除該該第二計數器,並且恢復發送資料至該用戶端設備。d) Clear the second counter after the waiting time and resume sending data to the client device.

相對於相關技術,本發明可以在使用RS232序列埠且不進行資料交握的情況下,令用戶端設備在最短的時間內收到最大的資料量。並且,當用戶端設備發送控制指令給伺服端設備時,不會與伺服端設備傳輸的資料發生碰撞。Compared with related technologies, the present invention can enable the client device to receive the maximum amount of data in the shortest time by using the RS232 serial port and without performing data handshaking. Moreover, when the client device sends a control command to the server device, it will not collide with the data transmitted by the server device.

茲就本發明之一較佳實施例,配合圖式,詳細說明如後。A preferred embodiment of the present invention is described in detail below with reference to the drawings.

本發明揭露了一種資料與指令傳輸方法(下面將於說明書中簡稱為傳輸方法),所述傳輸方法主要應用在通過RS232序列埠來進行資料、控制指令的傳輸的兩個或兩個以上的電子裝置。The present invention discloses a data and command transmission method (hereinafter referred to as the transmission method in the specification). The transmission method is mainly applied to two or more electronic devices that transmit data and control instructions through the RS232 serial port. device.

參閱圖2,為本發明的第一具體實施例的RS232序列埠傳輸示意圖。如圖2所示,本發明的傳輸方法應用於通過RS232序列埠6連接的用戶端設備4及伺服端設備5,使得用戶端設備4與伺服端設備5在進行資料、控制指令的傳輸時可以不需要經過交握程序,藉此獲得單位時間內的最大資料傳輸量。Refer to Figure 2, which is a schematic diagram of RS232 serial port transmission according to the first specific embodiment of the present invention. As shown in Figure 2, the transmission method of the present invention is applied to the client device 4 and the server device 5 connected through the RS232 serial port 6, so that the client device 4 and the server device 5 can transmit data and control instructions. There is no need to go through the handover process to obtain the maximum data transmission volume per unit time.

具體地,用戶端設備4可例如為個人電腦、工業電腦或雲端伺服器等可以支援RS232序列埠6的電子裝置,但不加以限定。當用戶端設備4執行了特定的應用程式或軟體後,可通過RS232序列埠6與伺服端設備5進行溝通,並且即時接收伺服端設備5發送的資料50。Specifically, the client device 4 can be, for example, a personal computer, an industrial computer, a cloud server, or other electronic device that can support the RS232 serial port 6, but is not limited thereto. After the client device 4 executes a specific application or software, it can communicate with the server device 5 through the RS232 serial port 6 and receive the data 50 sent by the server device 5 in real time.

伺服端設備5可例如為伺服器或伺服電機(Servo),尤其是交流伺服電機(AC Servo),但不加以限定。伺服端設備5可連接環境中的各式工業設備(圖未標示),並且基於用戶端設備4(尤其是用戶端設備4上執行的應用程式或軟體)的請求,通過RS232序列埠6將工業設備的資料50即時發送至用戶端設備4。藉此,可達到使用者通過用戶端設備4來即時監控工業設備的主要目的。The servo device 5 may be, for example, a server or a servo motor (Servo), especially an AC servo motor (AC Servo), but is not limited thereto. The server device 5 can connect to various industrial devices (not shown in the figure) in the environment, and based on the request of the client device 4 (especially the application or software executed on the client device 4), the industrial The device data 50 is immediately sent to the client device 4 . In this way, the main purpose of the user to monitor the industrial equipment in real time through the client device 4 can be achieved.

於圖2的實施例中,用戶端設備4(主要指所述應用程式或軟體)經過修改,而不會在接收伺服端設備5發送的資料50後回覆對應的確認封包。相對地,伺服端設備5亦經過修改,不需要接收任何的確認封包,即可繼續發送下一筆資料50至用戶端設備4。藉此,可以有效縮短資料50的傳輸時間,提高單位時間內的傳輸資料量,進而達到使用者通過RS232序列埠6來進行即時監控的需求。In the embodiment of FIG. 2 , the client device 4 (mainly refers to the application or software) has been modified so as not to reply with a corresponding confirmation packet after receiving the data 50 sent by the server device 5 . Correspondingly, the server device 5 has also been modified and can continue to send the next piece of data 50 to the client device 4 without receiving any confirmation packet. This can effectively shorten the transmission time of data 50 and increase the amount of data transmitted per unit time, thereby meeting the user's needs for real-time monitoring through RS232 serial port 6.

值得一提的是,因為不需要等待確認封包,所以伺服端設備5會持續地發送資料50至用戶端設備4,使得用戶端設備4將無法預測伺服端設備5何時停止發送資料50(即,RS232序列埠6何時會處於閒置狀態)。因此,當用戶端設備4要發送控制指令40給伺服端設備5以對伺服端設備5進行控制時,只能不經任何判斷程序並直接經由RS232序列埠6來發送給伺服端設備5。於此情況下,用戶端設備4發送的控制指令40與伺服端設備5發送的資料50有可能發生碰撞,導致伺服端設備5無法正確接收控制指令40。It is worth mentioning that since there is no need to wait for the confirmation packet, the server device 5 will continue to send data 50 to the client device 4, so that the client device 4 will not be able to predict when the server device 5 will stop sending the data 50 (i.e., When will RS232 serial port 6 be idle). Therefore, when the client device 4 wants to send the control command 40 to the server device 5 to control the server device 5, it can only send it directly to the server device 5 via the RS232 serial port 6 without any judgment procedure. In this case, the control command 40 sent by the client device 4 and the data 50 sent by the server device 5 may collide, causing the server device 5 to be unable to receive the control command 40 correctly.

當用戶端設備4接收伺服端設備5發送的下一筆資料50,並且經由資料50的內容發現伺服端設備5的狀態沒有基於控制指令40的內容對應改變時,會判斷伺服端設備5沒有正確接收控制指令40。於此情況下,用戶端設備4只能再次發送相同的控制指令40給伺服端設備5。When the client device 4 receives the next piece of data 50 sent by the server device 5 and finds through the content of the data 50 that the status of the server device 5 has not changed based on the content of the control command 40, it will be judged that the server device 5 has not received it correctly. Control instructions 40. In this case, the client device 4 can only send the same control command 40 to the server device 5 again.

舉例來說,用戶端設備4可以發送一筆控制伺服端設備5停止運算的控制指令40。若用戶端設備4發送了控制指令40後,仍持續收到經過運算的資料50,即可判斷伺服端設備5沒有確接收控制指令40。For example, the client device 4 may send a control instruction 40 to control the server device 5 to stop computing. If the client device 4 continues to receive the calculated data 50 after sending the control command 40, it can be determined that the server device 5 has not indeed received the control command 40.

有鑑於上述問題,本發明根據圖2的實施例更進一步提出另一種實施方式。In view of the above problems, the present invention further proposes another implementation manner based on the embodiment of FIG. 2 .

請參閱圖3,為本發明的第二具體實施例的RS232序列埠傳輸示意圖。圖3的實施例與圖2的實施例的主要差異在於,用戶端設備4中具有第一計數器41,伺服端設備5中具有第二計數器51,並且第一計數器41與第二計數器51同步。Please refer to FIG. 3 , which is a schematic diagram of RS232 serial port transmission according to the second specific embodiment of the present invention. The main difference between the embodiment of FIG. 3 and the embodiment of FIG. 2 is that the client device 4 has a first counter 41 and the server device 5 has a second counter 51 , and the first counter 41 and the second counter 51 are synchronized.

具體地,在開始進行資料50或控制指令40的傳輸前,用戶端設備4與伺服端設備5可以分別將第一計數器41與第二計數器51設定為0(例如執行重置程序),以令第一計數器41與第二計數器51達成同步。並且,於第一計數器41與第二計數器51達成同步後,再通過RS232序列埠6開始進行資料50的傳輸。Specifically, before starting to transmit the data 50 or the control command 40, the client device 4 and the server device 5 can respectively set the first counter 41 and the second counter 51 to 0 (for example, execute a reset procedure), so that The first counter 41 and the second counter 51 are synchronized. Moreover, after the first counter 41 and the second counter 51 are synchronized, the transmission of the data 50 is started through the RS232 serial port 6.

本發明中,當伺服端設備5發送資料50至用戶端設備4時,第一計數器41與第二計數器51會同步累加。當第一計數器41與第二計數器51的計數滿足預設條件時(例如,資料50的發送筆數達到觸發門檻值A1),伺服端設備5會暫時停止發送資料50給用戶端設備4。In the present invention, when the server device 5 sends data 50 to the client device 4, the first counter 41 and the second counter 51 accumulate simultaneously. When the counts of the first counter 41 and the second counter 51 meet the preset conditions (for example, the number of sent data 50 reaches the trigger threshold A1), the server device 5 will temporarily stop sending the data 50 to the client device 4.

於本發明的傳輸方法中,伺服端設備5會在第二計數器51的計數滿足預設條件時暫停發送資料50,並且持續一個等待時間T1的長度。此時,用戶端設備4因為第一計數器41的計數滿足預設條件而得知伺服端設備5已經進入等待時間T1,並且會在等待時間T1中將欲發送給伺服端設備5的控制指令40發送給伺服端設備5。In the transmission method of the present invention, the server device 5 will suspend sending the data 50 when the count of the second counter 51 meets the preset condition, and continues for a length of waiting time T1. At this time, the client device 4 knows that the server device 5 has entered the waiting time T1 because the count of the first counter 41 meets the preset condition, and will send the control command 40 to the server device 5 during the waiting time T1. Sent to server device 5.

當等待時間T1經過後,用戶端設備4清除第一計數器41,並且伺服端設備5清除第二計數器51。並且,用戶端設備4停止發送控制指令40,並且伺服端設備5恢復發送資料50至用戶端設備4。當伺服端設備5恢復發送資料50時,第一計數器41及第二計數器51隨著資料50的發送重新開始進行累加。When the waiting time T1 elapses, the client device 4 clears the first counter 41, and the server device 5 clears the second counter 51. Furthermore, the client device 4 stops sending the control instructions 40 , and the server device 5 resumes sending data 50 to the client device 4 . When the server device 5 resumes sending the data 50, the first counter 41 and the second counter 51 resume accumulation as the data 50 is sent.

本發明的傳輸方法可以確保用戶端設備4僅在伺服端設備5停止發送資料50時將控制指令40發送給伺服端設備5,藉此可有效避免用戶端設備4發送的控制指令40與伺服端設備5發送的資料50發生碰撞,導致伺服端設備5無法正確接收控制指令40的問題。並且,由於伺服端設備5僅於所述等待時間T1中暫停發送資料50,但是不需要與用戶端設備4進行標準的交握程序。因此,仍然可以在單位時間內提供最大的資料傳輸量,以符合使用者對於即時監控的需求。The transmission method of the present invention can ensure that the client device 4 only sends the control command 40 to the server device 5 when the server device 5 stops sending data 50, thereby effectively avoiding the conflict between the control command 40 sent by the client device 4 and the server device 5. The data 50 sent by the device 5 collides, causing the server device 5 to be unable to receive the control command 40 correctly. Moreover, since the server device 5 only suspends sending the data 50 during the waiting time T1, it does not need to perform a standard handshake procedure with the client device 4. Therefore, it can still provide the maximum data transmission volume per unit time to meet users' needs for real-time monitoring.

續請同時參閱圖3及圖4,其中圖4為本發明的傳輸流程圖的第一具體實施例,並且圖4中的各步驟適用於圖3所示的傳輸架構。本發明中,用戶端設備4與伺服端設備5可以通過RS232序列埠6進行連接,並且執行圖4所示的各個具體步驟,以實現資料即時傳輸的主要目的。Please continue to refer to FIG. 3 and FIG. 4 at the same time. FIG. 4 is a first specific embodiment of the transmission flow chart of the present invention, and each step in FIG. 4 is applicable to the transmission architecture shown in FIG. 3 . In the present invention, the client device 4 and the server device 5 can be connected through the RS232 serial port 6, and perform various specific steps shown in Figure 4 to achieve the main purpose of real-time transmission of data.

如圖4所示,於用戶端設備4開始向伺服端設備5請求資料後(例如用戶端設備4執行了監控軟體或應用程式),伺服端設備5即基於用戶端設備4的請求,開始傳送資料50至用戶端設備4(步驟S10)。並且,用戶端設備4中的第一計數器41與伺服端設備5中的第二計數器51會同步進行累加(步驟S12)。As shown in Figure 4, after the client device 4 starts to request data from the server device 5 (for example, the client device 4 executes the monitoring software or application), the server device 5 starts transmitting based on the request of the client device 4. The data 50 is sent to the client device 4 (step S10). Moreover, the first counter 41 in the client device 4 and the second counter 51 in the server device 5 will accumulate simultaneously (step S12).

於一實施例中,伺服端設備5於傳送一筆資料50給用戶端設備4時,控制第二計數器51進行累加(例如加一)。並且,用戶端設備4於接收到伺服端設備5發送的一筆資料50時,控制第一計數器41進行累加(例如加一)。具體地,第一計數器41與第二計數器51累加的值相同,但累加的時間點不一定相同。In one embodiment, when transmitting a piece of data 50 to the client device 4, the server device 5 controls the second counter 51 to accumulate (for example, add one). Furthermore, when receiving a piece of data 50 sent by the server device 5, the client device 4 controls the first counter 41 to accumulate (for example, add one). Specifically, the values accumulated by the first counter 41 and the second counter 51 are the same, but the accumulation time points are not necessarily the same.

接著,由用戶端設備4、伺服端設備5、或是與用戶端設備4或伺服端設備5連接的其他電子裝置(圖未標示)判斷第一計數器41及第二計數器51的計數是否到達預設的觸發門檻值A1(步驟S14)。Then, the client device 4, the server device 5, or other electronic devices (not shown) connected to the client device 4 or the server device 5 determine whether the counts of the first counter 41 and the second counter 51 reach the predetermined value. Set the trigger threshold A1 (step S14).

於一實施例中,伺服端設備5於傳送一筆資料50給用戶端設備4時,控制第二計數器51加一。相對地,用戶端設備4於接收到伺服端設備5發送的一筆資料50時,控制第一計數器41加一。於本實施例中,所述觸發門檻值A1為伺服端設備5在指定時間內可以發送完成的資料量,例如為五筆資料至十筆資料不等,但不以此為限。In one embodiment, when transmitting a piece of data 50 to the client device 4, the server device 5 controls the second counter 51 to increase by one. Correspondingly, when receiving a piece of data 50 sent by the server device 5, the client device 4 controls the first counter 41 to increase by one. In this embodiment, the trigger threshold A1 is the amount of data that the server device 5 can send within a specified time, for example, ranging from five pieces of data to ten pieces of data, but is not limited to this.

於另一實施例中,第二計數器51可於伺服端設備5開始發送資料50後開始累計時間,而第一計數器41可於用戶端設備4開始接收資料50後開始累計時間。上述步驟S14係判斷所述累計時間是否到達預設的觸發門檻值A1。本實施例中,所述觸發門檻值A1可例如為伺服端設備5足夠發送充足的資料量的時間長度,例如為3000ms,但不加以限定。In another embodiment, the second counter 51 can start accumulating time after the server device 5 starts sending the data 50 , and the first counter 41 can start accumulating the time after the client device 4 starts receiving the data 50 . The above step S14 is to determine whether the accumulated time reaches the preset trigger threshold A1. In this embodiment, the trigger threshold A1 may be, for example, a time length sufficient for the server device 5 to send a sufficient amount of data, such as 3000 ms, but is not limited thereto.

為便於理解,下面將以伺服端設備5每發送一筆資料50就控制第一計數器41與第二計數器51分別加一的實施例,進行說明,但並不以此為限。For ease of understanding, the following will describe an embodiment in which the server device 5 controls the first counter 41 and the second counter 51 to increase by one each time it sends a piece of data 50, but it is not limited to this.

若於步驟S14中判斷第一計數器41及第二計數器51的計數尚未到達觸發門檻值A1,則返回步驟S10,以由伺服端設備5繼續發送資料50給用戶端設備4,並且第一計數器41與第二計數器51持續進行累加。值得一提的是,在步驟S10與步驟S12的執行過程中,用戶端設備4不被允許發送任何控制指令40給伺服端設備5。If it is determined in step S14 that the counts of the first counter 41 and the second counter 51 have not reached the trigger threshold A1, then return to step S10 to continue sending data 50 to the client device 4 from the server device 5, and the first counter 41 Accumulation continues with the second counter 51 . It is worth mentioning that during the execution of steps S10 and S12, the client device 4 is not allowed to send any control instructions 40 to the server device 5.

具體地,如圖3所示,用戶端設備4可具有指令佇列(Command Queue)42。在第一計數器41及第二計數器51的計數尚未到達觸發門檻值A1,且伺服端設備5持續發送資料50給用戶端設備4時,用戶端設備4會將欲發送給伺服端設備5的控制指令40先儲存於指令佇列42中。Specifically, as shown in FIG. 3 , the client device 4 may have a command queue (Command Queue) 42 . When the counts of the first counter 41 and the second counter 51 have not reached the trigger threshold A1 and the server device 5 continues to send data 50 to the client device 4, the client device 4 will send the control to the server device 5. The command 40 is first stored in the command queue 42 .

若於步驟S14中判斷第一計數器41及第二計數器51的計數到達觸發門檻值A1,伺服端設備5會暫時停止傳送資料50至用戶端設備4,並且持續一段等待時間T1(步驟S16)。If it is determined in step S14 that the counts of the first counter 41 and the second counter 51 reach the trigger threshold A1, the server device 5 will temporarily stop transmitting the data 50 to the client device 4 and continue for a waiting time T1 (step S16).

本發明中,第一計數器41的計數與第二計數器51的計數是同步的,當伺服端設備5基於第二計數器51的計數內容而暫停發送資料50時,用戶端設備4可依據第一計數器41的計數內容來判斷伺服端設備5暫時不會傳送資料50。In the present invention, the counting of the first counter 41 and the counting of the second counter 51 are synchronized. When the server device 5 suspends sending the data 50 based on the counting content of the second counter 51, the client device 4 can based on the first counter 51. The count content of 41 is used to determine that the server device 5 will not transmit data 50 temporarily.

本發明中,伺服端設備5先暫存於等待時間T1內欲傳送的資料50(例如,暫存於如圖3所示的暫存器52中)。於此同時,用戶端設備4經由RS232序列埠6將要發送至伺服端設備5的控制指令40發送給伺服端設備5(步驟S18)。於一實施例中,用戶端設備4於步驟S18中主要是將暫存於指令佇列42中的一或多筆控制指令40發送給至伺服端設備5。In the present invention, the server device 5 first temporarily stores the data 50 to be transmitted during the waiting time T1 (for example, temporarily stores it in the register 52 as shown in FIG. 3 ). At the same time, the client device 4 sends the control command 40 to be sent to the server device 5 to the server device 5 via the RS232 serial port 6 (step S18). In one embodiment, in step S18, the client device 4 mainly sends one or more control instructions 40 temporarily stored in the command queue 42 to the server device 5.

更具體地,伺服端設備5於等待時間T1中暫存要發送給用戶端設備4的資料50,而用戶端設備4於等待時間T1中發送控制指令40給伺服端設備5。藉由等待時間T1的設置,用戶端設備4發送的控制指令40與伺服端設備5發送的資料50不會發生碰撞,因此可確保伺服端設備5能夠正確地接收控制指令40。More specifically, the server device 5 temporarily stores the data 50 to be sent to the client device 4 during the waiting time T1, and the client device 4 sends the control command 40 to the server device 5 during the waiting time T1. By setting the waiting time T1, the control command 40 sent by the client device 4 and the data 50 sent by the server device 5 will not collide, thus ensuring that the server device 5 can correctly receive the control command 40.

接著,由用戶端設備4、伺服端設備5或是其他電子設備判斷等待時間T1是否經過(步驟S20)。於等待時間T1經過前,用戶端設備4與伺服端設備5重覆執行步驟S16及步驟S18,以令伺服端設備5持續暫存資料50,並令用戶端設備4持續發送控制指令40。Next, the client device 4, the server device 5 or other electronic devices determine whether the waiting time T1 has passed (step S20). Before the waiting time T1 elapses, the client device 4 and the server device 5 repeatedly execute steps S16 and S18 so that the server device 5 continues to temporarily store the data 50 and the client device 4 continues to send the control command 40 .

一般而言,控制指令40的大小會遠小於資料50的大小。一筆資料50的大小可例如為1~64KB,而一筆控制指令40的大小可例如為30~50byte。本發明中,等待時間T1的長度僅需令用戶端設備4可以傳送一筆完整的控制指令40即可。於一實施例中,所述等待時間T1可例如為100ms,但並不以此為限。Generally speaking, the size of the control instruction 40 will be much smaller than the size of the data 50 . The size of a piece of data 50 can be, for example, 1~64KB, and the size of a piece of control instruction 40 can be, for example, 30~50byte. In the present invention, the length of the waiting time T1 only needs to be such that the client device 4 can transmit a complete control command 40 . In one embodiment, the waiting time T1 may be, for example, 100 ms, but is not limited thereto.

若於步驟S20中判斷等待時間T1已經過,用戶端設備4與伺服端設備5分別清除第一計數器41及第二計數器51(步驟S22)。並且,在等待時間T1經過後,用戶端設備4、伺服端設備5或是其他電子設備判斷當前的資料傳輸模式(即,不進行交握程序的傳輸模式)是否結束(步驟S24)。若當前的資料傳輸模式尚未結束,則返回步驟S10,以令伺服端設備5恢復傳送資料50至用戶端設備4,並且令第一計數器41及第二計數器51重新累加。If it is determined in step S20 that the waiting time T1 has elapsed, the client device 4 and the server device 5 clear the first counter 41 and the second counter 51 respectively (step S22). Moreover, after the waiting time T1 elapses, the client device 4, the server device 5 or other electronic devices determine whether the current data transmission mode (that is, the transmission mode without handshaking procedure) ends (step S24). If the current data transmission mode has not ended, step S10 is returned to allow the server device 5 to resume transmitting data 50 to the client device 4 and to re-accumulate the first counter 41 and the second counter 51 .

於第一實施例中,用戶端設備4與伺服端設備5分別計算等待時間T1,並且於等待時間T1經過後,分別清除第一計數器41及第二計數器51。於第二實施例中,用戶端設備4於控制指令40發送完畢後清除第一計數器41,並且伺服端設備5於接收到用戶端設備4發出的控制指令40後清除第二計數器51。In the first embodiment, the client device 4 and the server device 5 calculate the waiting time T1 respectively, and clear the first counter 41 and the second counter 51 respectively after the waiting time T1 elapses. In the second embodiment, the client device 4 clears the first counter 41 after sending the control command 40, and the server device 5 clears the second counter 51 after receiving the control command 40 sent by the client device 4.

如上所述,伺服端設備5於等待時間T1中會暫存本來要發送的資料50,因此在等待時間T1經過後,伺服端設備5所發送的第一筆資料50的資料量將會大於其他時間點所發送的資料50的資料量。於第三實施例中,伺服端設備5於等待時間T1中接收到用戶端設備4發出的控制指令40後,確定與用戶端設備4間的通訊正常,因此可清除第二計數器51。並且,用戶端設備4在等待時間T1經過後接收到資料量明顯變大的資料50後,確定與伺服端設備5間的通訊正常,因此可清除第一計數器41。As mentioned above, the server device 5 will temporarily store the data 50 to be sent during the waiting time T1. Therefore, after the waiting time T1 elapses, the data volume of the first data 50 sent by the server device 5 will be larger than that of other data. The amount of data sent at the time point is 50. In the third embodiment, after receiving the control command 40 from the client device 4 during the waiting time T1, the server device 5 determines that the communication with the client device 4 is normal, and therefore clears the second counter 51. Moreover, after the waiting time T1 elapses, after the client device 4 receives the data 50 with an obviously larger amount of data, it determines that the communication with the server device 5 is normal, and therefore clears the first counter 41 .

惟,上述僅為本發明的部分具體實施範例,但並不以此為限。However, the above are only some specific implementation examples of the present invention, but are not limited thereto.

如上所述,在等待時間T1經過,且當前的資料傳輸模式尚未結束時,伺服端設備5恢復傳送資料50至用戶端設備4。由於伺服端設備5在等待時間T1內會將本來要發送給用戶端設備4的資料50暫存於暫存器52中,因此在離開等待時間T1後,伺服端設備5會先傳送暫存器52中的資料50至用戶端設備4,並且第一計數器41及第二計數器51會進行同步累加。於暫存器52中的資料50發送完畢後,伺服端設備5才會進一步發送即時資料50至用戶端設備4,並且令第一計數器41與第二計數器51同步累加。As mentioned above, after the waiting time T1 has elapsed and the current data transmission mode has not yet ended, the server device 5 resumes transmitting the data 50 to the client device 4 . Since the server device 5 will temporarily store the data 50 originally intended to be sent to the client device 4 in the register 52 during the waiting time T1, so after leaving the waiting time T1, the server device 5 will first send the register The data 50 in 52 is sent to the client device 4, and the first counter 41 and the second counter 51 are accumulated synchronously. After the data 50 in the register 52 is sent, the server device 5 further sends the real-time data 50 to the client device 4, and causes the first counter 41 and the second counter 51 to accumulate synchronously.

續請同時參閱圖3、圖4及圖5,其中圖5為本發明的傳輸流程圖的第二具體實施例,並且圖5中的各步驟適用於圖3所示的傳輸架構。圖5係以用戶端設備4的角度,對圖4的流程圖做更進一步的說明。Please refer to Figure 3, Figure 4 and Figure 5 at the same time. Figure 5 is a second specific embodiment of the transmission flow chart of the present invention, and each step in Figure 5 is applicable to the transmission architecture shown in Figure 3. FIG. 5 further explains the flow chart of FIG. 4 from the perspective of the client device 4 .

如圖5所示,在通過RS232序列埠6建立與伺服端設備5間的連接後,用戶端設備4即可通過RS232序列埠6持續接收伺服端設備5發送的資料50(步驟S30)。並且,於接收到所述資料50時,用戶端設備4控制其內的第一計數器41進行累加(步驟S32)。具體地,第一計數器41的計數與伺服端設備5中的第二計數器51的計數同步。As shown in Figure 5, after establishing a connection with the server device 5 through the RS232 serial port 6, the client device 4 can continue to receive the data 50 sent by the server device 5 through the RS232 serial port 6 (step S30). Furthermore, upon receiving the data 50, the client device 4 controls the first counter 41 therein to accumulate (step S32). Specifically, the counting of the first counter 41 is synchronized with the counting of the second counter 51 in the server device 5 .

於一實施例中,用戶端設備4每接收一筆資料50即控制第一計數器41加一,但不以此為限。In one embodiment, the client device 4 controls the first counter 41 to increase by one each time it receives a piece of data 50, but it is not limited to this.

在第一計數器41的計數尚未到達預設的觸發門檻值(例如圖3所示的觸發門檻值A1)前,用戶端設備4持續判斷是否需要傳送控制指令40給伺服端設備5(步驟S34)。若需要傳送控制指令40至伺服端設備5,則用戶端設備4先將要傳送的一或多筆控制指令40依序儲存於用戶端設備4中的指令佇列42(步驟S36)。換句話說,在第一計數器41的計數尚未到達觸發門檻值A1之前,用戶端設備4不會發送任何控制指令40給伺服端設備5。Before the count of the first counter 41 reaches the preset trigger threshold (for example, the trigger threshold A1 shown in FIG. 3 ), the client device 4 continues to determine whether it is necessary to send the control command 40 to the server device 5 (step S34 ). . If the control command 40 needs to be sent to the server device 5, the client device 4 first stores one or more control commands 40 to be sent in the command queue 42 in the client device 4 (step S36). In other words, before the count of the first counter 41 reaches the trigger threshold A1, the client device 4 will not send any control instruction 40 to the server device 5.

承上,在與伺服端設備5連接的期間,用戶端設備4持續判斷第一計數器41的計數是否到達觸發門檻值A1(步驟S38)。並且,用戶端設備4在第一計數器41的計數尚未到達觸發門檻值A1前重覆執行步驟S30至步驟S36,以持續接收伺服端設備5發送的資料50、持續累加第一計數器41,並且持續暫存控制指令40。Following the above, while connected to the server device 5 , the client device 4 continues to determine whether the count of the first counter 41 reaches the trigger threshold A1 (step S38 ). Furthermore, the client device 4 repeatedly executes steps S30 to S36 before the count of the first counter 41 reaches the trigger threshold A1, so as to continue to receive the data 50 sent by the server device 5, continue to accumulate the first counter 41, and continue to Temporarily store control instructions 40.

在第一計數器41的計數到達觸發門檻值A1後,用戶端設備4直接認定伺服端設備5將會暫時停止發送資料50,而RS232序列埠6會暫時進入空閒狀態。因此,用戶端設備4可通過RS232序列埠6,將指令佇列42中儲存的一或多筆控制指令40依序發送至伺服端設備5(步驟S40)。於步驟S40後,用戶端設備清除第一計數器41(步驟S42)。After the count of the first counter 41 reaches the trigger threshold A1, the client device 4 directly determines that the server device 5 will temporarily stop sending data 50, and the RS232 serial port 6 will temporarily enter an idle state. Therefore, the client device 4 can sequentially send one or more control commands 40 stored in the command queue 42 to the server device 5 through the RS232 serial port 6 (step S40). After step S40, the client device clears the first counter 41 (step S42).

於第一實施例中,用戶端設備4是在指令佇列42中的所有控制指令40皆發送完畢後清除第一計數器41。於第二實施例中,用戶端設備4是在計時所述等待時間T1經過後清除第一計數器41。於第三實施例中,用戶端設備4是在第一計數器41的計數到達觸發門檻值A1後直接清除第一計數器41。於第四實施例中,用戶端設備4是在再次收到伺服端設備5發送的資料50,且判斷資料50的資料量大於其他時間點所接收的資料50的資料量時清除第一計數器41。In the first embodiment, the client device 4 clears the first counter 41 after all control commands 40 in the command queue 42 have been sent. In the second embodiment, the client device 4 clears the first counter 41 after the waiting time T1 has elapsed. In the third embodiment, the client device 4 directly clears the first counter 41 after the count of the first counter 41 reaches the trigger threshold A1. In the fourth embodiment, the client device 4 clears the first counter 41 when it receives the data 50 sent by the server device 5 again and determines that the amount of data 50 is greater than the amount of data 50 received at other points in time. .

惟,上述為本發明的部分具體實施範例,但並不以上述者為限。However, the above are some specific implementation examples of the present invention, but are not limited to the above.

步驟S42後,用戶端設備4可判斷本發明的傳輸方法是否結束(步驟S44),並且於傳輸方法尚未結束前重覆執行上述步驟S30至步驟S42。After step S42, the client device 4 can determine whether the transmission method of the present invention ends (step S44), and repeat the above steps S30 to step S42 before the transmission method ends.

於一實施例中,用戶端設備4是在接受外部控制(例如由使用者觸發)以進入一特定模式(例如示波器模式)時,啟用本發明的傳輸方法,並且於離開所述特定模式時結束本發明的傳輸方法(容後詳述)。於此實施例中,只有在所述特定模式下,用戶端設備4才會基於圖5的流程圖中的各步驟(即,步驟S30至步驟S44)來進行運作。In one embodiment, the client device 4 starts the transmission method of the present invention when it accepts external control (for example, triggered by the user) to enter a specific mode (for example, oscilloscope mode), and ends when it leaves the specific mode. The transmission method of the present invention (described in detail later). In this embodiment, only in the specific mode, the client device 4 will operate based on each step in the flowchart of FIG. 5 (ie, step S30 to step S44).

續請同時參閱圖3、圖4及圖6,其中圖6為本發明的傳輸流程圖的第三具體實施例,並且圖6中的各步驟適用於圖3所示的傳輸架構。圖6係以伺服端設備5的角度,對圖4的流程圖做更進一步的說明。Please refer to Figure 3, Figure 4 and Figure 6 at the same time. Figure 6 is a third specific embodiment of the transmission flow chart of the present invention, and each step in Figure 6 is applicable to the transmission architecture shown in Figure 3. Figure 6 is a further explanation of the flow chart of Figure 4 from the perspective of the server device 5.

如圖6所示,在通過RS232序列埠6與用戶端設備4建立連接後,伺服端設備5即可通過RS232序列埠6持續發送資料50至用戶端設備4(步驟S50)。具體地,使用者可操作用戶端設備4來對伺服端設備5下達命令,以令伺服端設備5對外擷取使用者所需的資料50並且即時回傳至用戶端設備4。藉此,可以達到令使用者通過用戶端設備4來進行即時監控的目的。As shown in Figure 6, after establishing a connection with the client device 4 through the RS232 serial port 6, the server device 5 can continue to send data 50 to the client device 4 through the RS232 serial port 6 (step S50). Specifically, the user can operate the client device 4 to issue commands to the server device 5 so that the server device 5 externally retrieves the data 50 required by the user and transmits it back to the client device 4 immediately. In this way, the purpose of allowing the user to perform real-time monitoring through the client device 4 can be achieved.

於發送資料50時,伺服端設備5控制其內的第二計數器51進行累加(步驟S52)。具體地,第二計數器51的計數與用戶端設備4中的第一計數器41的計數同步。When sending the data 50, the server device 5 controls the second counter 51 in the server device 5 to accumulate (step S52). Specifically, the counting of the second counter 51 is synchronized with the counting of the first counter 41 in the client device 4 .

於一實施例中,伺服端設備5每發送一筆資料50就控制第二計數器51加一,但不以此為限。In one embodiment, the server device 5 controls the second counter 51 to increment by one every time it sends a piece of data 50, but it is not limited to this.

伺服端設備5持續判斷第二計數器51的計數是否到達觸發門檻值A1(步驟S54)。在第二計數器51的計數尚未到達觸發門檻值A1前,伺服端設備5重覆執行步驟S50及步驟S52,以持續搜集並發送資料50至用戶端設備4,並控制第二計數器51持續累計。The server device 5 continues to determine whether the count of the second counter 51 reaches the trigger threshold A1 (step S54). Before the count of the second counter 51 reaches the trigger threshold A1, the server device 5 repeatedly executes steps S50 and S52 to continue to collect and send data 50 to the client device 4, and controls the second counter 51 to continue to accumulate.

於第二計數器51的計數到達觸發門檻值A1後,伺服端設備5停止發送資料50至用戶端設備4,並且維持一段預設的等待時間(例如圖3所示的等待時間T1)(步驟S56)。於等待時間T1中,伺服端設備5不將資料50直接發送至用戶端設備4,而是先將資料50暫存於內部的暫存器52。並且,於等待時間T1中,伺服端設備5可接收用戶端設備4發送過來的一或多筆控制指令40。After the count of the second counter 51 reaches the trigger threshold A1, the server device 5 stops sending the data 50 to the client device 4 and maintains a preset waiting time (such as the waiting time T1 shown in FIG. 3) (step S56 ). During the waiting time T1, the server device 5 does not directly send the data 50 to the client device 4, but first temporarily stores the data 50 in the internal register 52. Moreover, during the waiting time T1, the server device 5 may receive one or more control instructions 40 sent from the client device 4.

於等待期間,伺服端設備5持續判斷等待時間T1是否經過(步驟S58)。During the waiting period, the server device 5 continues to determine whether the waiting time T1 has passed (step S58).

於等待時間T1經過前,伺服端設備5重覆執行步驟S58,以持續進行等待、暫存原本要發送至用戶端設備4的資料50,並且接收用戶端設備4所發送的控制指令40。於等待時間T1經過後,伺服器設備5清除第二計數器51(步驟S60)。Before the waiting time T1 elapses, the server device 5 repeatedly executes step S58 to continue waiting, temporarily store the data 50 originally intended to be sent to the client device 4, and receive the control command 40 sent by the client device 4. After the waiting time T1 elapses, the server device 5 clears the second counter 51 (step S60).

於第一實施例中,伺服端設備5是在等待時間T1經過後清除第二計數器51。於第二實施例中,伺服端設備5是在第二計數器51的計數到達觸發門檻值A1後直接清除第二計數器51。惟,上述僅為本發明的部分具體實施範例,但並不以此為限。In the first embodiment, the server device 5 clears the second counter 51 after the waiting time T1 elapses. In the second embodiment, the server device 5 directly clears the second counter 51 after the count of the second counter 51 reaches the trigger threshold A1. However, the above are only some specific implementation examples of the present invention, but are not limited thereto.

步驟S60後,伺服端設備5可判斷本發明的傳輸方法是否結束(步驟S62),並且於傳輸方法尚未結束前,重覆執行上述步驟S50至步驟S60,以恢復發送資料50至用戶端設備4,並且控制第二計數器51繼續進行累計。After step S60, the server device 5 can determine whether the transmission method of the present invention is completed (step S62), and before the transmission method is completed, repeatedly execute the above steps S50 to step S60 to resume sending the data 50 to the client device 4. , and controls the second counter 51 to continue to accumulate.

值得一提的是,於伺服端設備5恢復發送資料50至用戶端設備4時,伺服器設備5會先發送在步驟S56中暫存至暫存器52中的資料50至用戶端設備4,並且令第二計數器51進行累加後,才會接著執行步驟S50,以發送下一筆即時的資料50至用戶端設備4。It is worth mentioning that when the server device 5 resumes sending the data 50 to the client device 4, the server device 5 will first send the data 50 temporarily stored in the register 52 in step S56 to the client device 4. After the second counter 51 is accumulated, step S50 is executed to send the next real-time data 50 to the client device 4 .

如前文所述,用戶端設備4與伺服端設備5可以是在進入特定模式後,才會啟用本發明的傳輸方法來進行資料50與控制指令40的傳輸。換句話說,當用戶端設備4與伺服端設備5進入其他模式時,會改為使用其他的傳輸方法來進行其他資料的傳輸。As mentioned above, the client device 4 and the server device 5 may enable the transmission method of the present invention to transmit the data 50 and the control command 40 only after entering a specific mode. In other words, when the client device 4 and the server device 5 enter other modes, other transmission methods will be used to transmit other data.

參閱圖3及圖7,其中圖7為本發明的傳輸流程圖的第四具體實施例,並且圖7中的各步驟適用於圖3所示的傳輸架構。如圖7所示,首先,用戶端設備4與伺服端設備5通過RS232序列埠6進行連接(步驟S70)。並且,用戶端設備4與伺服端設備5通過RS232序列埠6執行標準傳輸程序(步驟S72)。Referring to FIG. 3 and FIG. 7 , FIG. 7 is a fourth specific embodiment of the transmission flow chart of the present invention, and each step in FIG. 7 is applicable to the transmission architecture shown in FIG. 3 . As shown in Figure 7, first, the client device 4 and the server device 5 are connected through the RS232 serial port 6 (step S70). Furthermore, the client device 4 and the server device 5 execute a standard transmission procedure through the RS232 serial port 6 (step S72).

於一實施例中,所述標準傳輸程序指的是需要進行交握程序的傳輸方式。具體地,所述標準傳輸程序包括:(1)由伺服端設備5傳送資料50給用戶端設備4,以及(2)由用戶端設備4在接收資料50後,傳送資料50的確認封包給伺服端設備5。In one embodiment, the standard transmission procedure refers to a transmission method that requires a handshake procedure. Specifically, the standard transmission procedure includes: (1) the server device 5 transmits the data 50 to the client device 4, and (2) the client device 4 sends a confirmation packet of the data 50 to the server after receiving the data 50. Terminal device 5.

於執行標準傳輸程序的期間,用戶端設備4、伺服端設備5或其他電子裝置持續判斷用戶端設備4是否受使用者的操控,並且進入示波器模式(步驟S74)。於一實施例中,所述示波器模式指的是由伺服端設備5持續發送即時資料50至用戶端設備4,並由用戶端設備4基於所接收的資料50繪製波形並且即時顯示的即時資料監控模式。During the execution of the standard transmission procedure, the client device 4, the server device 5 or other electronic devices continue to determine whether the client device 4 is controlled by the user, and enter the oscilloscope mode (step S74). In one embodiment, the oscilloscope mode refers to real-time data monitoring in which the server device 5 continuously sends real-time data 50 to the client device 4, and the client device 4 draws a waveform based on the received data 50 and displays it in real time. model.

示波器模式為本領域的通常技術,於此不再贅述。The oscilloscope mode is a common technology in this field and will not be described in detail here.

本發明的其中一個技術特徵在於,在用戶端設備4沒有進入示波器模式前,用戶端設備4與伺服端設備5重覆執行步驟S72,以持續藉由標準傳輸程序來進行資料、控制指令的傳輸。當用戶端設備4進入示波器模式後,用戶端設備4與伺服端設備5結束標準傳輸程序,並且啟用本發明的傳輸方法(即,執行如圖4、圖5及圖6所示的各步驟)。One of the technical features of the present invention is that before the client device 4 enters the oscilloscope mode, the client device 4 and the server device 5 repeatedly execute step S72 to continue to transmit data and control instructions through standard transmission procedures. . When the client device 4 enters the oscilloscope mode, the client device 4 and the server device 5 end the standard transmission procedure and enable the transmission method of the present invention (that is, perform the steps shown in Figure 4, Figure 5 and Figure 6) .

本發明中,用戶端設備4可以在進入示波器模式後,動態地於其中建立第一計數器41(步驟S76),並且伺服端設備5可以在進入示波器模式後,動態地於其中建立第二計數器51(步驟S78)。藉此,於示波器模式的執行期間,用戶端設備4與伺服端設備5可以通過第一計數器41及第二計數器51來進行同步計數,藉此執行本發明的傳輸方法(步驟S80)。In the present invention, the client device 4 can dynamically establish the first counter 41 in it after entering the oscilloscope mode (step S76), and the server device 5 can dynamically establish the second counter 51 in it after entering the oscilloscope mode. (Step S78). Thereby, during the execution of the oscilloscope mode, the client device 4 and the server device 5 can perform synchronous counting through the first counter 41 and the second counter 51, thereby executing the transmission method of the present invention (step S80).

用戶端設備4、伺服端設備5或其他電子裝置持續判斷用戶端設備4是否接受使用者的操作,並離開示波器模式(步驟S82)。於離開示波器模式前,用戶端設備4與伺服端設備5重覆執行步驟S80,以持續執行本發明的傳輸方法。The client device 4, the server device 5 or other electronic devices continue to determine whether the client device 4 accepts the user's operation and leaves the oscilloscope mode (step S82). Before leaving the oscilloscope mode, the client device 4 and the server device 5 repeatedly execute step S80 to continue executing the transmission method of the present invention.

若於步驟S82中判斷用戶端設備4離開了示波器模式,則由於標準傳輸程序不需要進行計數,因此用戶端設備4及伺服端設備5可以選擇性地取消第一計數器41與第二計數器51(步驟S84)。If it is determined in step S82 that the client device 4 has left the oscilloscope mode, since the standard transmission procedure does not require counting, the client device 4 and the server device 5 can selectively cancel the first counter 41 and the second counter 51 ( Step S84).

接著,用戶端設備4、伺服端設備5或其他電子裝置判斷用戶端設備4與伺服端設備5間的資料傳輸程序是否中斷(步驟S86)。於一實施例中,用戶端設備4與伺服端設備5間的資料傳輸程序於RS232序列埠6被卸除時中斷,但並不以此為限。Next, the client device 4, the server device 5 or other electronic devices determine whether the data transmission process between the client device 4 and the server device 5 is interrupted (step S86). In one embodiment, the data transmission process between the client device 4 and the server device 5 is interrupted when the RS232 serial port 6 is removed, but it is not limited to this.

於用戶端設備4與伺服端設備5間的資料傳輸程序中斷前,用戶端設備4與伺服端設備5結束本發明的傳輸方法,並且返回步驟S72,以重新執行標準傳輸程序。藉此,可以節省用戶端設備4及伺服端設備5的有限資源。Before the data transmission procedure between the client device 4 and the server device 5 is interrupted, the client device 4 and the server device 5 end the transmission method of the present invention and return to step S72 to re-execute the standard transmission procedure. In this way, the limited resources of the client device 4 and the server device 5 can be saved.

通過本發明的傳輸方法,即使是使用RS232序列埠來進行連接,仍令用戶端設備在最短的時間內收到最大的資料量,並且不會令用戶端設備發送的控制指令與伺服端設備發送的資料發生碰撞。Through the transmission method of the present invention, even if the RS232 serial port is used for connection, the client device can still receive the maximum amount of data in the shortest time, and the control instructions sent by the client device will not conflict with those sent by the server device. data collided.

以上所述僅為本發明之較佳具體實例,非因此即侷限本發明之專利範圍,故舉凡運用本發明內容所為之等效變化,均同理皆包含於本發明之範圍內,合予陳明。The above descriptions are only preferred specific examples of the present invention, which do not limit the patent scope of the present invention. Therefore, all equivalent changes made by applying the content of the present invention are equally included in the scope of the present invention, and are hereby stated. bright.

1:用戶端設備1: Client device

11:控制指令11:Control instructions

12:確認封包12:Confirm packet

2:伺服端設備2:Servo-side equipment

21:資料21:Information

22:確認封包22:Confirm packet

3:RS232序列埠3:RS232 serial port

4:用戶端設備4: Client device

40:控制指令40:Control instructions

41:第一計數器41: first counter

42:指令佇列42: Command queue

5:伺服端設備5:Servo-side equipment

50:資料50:Information

51:第二計數器51: Second counter

52:暫存器52: Temporary register

6:RS232序列埠6:RS232 serial port

A1:觸發門檻值A1: Trigger threshold

T1:等待時間T1: waiting time

S10~S24、S30~S44、S50~S62、S70~S86:傳輸步驟S10~S24, S30~S44, S50~S62, S70~S86: Transmission steps

圖1為相關技術的RS232序列埠傳輸示意圖。Figure 1 is a schematic diagram of RS232 serial port transmission in related technology.

圖2為本發明的第一具體實施例的RS232序列埠傳輸示意圖。Figure 2 is a schematic diagram of RS232 serial port transmission according to the first specific embodiment of the present invention.

圖3為本發明的第二具體實施例的RS232序列埠傳輸示意圖。Figure 3 is a schematic diagram of RS232 serial port transmission according to the second specific embodiment of the present invention.

圖4為本發明的傳輸流程圖的第一具體實施例。Figure 4 is a first specific embodiment of the transmission flow chart of the present invention.

圖5為本發明的傳輸流程圖的第二具體實施例。Figure 5 is a second specific embodiment of the transmission flow chart of the present invention.

圖6為本發明的傳輸流程圖的第三具體實施例。Figure 6 is a third specific embodiment of the transmission flow chart of the present invention.

圖7為本發明的傳輸流程圖的第四具體實施例。Figure 7 is a fourth specific embodiment of the transmission flow chart of the present invention.

S10~S24:傳輸步驟 S10~S24: Transmission steps

Claims (11)

一種基於RS232序列埠實現的資料與指令傳輸方法,應用於通過一RS232序列埠連接的一用戶端設備及一伺服端設備,該傳輸方法包括: a)於該伺服端設備傳送資料至該用戶端設備時,控制該用戶端設備的一第一計數器及該伺服端設備的一第二計數器的計數進行同步累加; b)於該第一計數器及該第二計數器的計數到達一觸發門檻值之前重覆執行該步驟a); c)於該第一計數器及該第二計數器的計數到達該觸發門檻值時,該伺服端設備於一等待時間內停止傳送資料至該用戶端設備,並且該伺服端設備暫存該等待時間內欲傳送的資料; d)該用戶端設備於該等待時間內發送一控制指令至該伺服端設備;及 e)於該等待時間過後清除該第一計數器及該第二計數器,並且該伺服端設備恢復傳送資料至該用戶端設備。 A data and command transmission method based on an RS232 serial port, applied to a client device and a server device connected through an RS232 serial port. The transmission method includes: a) When the server device transmits data to the client device, control the counts of a first counter of the client device and a second counter of the server device to synchronously accumulate; b) Repeat step a) before the counts of the first counter and the second counter reach a trigger threshold; c) When the counts of the first counter and the second counter reach the trigger threshold, the server device stops transmitting data to the client device within a waiting time, and the server device temporarily stores the data within the waiting time. the information to be transmitted; d) The client device sends a control command to the server device within the waiting time; and e) Clear the first counter and the second counter after the waiting time, and the server device resumes transmitting data to the client device. 如請求項1所述的傳輸方法,其中該步驟a)是於該伺服端設備傳送一筆資料至該用戶端設備時控制該第二計數器加一,並且於該用戶端設備接收該筆資料時控制該第一計數器加一。The transmission method as described in claim 1, wherein step a) is to control the second counter to be incremented by one when the server device sends a piece of data to the client device, and to control when the client device receives the data. The first counter is incremented by one. 如請求項1所述的傳輸方法,其中該步驟e)是由該伺服端設備先傳送於該步驟c)中暫存的資料至該用戶端設備並控制該第一計數器及該第二計數器同步累加後,再次執行該步驟a)至該步驟e)。The transmission method as described in claim 1, wherein step e) is for the server device to first transmit the data temporarily stored in step c) to the client device and control the synchronization of the first counter and the second counter. After accumulation, perform step a) to step e) again. 如請求項1所述的傳輸方法,其中該步驟a)之前更包括: a01)該伺服端設備與該用戶端設備通過該RS232序列埠進行一標準傳輸程序,其中該標準傳輸程序包括由該伺服端設備傳送一資料給該用戶端設備,以及由該用戶端設備傳送該資料的一確認封包給該伺服端設備; a02)於該用戶端設備進入一示波器模式時,控制該伺服端設備與該用戶端設備通過該RS232序列埠結束該標準傳輸程序並執行該步驟a)至該步驟e)。 The transmission method as described in claim 1, wherein step a) before step further includes: a01) The server device and the client device perform a standard transmission procedure through the RS232 serial port, wherein the standard transmission procedure includes transmitting a data from the server device to the client device, and transmitting the data from the client device A confirmation packet of data is sent to the server device; a02) When the client device enters an oscilloscope mode, control the server device and the client device to end the standard transmission procedure through the RS232 serial port and execute step a) to step e). 如請求項4所述的傳輸方法,其中包括一步驟a03):於該用戶端設備進入該示波器模式時,於該用戶端設備中建立該第一計數器,並且於該伺服端設備中建立該第二計數器。The transmission method as described in claim 4, including a step a03): when the client device enters the oscilloscope mode, establish the first counter in the client device, and establish the third counter in the server device. Two counters. 如請求項4所述的傳輸方法,其中包括一步驟f):於該用戶端設備離開該示波器模式時,取消該第一計數器及該第二計數器,並控制該伺服端設備與該用戶端設備恢復該標準傳輸程序。The transmission method as described in claim 4, including a step f): when the client device leaves the oscilloscope mode, cancel the first counter and the second counter, and control the server device and the client device Restore this standard transfer procedure. 如請求項1所述的傳輸方法,其中該用戶端設備具有一指令佇列,並且該傳輸方法包括: a1)於該第一計數器及該第二計數器的計數到達該觸發門檻值之前,該用戶端設備將欲發送至該伺服端設備的該控制指令儲存至該指令佇列; 其中,該步驟d)是將該指令佇列中的該控制指令發送至該伺服端設備。 The transmission method as described in claim 1, wherein the client device has an instruction queue, and the transmission method includes: a1) Before the counts of the first counter and the second counter reach the trigger threshold, the client device stores the control command to be sent to the server device in the command queue; The step d) is to send the control command in the command queue to the server device. 一種基於RS232序列埠實現資料與指令傳輸方法,應用於通過一RS232序列埠連接一伺服端設備的一用戶端設備,該傳輸方法包括: a)於接收該伺服端設備傳送的資料時,控制一第一計數器進行累加,其中該第一計數器與該伺服端設備中的一第二計數器同步; b)於欲傳送一控制指令至該伺服端設備時,將該控制指令儲存於一指令佇列; c)於該第一計數器的計數到達一觸發門檻值之前重覆執行該步驟a)及該步驟b); d)於該第一計數器的計數到達該觸發門檻值時,將該指令佇列中的該控制指令發送至該伺服端設備;及 e)該步驟d)後清除該第一計數器,並且再次執行該步驟a)至該步驟d)。 A method for transmitting data and instructions based on an RS232 serial port, applied to a client device connected to a server device through an RS232 serial port. The transmission method includes: a) When receiving data sent by the server device, control a first counter to accumulate, wherein the first counter is synchronized with a second counter in the server device; b) When sending a control command to the server device, store the control command in a command queue; c) Repeat step a) and step b) before the count of the first counter reaches a trigger threshold; d) When the count of the first counter reaches the trigger threshold, send the control command in the command queue to the server device; and e) Clear the first counter after step d), and perform steps a) to step d) again. 如請求項8所述的傳輸方法,其中更包括: f)於進入一示波器模式時建立該第一計數器,並且執行該步驟a)至該步驟e);及 g)於離開該示波器模式時取消該第一計數器,其中該用戶端設備離開該示波器模式後通過該RS232序列埠與該用戶端設備執行一標準傳輸程序,該標準傳輸程序包括由該伺服端設備傳送一資料給該用戶端設備,以及由該用戶端設備傳送該資料的一確認封包給該伺服端設備。 The transmission method as described in request item 8, which further includes: f) Establish the first counter when entering an oscilloscope mode, and perform step a) to step e); and g) Cancel the first counter when leaving the oscilloscope mode, wherein the client device performs a standard transmission procedure with the client device through the RS232 serial port after leaving the oscilloscope mode. The standard transmission procedure includes by the server device Send a piece of data to the client device, and send an acknowledgment packet of the data to the server device from the client device. 一種基於RS232序列埠實現資料與指令傳輸方法,應用於通過一RS232序列埠連接一用戶端設備的一伺服端設備,該傳輸方法包括: a)於發送資料至該用戶端設備時,控制一第二計數器進行累加,其中該第二計數器與該用戶端設備中的一第一計數器同步; b)於該第二計數器的計數到達一觸發門檻值之前重覆執行該步驟a); c)於該第二計數器的計數到達該觸發門檻值時,停止發送資料至該用戶端設備並維持一等待時間,並且暫存該等待時間內欲發送的資料;及 d)於該等待時間過後清除該該第二計數器,並且恢復發送資料至該用戶端設備。 A method for transmitting data and instructions based on an RS232 serial port, which is applied to a server device connected to a client device through an RS232 serial port. The transmission method includes: a) When sending data to the client device, control a second counter to accumulate, wherein the second counter is synchronized with a first counter in the client device; b) Repeat step a) before the count of the second counter reaches a trigger threshold; c) When the count of the second counter reaches the trigger threshold, stop sending data to the client device and maintain a waiting time, and temporarily store the data to be sent during the waiting time; and d) Clear the second counter after the waiting time and resume sending data to the client device. 如請求項10所述的傳輸方法,其中該步驟d)是先發送於該步驟c)中暫存的資料至該用戶端設備並控制該第二計數器累加後,再次執行該步驟a)至該步驟c)。The transmission method as described in claim 10, wherein step d) is to first send the data temporarily stored in step c) to the client device and control the accumulation of the second counter, and then perform step a) again to the client device. Step c).
TW111108733A 2022-03-10 2022-03-10 Method of transmitting data and command through rs232 serial port TWI806483B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111108733A TWI806483B (en) 2022-03-10 2022-03-10 Method of transmitting data and command through rs232 serial port

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111108733A TWI806483B (en) 2022-03-10 2022-03-10 Method of transmitting data and command through rs232 serial port

Publications (2)

Publication Number Publication Date
TWI806483B TWI806483B (en) 2023-06-21
TW202336602A true TW202336602A (en) 2023-09-16

Family

ID=87803158

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111108733A TWI806483B (en) 2022-03-10 2022-03-10 Method of transmitting data and command through rs232 serial port

Country Status (1)

Country Link
TW (1) TWI806483B (en)

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW406224B (en) * 1998-06-29 2000-09-21 Ind Tech Res Inst Apparatus for calibrating flow-meter using standing-start method
TWI252064B (en) * 2004-06-30 2006-03-21 Inventec Corp Adaptor board for burning
CN102866976B (en) * 2012-09-17 2015-03-11 山东神戎电子股份有限公司 Serial port time-sharing multiplexing method in embedded system
TWI504215B (en) * 2013-08-20 2015-10-11 Tatung Co Data transmission system and method
US9825754B2 (en) * 2015-06-22 2017-11-21 Microchip Technology Incorporated Independent UART BRK detection
US10425268B2 (en) * 2015-06-23 2019-09-24 Microchip Technology Incorporated UART with line activity detector
CN110546614B (en) * 2017-05-05 2023-09-26 微芯片技术股份有限公司 Apparatus and method for transmitting events over a serial communication link with uniform delay

Also Published As

Publication number Publication date
TWI806483B (en) 2023-06-21

Similar Documents

Publication Publication Date Title
CN104168081B (en) A kind of document transmission method and device
CN104168093B (en) A kind of document transmission method and device
CN104184753B (en) A kind of document transmission method and device
KR20150118130A (en) Systems and methods for synchronizing nodes of a robotic system
US8190941B2 (en) Field control system
JP2007200055A (en) Iscsi communication control method and storage system using it
JP3474646B2 (en) Input / output control device and input / output control method
US10346332B2 (en) Slave device
TWI806483B (en) Method of transmitting data and command through rs232 serial port
US20130145025A1 (en) Programmable controller
WO2016197693A1 (en) Operation instruction processing method and apparatus
CN106372019B (en) A kind of processing method and timeout treatment device of system bus devices response timeout
TW201532404A (en) Method of logging in computers from remote end
CN116775534A (en) Data and instruction transmission method based on RS232 serial port
JP2003167756A5 (en)
US10608863B2 (en) Transmission control application supporting TCP fast open
WO2018082006A1 (en) Control method, control apparatus, and control system
JP7251182B2 (en) CONTROLLER, PROCESSING DEVICE CONTROL METHOD AND PROGRAM
Siva et al. Connection-Oriented BLE Traffic Servicing Characteristics on Android Devices
JPH11225166A (en) Flow control method
TWI813482B (en) Speed testing method and speed testing system
CN113971151B (en) Serial transmission controller and data transmission method thereof
TWI724670B (en) Fault-tolerant system and control method thereof
JPH07141273A (en) Communication performance adjustment processor
JP2005174097A (en) Host interface controller, control method and control program