Data and instruction transmission method based on RS232 serial port

By using a synchronous counter to control data and command transmission in the RS232 serial port, the problems of excessive transmission time and control command collisions in industrial environments are solved, thereby maximizing data transmission and real-time monitoring.

CN116775534BActive Publication Date: 2026-07-07DELTA ELECTRONICS INC(CN)

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
DELTA ELECTRONICS INC(CN)
Filing Date
2022-03-10
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

When RS232 serial ports are used for real-time data transmission in industrial environments, the transmission time is too long, which cannot meet the real-time monitoring needs of user-end devices, and control commands and data transmission are prone to collision.

Method used

By using synchronous counters in both user-end and server-end devices, the transmission process of data and instructions is controlled. This includes synchronous counter accumulation, trigger thresholds, waiting time, and data temporary storage. This avoids handshakes, ensures that the amount of data transmitted is maximized in the shortest possible time, and prevents collisions between control instructions and data.

Benefits of technology

Without data handover, the system enables user devices to receive the maximum amount of data in the shortest time and avoids collisions between control commands and data transmission, thus meeting the needs of real-time monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116775534B_ABST
    Figure CN116775534B_ABST
Patent Text Reader

Abstract

A data and instruction transmission method based on RS232 serial port is applied to user terminal equipment and server equipment connected by RS232 serial port, and includes the following steps: when the server equipment transmits a data to the user terminal equipment, the first counter in the user terminal equipment and the second counter in the server equipment are controlled to accumulate; when the count of the two counters reaches the trigger threshold value, the server equipment is controlled to suspend data transmission and wait; when the server equipment waits, the user terminal equipment sends an instruction to the server; after the waiting time reaches, the two counters are cleared, and the server equipment is controlled to resume data transmission to the user terminal equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for transmitting data and instructions, and more particularly to a method for transmitting data and instructions based on an RS232 serial port. Background Technology

[0002] In industrial environments, user-end devices (such as industrial computers) and servo devices (such as servo motors) often use RS232 serial ports to connect and transmit data and control commands.

[0003] The standard data transmission procedure of the RS232 serial port requires a hand-shaking process. Specifically, after the sender transmits data to the receiver, the receiver must reply with an acknowledgment signal to complete the transmission. However, this back-and-forth hand-shaking process is quite time-consuming, reducing the amount of data that can be transmitted per unit of time. Therefore, the RS232 serial port is not suitable for performing real-time data transmission.

[0004] See Figure 1 This is a schematic diagram of RS232 serial port transmission for related technologies. For example... Figure 1 As shown, when user terminal device 1 and server terminal device 2 are connected via RS232 serial port 3 and execute a standard transmission procedure, if user terminal device 1 sends control command 11 to server terminal device 2, server terminal device 2 must reply with an acknowledgment packet 12 to user terminal device 1 after receiving it. Similarly, when server terminal device 2 sends data 21 to user terminal device 1, user terminal device 1 must also reply with an acknowledgment packet 12 to server terminal device 2 after receiving it.

[0005] Generally, server device 2 can be used to connect to industrial equipment within a factory to collect and record real-time data from the equipment. Server device 2 then sends the recorded data back to user device 1, allowing the user to monitor the industrial equipment in real time. In the aforementioned environment, the data 21 transmitted by server device 2 may be very large (e.g., each data entry is 1-64KB). If it were to go through the standard transmission procedure described above, it would be impossible to complete the transmission within a limited time (e.g., 1000ms). Therefore, the user's real-time monitoring requirements would not be met.

[0006] Therefore, how to modify the RS232 serial port transmission program to increase the amount of data transmitted is a topic that technical personnel in the field can study in depth. Summary of the Invention

[0007] This invention provides a data and command transmission method based on an RS232 serial port, which enables user terminal devices using an RS232 serial port to receive the maximum amount of data in the shortest time.

[0008] In one embodiment of the present invention, the transmission method is applied to a user terminal device and a server terminal device connected via an RS232 serial port, and includes the following steps:

[0009] a) When the server device transmits data to the user device, the counts of a first counter of the user device and a second counter of the server device are synchronously accumulated.

[0010] b) Repeat step a) before the counts of the first counter and the second counter reach a trigger threshold value;

[0011] c) When the counts of the first counter and the second counter reach the trigger threshold, the server device stops transmitting data to the user device within a waiting period, and the server device temporarily stores the data to be transmitted within the waiting period.

[0012] d) The user terminal device sends a control command to the server terminal device during the waiting time; and

[0013] e) After the waiting time has elapsed, the first counter and the second counter are cleared, and the server device resumes transmitting data to the user device.

[0014] In another embodiment of the present invention, the transmission method is applied to a user terminal device connected to a server terminal device via an RS232 serial port, and includes the following steps:

[0015] a) When receiving data transmitted by the server device, control a first counter to increment, wherein the first counter is synchronized with a second counter in the server device;

[0016] b) When a control command is to be transmitted to the server device, the control command is stored in a command queue;

[0017] c) Repeat steps a) and b) before the count of the first counter reaches a trigger threshold value;

[0018] d) When the count of the first counter reaches the trigger threshold, the control command in the instruction queue is sent to the server device; and

[0019] e) After step d), the first counter is cleared, and steps a) through d) are executed again.

[0020] In another embodiment of the present invention, the transmission method is applied to a server device connected to a user terminal device via an RS232 serial port, and includes the following steps:

[0021] a) When sending data to the user terminal device, a second counter is controlled to accumulate, wherein the second counter is synchronized with a first counter in the user terminal device;

[0022] b) Repeat step a) before the count of the second counter reaches a trigger threshold;

[0023] c) When the count of the second counter reaches the trigger threshold, data transmission to the user terminal device is stopped and a waiting period is maintained, and the data to be transmitted during the waiting period is temporarily stored; and

[0024] d) After the waiting time has elapsed, clear the second counter and resume sending data to the user terminal device.

[0025] Compared to related technologies, this invention enables the user device to receive the maximum amount of data in the shortest time without using the RS232 serial port and without data handshaking. Furthermore, when the user device sends control commands to the server device, there will be no collision with the data transmitted by the server device. Attached Figure Description

[0026] Figure 1 This is a schematic diagram of RS232 serial port transmission for related technologies.

[0027] Figure 2 This is a schematic diagram of RS232 serial port transmission according to the first specific embodiment of the present invention.

[0028] Figure 3 This is a schematic diagram of RS232 serial port transmission according to a second specific embodiment of the present invention.

[0029] Figure 4 This is a first specific embodiment of the transmission flowchart of the present invention.

[0030] Figure 5 This is a second specific embodiment of the transmission flowchart of the present invention.

[0031] Figure 6 This is a third specific embodiment of the transmission flowchart of the present invention.

[0032] Figure 7 This is the fourth specific embodiment of the transmission flowchart of the present invention.

[0033] Explanation of reference numerals in the attached figures:

[0034] 1…User terminal equipment

[0035] 11…Control Commands

[0036] 12…Confirm packet

[0037] 2…Server-side devices

[0038] 21… data

[0039] 22…Confirm packet

[0040] 3…RS232 serial port

[0041] 4…User terminal equipment

[0042] 40… Control Commands

[0043] 41…First Counter

[0044] 42… Command queue

[0045] 5… Server-side devices

[0046] 50… data

[0047] 51…Second Counter

[0048] 52… Temporary Register

[0049] 6…RS232 serial port

[0050] A1… Trigger threshold value

[0051] T1…waiting time

[0052] Transmission steps S10~S24, S30~S44, S50~S62, S70~S86… Detailed Implementation

[0053] A preferred embodiment of the present invention will now be described in detail with reference to the accompanying drawings.

[0054] This invention discloses a data and instruction transmission method (hereinafter referred to as the transmission method in the specification), which is mainly applied to two or more electronic devices that transmit data and control instructions through an RS232 serial port.

[0055] See Figure 2 This is a schematic diagram of RS232 serial port transmission according to the first specific embodiment of the present invention. Figure 2 As shown, the transmission method of the present invention is applied to a user terminal device 4 and a server terminal device 5 connected via an RS232 serial port 6, so that the user terminal device 4 and the server terminal device 5 can transmit data and control commands without going through a handshake process, thereby obtaining the maximum data transmission volume per unit time.

[0056] Specifically, the user terminal device 4 may be, for example, a personal computer, an industrial computer, or a cloud server, an electronic device that supports the RS232 serial port 6, but is not limited thereto. When the user terminal device 4 executes a specific application or software, it can communicate with the server terminal device 5 through the RS232 serial port 6 and receive data 50 sent by the server terminal device 5 in real time.

[0057] The servo device 5 can be, for example, a servo motor or servo motor, especially an AC servo motor, but is not limited thereto. The servo device 5 can connect to various industrial devices in the environment (not shown in the figure) and, based on requests from the user device 4 (especially applications or software running on the user device 4), transmits data 50 from the industrial devices to the user device 4 in real time via RS232 serial port 6. This achieves the user's primary objective of monitoring industrial equipment in real time through the user device 4.

[0058] At Figure 2 In this embodiment, the user terminal device 4 (mainly referring to the application or software) is modified so that it does not reply with a corresponding acknowledgment packet after receiving the data 50 sent by the server terminal device 5. Conversely, the server terminal device 5 is also modified so that it can continue to send the next piece of data 50 to the user terminal device 4 without receiving any acknowledgment packets. This effectively shortens the transmission time of data 50, increases the amount of data transmitted per unit time, and thus meets the user's need for real-time monitoring via the RS232 serial port 6.

[0059] It is worth noting that because there is no need to wait for acknowledgment packets, the server device 5 continuously sends data 50 to the user device 4. This makes it impossible for the user device 4 to predict when the server device 5 will stop sending data 50 (i.e., when the RS232 serial port 6 will be idle). Therefore, when the user device 4 needs to send control commands 40 to the server device 5 to control the server device 5, it can only send them directly to the server device 5 via RS232 serial port 6 without any judgment process. In this case, the control commands 40 sent by the user device 4 and the data 50 sent by the server device 5 may collide, causing the server device 5 to fail to receive the control commands 40 correctly.

[0060] When the user terminal device 4 receives the next data 50 sent by the server terminal device 5, and finds from the content of the data 50 that the state of the server terminal device 5 has not changed accordingly based on the content of the control command 40, it will determine that the server terminal device 5 has not correctly received the control command 40. In this case, the user terminal device 4 can only send the same control command 40 to the server terminal device 5 again.

[0061] For example, user device 4 can send a control command 40 to stop the server device 5 from performing calculations. If user device 4 continues to receive processed data 50 after sending control command 40, it can be determined that server device 5 has not received control command 40.

[0062] In view of the above problems, the present invention is based on Figure 2 The embodiments further propose another implementation method.

[0063] Please see Figure 3 This is a schematic diagram of RS232 serial port transmission according to the second specific embodiment of the present invention. Figure 3 Implementation examples and Figure 2 The main difference in the embodiments is that the user terminal device 4 has a first counter 41, the server terminal device 5 has a second counter 51, and the first counter 41 and the second counter 51 are synchronized.

[0064] Specifically, before transmitting data 50 or control command 40, the user terminal device 4 and the server terminal device 5 can respectively set the first counter 41 and the second counter 51 to 0 (e.g., execute a reset procedure) to synchronize the first counter 41 and the second counter 51. After the first counter 41 and the second counter 51 are synchronized, data 50 transmission begins via the RS232 serial port 6.

[0065] In this invention, when the server device 5 sends data 50 to the user device 4, the first counter 41 and the second counter 51 will accumulate synchronously. When the counts of the first counter 41 and the second counter 51 meet the preset conditions (for example, the number of data 50 sent reaches the trigger threshold value A1), the server device 5 will temporarily stop sending data 50 to the user device 4.

[0066] In the transmission method of the present invention, the server device 5 will pause sending data 50 when the count of the second counter 51 meets a preset condition, and continue for a waiting time T1. At this time, the user 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 be sent to the server device 5 during the waiting time T1.

[0067] After the waiting time T1 has elapsed, the user terminal device 4 clears the first counter 41, and the server terminal device 5 clears the second counter 51. Furthermore, the user terminal device 4 stops sending control commands 40, and the server terminal device 5 resumes sending data 50 to the user terminal device 4. When the server terminal device 5 resumes sending data 50, the first counter 41 and the second counter 51 restart their incrementing as data 50 is sent.

[0068] The transmission method of this invention ensures that the user terminal device 4 sends the control command 40 to the server terminal device 5 only when the server terminal device 5 stops sending data 50. This effectively avoids collisions between the control command 40 sent by the user terminal device 4 and the data 50 sent by the server terminal device 5, preventing the server terminal device 5 from correctly receiving the control command 40. Furthermore, since the server terminal device 5 only pauses sending data 50 during the waiting time T1, it does not need to perform a standard handshake procedure with the user terminal device 4. Therefore, it can still provide the maximum data transmission volume per unit time to meet the user's real-time monitoring needs.

[0069] Please also refer to Figure 3 and Figure 4 ,in Figure 4 This is a first specific embodiment of the transmission flowchart of the present invention, and Figure 4 The steps in are applicable to Figure 3 The transmission architecture is shown. In this invention, the user terminal device 4 and the server terminal device 5 can be connected via RS232 serial port 6 and execute... Figure 4 The specific steps shown are for achieving the main purpose of real-time data transmission.

[0070] like Figure 4 As shown, after the user terminal device 4 starts requesting data from the server terminal device 5 (for example, the user terminal device 4 executes monitoring software or an application), the server terminal device 5 starts transmitting data 50 to the user terminal device 4 based on the request (step S10). Furthermore, the first counter 41 in the user terminal device 4 and the second counter 51 in the server terminal device 5 are synchronously incremented (step S12).

[0071] In one embodiment, when the server device 5 transmits a piece of data 50 to the user device 4, it controls the second counter 51 to increment (e.g., by one). Furthermore, when the user device 4 receives a piece of data 50 from the server device 5, it controls the first counter 41 to increment (e.g., by one). Specifically, the first counter 41 and the second counter 51 accumulate to the same value, but the timing of their increments may differ.

[0072] Next, the user terminal device 4, the server terminal device 5, or other electronic devices (not shown) connected to the user terminal device 4 or the server terminal device 5 determine whether the counts of the first counter 41 and the second counter 51 have reached the preset trigger threshold value A1 (step S14).

[0073] In one embodiment, when the server device 5 transmits a piece of data 50 to the user device 4, it controls the second counter 51 to increment by one. Conversely, when the user device 4 receives a piece of data 50 sent by the server device 5, it controls the first counter 41 to increment by one. In this embodiment, the trigger threshold value A1 is the amount of data that the server device 5 can transmit within a specified time, for example, five to ten pieces of data, but not limited to this.

[0074] In another embodiment, the second counter 51 can start accumulating time after the server device 5 starts sending data 50, while the first counter 41 can start accumulating time after the user device 4 starts receiving data 50. Step S14 above determines whether the accumulated time has reached a preset trigger threshold value A1. In this embodiment, the trigger threshold value A1 can be, for example, the length of time for the server device 5 to send a sufficient amount of data, such as 3000ms, but is not limited thereto.

[0075] For ease of understanding, the following description will use an example in which the server device 5 controls the first counter 41 and the second counter 51 to increment by one each time it sends a piece of data 50, but this is not a limitation.

[0076] If it is determined in step S14 that the counts of the first counter 41 and the second counter 51 have not yet reached the trigger threshold value A1, then the process returns to step S10, allowing the server device 5 to continue sending data 50 to the user device 4, and the first counter 41 and the second counter 51 continue to accumulate. It is worth noting that during the execution of steps S10 and S12, the user device 4 is not allowed to send any control commands 40 to the server device 5.

[0077] Specifically, such as Figure 3 As shown, the user terminal device 4 may have a command queue 42. When the counts of the first counter 41 and the second counter 51 have not yet reached the trigger threshold value A1, and the server terminal device 5 continues to send data 50 to the user terminal device 4, the user terminal device 4 will first store the control command 40 to be sent to the server terminal device 5 in the command queue 42.

[0078] If it is determined in step S14 that the counts of the first counter 41 and the second counter 51 have reached the trigger threshold value A1, the server device 5 will temporarily stop transmitting data 50 to the user device 4 and continue to wait for a period of time T1 (step S16).

[0079] In this invention, the counting of the first counter 41 and the counting of the second counter 51 are synchronized. When the server device 5 pauses sending data 50 based on the counting content of the second counter 51, the user device 4 can determine that the server device 5 will not transmit data 50 temporarily based on the counting content of the first counter 41.

[0080] In this invention, the server device 5 first temporarily stores the data 50 to be transmitted during the waiting time T1 (for example, temporarily stored in a...). Figure 3 (In the temporary register 52 shown). At the same time, the user terminal device 4 sends the control command 40 to be sent to the server terminal device 5 via the RS232 serial port 6 (step S18). In one embodiment, in step S18, the user terminal device 4 mainly sends one or more control commands 40 temporarily stored in the command queue 42 to the server terminal device 5.

[0081] More specifically, the server device 5 temporarily stores the data 50 to be sent to the user device 4 during the waiting time T1, while the user 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 user 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.

[0082] Next, the user terminal device 4, the server terminal device 5, or other electronic devices determine whether the waiting time T1 has elapsed (step S20). Before the waiting time T1 has elapsed, the user terminal device 4 and the server terminal device 5 repeat steps S16 and S18, so that the server terminal device 5 continues to temporarily store the data 50 and the user terminal device 4 continues to send control commands 40.

[0083] Generally, the size of the control instruction 40 is much smaller than the size of the data 50. The size of a data 50 can be, for example, 1–64 KB, while the size of a control instruction 40 can be, for example, 30–50 bytes. In this invention, the length of the waiting time T1 is only required to allow the user terminal device 4 to transmit a complete control instruction 40. In one embodiment, the waiting time T1 can be, for example, 100 ms, but is not limited thereto.

[0084] If it is determined in step S20 that the waiting time T1 has elapsed, the user terminal device 4 and the server terminal device 5 clear the first counter 41 and the second counter 51 respectively (step S22). Furthermore, after the waiting time T1 has elapsed, the user terminal device 4, the server terminal device 5, or other electronic devices determine whether the current data transmission mode (i.e., the transmission mode without a handshake procedure) has ended (step S24). If the current data transmission mode has not ended, the process returns to step S10, causing the server terminal device 5 to resume transmitting data 50 to the user terminal device 4, and causing the first counter 41 and the second counter 51 to increment again.

[0085] In the first embodiment, the user terminal device 4 and the server terminal device 5 respectively calculate the waiting time T1, and after the waiting time T1 has elapsed, they clear the first counter 41 and the second counter 51 respectively. In the second embodiment, the user terminal device 4 clears the first counter 41 after the control command 40 has been sent, and the server terminal device 5 clears the second counter 51 after receiving the control command 40 from the user terminal device 4.

[0086] As described above, the server device 5 temporarily stores the data 50 that was originally intended to be sent during the waiting time T1. Therefore, after the waiting time T1 has elapsed, the amount of data 50 sent by the server device 5 in the first data transmission will be greater than the amount of data 50 sent at other times. In the third embodiment, after receiving the control command 40 from the user device 4 during the waiting time T1, the server device 5 determines that the communication with the user device 4 is normal, and therefore clears the second counter 51. Furthermore, after receiving the data 50 with a significantly larger amount of data after the waiting time T1 has elapsed, the user device 4 determines that the communication with the server device 5 is normal, and therefore clears the first counter 41.

[0087] The above are only some specific examples of the present invention, but are not limited thereto.

[0088] As described above, after the waiting time T1 has elapsed and the current data transmission mode has not yet ended, the server device 5 resumes transmitting data 50 to the user device 4. Since the server device 5 temporarily stores the data 50 that was originally intended for the user device 4 in the register 52 during the waiting time T1, after the waiting time T1 ends, the server device 5 first transmits the data 50 from the register 52 to the user device 4, and the first counter 41 and the second counter 51 are synchronously incremented. Only after the data 50 in the register 52 has been completely transmitted will the server device 5 further transmit real-time data 50 to the user device 4, and the first counter 41 and the second counter 51 will be synchronously incremented.

[0089] Please also refer to Figure 3 , Figure 4 and Figure 5 ,in Figure 5 This is a second specific embodiment of the transmission flowchart of the present invention, and Figure 5 The steps in are applicable to Figure 3 The transmission architecture shown. Figure 5 From the perspective of user terminal device 4, Figure 4 The flowchart will be explained in more detail.

[0090] like Figure 5 As shown, after establishing a connection with the server device 5 via RS232 serial port 6, the user device 4 can continuously receive data 50 sent by the server device 5 via RS232 serial port 6 (step S30). Furthermore, upon receiving the data 50, the user device 4 controls its internal first counter 41 to increment (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.

[0091] In one embodiment, the user terminal device 4 controls the first counter 41 to increment by one each time it receives a piece of data 50, but this is not a limitation.

[0092] The count of the first counter 41 has not yet reached the preset trigger threshold value (e.g. Figure 3 Before the trigger threshold A1 shown, the user terminal device 4 continuously determines whether it is necessary to transmit control commands 40 to the server terminal device 5 (step S34). If it is necessary to transmit control commands 40 to the server terminal device 5, the user terminal device 4 first stores one or more control commands 40 to be transmitted in sequence in the command queue 42 in the user terminal device 4 (step S36). In other words, before the count of the first counter 41 reaches the trigger threshold A1, the user terminal device 4 will not send any control commands 40 to the server terminal device 5.

[0093] Continuing on, during the connection with the server device 5, the user device 4 continuously determines whether the count of the first counter 41 has reached the trigger threshold value A1 (step S38). Furthermore, before the count of the first counter 41 reaches the trigger threshold value A1, the user device 4 repeats steps S30 to S36 to continuously receive data 50 sent by the server device 5, continuously increment the first counter 41, and continuously temporarily store control instructions 40.

[0094] After the count of the first counter 41 reaches the trigger threshold A1, the user terminal device 4 directly determines that the server terminal device 5 will temporarily stop sending data 50, and the RS232 serial port 6 will temporarily enter an idle state. Therefore, the user terminal device 4 can send one or more control commands 40 stored in the command queue 42 to the server terminal device 5 in sequence through the RS232 serial port 6 (step S40). After step S40, the user terminal device clears the first counter 41 (step S42).

[0095] In the first embodiment, the user terminal 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 user terminal device 4 clears the first counter 41 after the waiting time T1 has elapsed. In the third embodiment, the user terminal device 4 clears the first counter 41 directly after its count reaches the trigger threshold value A1. In the fourth embodiment, the user terminal device 4 clears the first counter 41 when it receives data 50 from the server terminal device 5 again and determines that the amount of data 50 is greater than the amount of data 50 received at other times.

[0096] The above are some specific embodiments of the present invention, but are not limited to them.

[0097] After step S42, the user terminal device 4 can determine whether the transmission method of the present invention has ended (step S44), and repeat steps S30 to S42 before the transmission method ends.

[0098] In one embodiment, the user terminal device 4 activates the transmission method of the present invention when it receives external control (e.g., triggered by a user) to enter a specific mode (e.g., oscilloscope mode), and terminates the transmission method of the present invention when it leaves the specific mode (described in detail later). In this embodiment, the user terminal device 4 only activates the transmission method based on the specified mode. Figure 5 The process is carried out by each step in the flowchart (i.e., steps S30 to S44).

[0099] Please also refer to Figure 3 , Figure 4 and Figure 6 ,in Figure 6 This is a third specific embodiment of the transmission flowchart of the present invention, and Figure 6 The steps in are applicable to Figure 3 The transmission architecture shown. Figure 6 From the perspective of server device 5, Figure 4 The flowchart will be explained in more detail.

[0100] like Figure 6As shown, after establishing a connection with the user terminal device 4 via RS232 serial port 6, the server terminal device 5 can continuously send data 50 to the user terminal device 4 via RS232 serial port 6 (step S50). Specifically, the user can operate the user terminal device 4 to issue commands to the server terminal device 5, so that the server terminal device 5 can obtain the data 50 required by the user and send it back to the user terminal device 4 in real time. In this way, the user can perform real-time monitoring through the user terminal device 4.

[0101] When sending data 50, the server device 5 controls its internal second counter 51 to increment (step S52). Specifically, the counting of the second counter 51 is synchronized with the counting of the first counter 41 in the user terminal device 4.

[0102] In one embodiment, the server device 5 controls the second counter 51 to increment by one each time it sends a piece of data 50, but this is not a limitation.

[0103] The server device 5 continuously determines whether the count of the second counter 51 has reached the trigger threshold value A1 (step S54). Before the count of the second counter 51 reaches the trigger threshold value A1, the server device 5 repeats steps S50 and S52 to continuously collect and send data 50 to the user terminal device 4, and controls the second counter 51 to continue accumulating.

[0104] After the second counter 51 reaches the trigger threshold A1, the server device 5 stops sending data 50 to the user device 4 and maintains a preset waiting time (e.g., Figure 3 (See the waiting time T1) (step S56). During the waiting time T1, the server device 5 does not directly send the data 50 to the user device 4, but first temporarily stores the data 50 in the internal register 52. Furthermore, during the waiting time T1, the server device 5 can receive one or more control commands 40 sent by the user device 4.

[0105] During the waiting period, the server device 5 continuously determines whether the waiting time T1 has elapsed (step S58).

[0106] Before the waiting time T1 elapses, the server device 5 repeats step S58 to continue waiting, temporarily store the data 50 that was originally to be sent to the user device 4, and receive the control command 40 sent by the user device 4. After the waiting time T1 elapses, the server device 5 clears the second counter 51 (step S60).

[0107] In the first embodiment, the server device 5 clears the second counter 51 after the waiting time T1 has elapsed. In the second embodiment, the server device 5 clears the second counter 51 directly after the count of the second counter 51 reaches the trigger threshold value A1. However, the above are only some specific implementation examples of the present invention, and are not intended to limit it.

[0108] After step S60, the server device 5 can determine whether the transmission method of the present invention has ended (step S62), and before the transmission method has ended, repeat steps S50 to S60 to resume sending data 50 to the user device 4, and control the second counter 51 to continue accumulating.

[0109] It is worth mentioning that when the server device 5 resumes sending data 50 to the user device 4, the server device 5 will first send the data 50 temporarily stored in the register 52 in step S56 to the user device 4, and after the second counter 51 is incremented, it will then execute step S50 to send the next piece of real-time data 50 to the user device 4.

[0110] As mentioned above, the user terminal device 4 and the server terminal device 5 may only activate the transmission method of the present invention to transmit data 50 and control commands 40 after entering a specific mode. In other words, when the user terminal device 4 and the server terminal device 5 enter other modes, they will switch to using other transmission methods to transmit other data.

[0111] See Figure 3 and Figure 7 ,in Figure 7 This is a fourth specific embodiment of the transmission flowchart of the present invention, and Figure 7 The steps in are applicable to Figure 3 The transmission architecture is shown. (As shown in the image) Figure 7 As shown, firstly, the user terminal device 4 and the server terminal device 5 are connected via RS232 serial port 6 (step S70). Then, the user terminal device 4 and the server terminal device 5 execute a standard transmission procedure via RS232 serial port 6 (step S72).

[0112] In one embodiment, the standard transmission procedure refers to a transmission method that requires a handshake process. Specifically, the standard transmission procedure includes: (1) the server device 5 transmitting data 50 to the user device 4, and (2) the user device 4 transmitting an acknowledgment packet of data 50 to the server device 5 after receiving data 50.

[0113] During the execution of the standard transmission procedure, the user terminal device 4, the server terminal device 5, or other electronic devices continuously determine whether the user terminal device 4 is being controlled by the user and enter oscilloscope mode (step S74). In one embodiment, the oscilloscope mode refers to a real-time data monitoring mode in which the server terminal device 5 continuously sends real-time data 50 to the user terminal device 4, and the user terminal device 4 plots waveforms based on the received data 50 and displays them in real time.

[0114] Oscilloscope mode is a common technique in this field and will not be described in detail here.

[0115] One technical feature of this invention is that, before the user terminal device 4 enters oscilloscope mode, the user terminal device 4 and the server terminal device 5 repeatedly execute step S72 to continuously transmit data and control commands through the standard transmission procedure. When the user terminal device 4 enters oscilloscope mode, the user terminal device 4 and the server terminal device 5 end the standard transmission procedure and activate the transmission method of this invention (i.e., execute as described above). Figure 4 , Figure 5 and Figure 6 (The steps shown).

[0116] In this invention, the user terminal device 4 can dynamically establish a first counter 41 in the oscilloscope mode after entering the oscilloscope mode (step S76), and the server terminal device 5 can dynamically establish a second counter 51 in the oscilloscope mode after entering the oscilloscope mode (step S78). Thus, during the execution of the oscilloscope mode, the user terminal device 4 and the server terminal device 5 can perform synchronous counting through the first counter 41 and the second counter 51, thereby executing the transmission method of this invention (step S80).

[0117] User terminal device 4, server terminal device 5, or other electronic devices continuously determine whether user terminal device 4 accepts the user's operation and exit oscilloscope mode (step S82). Before exiting oscilloscope mode, user terminal device 4 and server terminal device 5 repeat step S80 to continuously execute the transmission method of the present invention.

[0118] If it is determined in step S82 that the user terminal device 4 has left the oscilloscope mode, then since the standard transmission procedure does not require counting, the user terminal device 4 and the server terminal device 5 can selectively cancel the first counter 41 and the second counter 51 (step S84).

[0119] Next, the user terminal device 4, the server terminal device 5, or other electronic device determines whether the data transmission process between the user terminal device 4 and the server terminal device 5 is interrupted (step S86). In one embodiment, the data transmission process between the user terminal device 4 and the server terminal device 5 is interrupted when the RS232 serial port 6 is unloaded, but this is not a limitation.

[0120] Before the data transmission process between user terminal device 4 and server terminal device 5 is interrupted, user terminal device 4 and server terminal device 5 terminate the transmission method of the present invention and return to step S72 to re-execute the standard transmission process. This saves the limited resources of user terminal device 4 and server terminal device 5.

[0121] The transmission method of this invention enables the user device to receive the maximum amount of data in the shortest time, even when using an RS232 serial port for connection, and prevents the control commands sent by the user device from colliding with the data sent by the server device.

[0122] The above description is merely a preferred embodiment of the present invention and is not intended to limit the claims of the present invention. Therefore, all equivalent variations made using the content of the present invention are similarly included within the scope of the present invention and are hereby declared.

Claims

1. A data and command transmission method based on an RS232 serial port, applied to a user terminal device and a server terminal device connected via an RS232 serial port, the transmission method comprising: a) When the server device transmits data to the user device, the counts of a first counter of the user device and a second counter of the server device are synchronously accumulated. b) Repeat step a) before the counts of the first counter and the second counter reach a trigger threshold value; c) When the counts of the first counter and the second counter reach the trigger threshold, the server device stops transmitting data to the user device within a waiting period, and the server device temporarily stores the data to be transmitted within the waiting period. d) The user terminal device sends a control command to the server terminal device during the waiting time; and e) After the waiting time has elapsed, the first counter and the second counter are cleared, and the server device resumes transmitting data to the user device.

2. The transmission method as described in claim 1, wherein step a) is to control the second counter to increment by one when the server device transmits a piece of data to the user device, and to control the first counter to increment by one when the user device receives the data.

3. The transmission method as described in claim 1, wherein step e) is performed by the server device first transmitting the data temporarily stored in step c) to the user device and controlling the first counter and the second counter to accumulate synchronously, and then executing steps a) to e) again.

4. The transmission method as described in claim 1, wherein the method further comprises, before step a), the following: a01) The server device and the user device perform a standard transmission procedure through the RS232 serial port, wherein the standard transmission procedure includes the server device transmitting data to the user device, and the user device transmitting an acknowledgment packet of the data to the server device. a02) When the user terminal device enters an oscilloscope mode, control the servo terminal device and the user terminal device to terminate the standard transmission procedure through the RS232 serial port and execute steps a) to e).

5. The transmission method as described in claim 4, comprising a step a03): when the user terminal device enters the oscilloscope mode, establishing the first counter in the user terminal device and establishing the second counter in the server terminal device.

6. The transmission method as claimed in claim 4, further comprising a step f): when the user terminal device leaves the oscilloscope mode, canceling the first counter and the second counter, and controlling the server terminal device and the user terminal device to resume the standard transmission procedure.

7. The transmission method of claim 1, wherein the user terminal device has an instruction queue, and the transmission method comprises: a1) Before the counts of the first counter and the second counter reach the trigger threshold, the user terminal device stores the control command to be sent to the server terminal device in the command queue; Step d) involves sending the control command from the command queue to the server device.

8. A method for transmitting data and commands based on an RS232 serial port, applied to a user terminal device connected to a server terminal device via an RS232 serial port, the transmission method comprising: a) When receiving data transmitted by the server device, control a first counter to increment, wherein the first counter is synchronized with a second counter in the server device; b) When a control command is to be transmitted to the server device, the control command is stored in a command queue; c) Repeat steps a) and b) before the count of the first counter reaches a trigger threshold value; d) When the count of the first counter reaches the trigger threshold, the control command in the instruction queue is sent to the server device; and e) After step d), the first counter is cleared, and steps a) through d) are executed again.

9. The transmission method as described in claim 8, further comprising: f) When entering an oscilloscope mode, establish the first counter and execute steps a) through e); and g) The first counter is canceled when leaving the oscilloscope mode, wherein after leaving the oscilloscope mode, the user device performs a standard transmission procedure with the user device through the RS232 serial port. The standard transmission procedure includes the server device transmitting data to the user device and the user device transmitting an acknowledgment packet of the data to the server device.

10. A method for transmitting data and commands based on an RS232 serial port, applied to a server-side device connected to a user-side device via an RS232 serial port, the method comprising: a) When sending data to the user terminal device, a second counter is controlled to accumulate, wherein the second counter is synchronized with a first counter in the user terminal 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 user terminal device and maintain a waiting time, and temporarily store the data to be sent during the waiting time; and d) After the waiting time has elapsed, clear the second counter and resume sending data to the user terminal device.

11. The transmission method as described in claim 10, wherein step d) involves first sending the data temporarily stored in step c) to the user terminal device and controlling the second counter to accumulate, and then executing steps a) to c) again.