Method, system, computing device, and readable medium for identifying string transmission type in serial communication
By recording and judging the time interval between bytes in serial communication, and using the millisecond and microsecond time differences to identify the string instruction type, the problem of difficult distinction of instruction types in serial communication devices is solved, and the accurate identification and execution of manual key operation and machine-sent strings are realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 上海芯联芯智能科技有限公司
- Filing Date
- 2022-12-22
- Publication Date
- 2026-05-29
AI Technical Summary
In serial communication devices, it is difficult to distinguish whether the received string is sent by manual key press or automatically by the machine, resulting in an inability to accurately identify the command type.
By recording and judging the time interval between the current byte and the bytes before and after it, the instruction type of the string is identified by the time difference at the millisecond and microsecond levels. The time interval for manual key press operation is at the millisecond level, while that for machine-sent commands is at the microsecond level, and control commands and configuration commands are executed respectively.
It accurately distinguishes between manual key presses and machine-sent strings, solves the problem of overlapping content, and achieves correct identification and execution of instruction types.
Smart Images

Figure CN116049074B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of FPGA serial communication, and more particularly to a method, system, computing device, and computer-readable medium for recognizing manual key presses and machine-sent strings in serial communication. Background Technology
[0002] In serial communication devices, the serial port module has difficulty distinguishing whether the received string comes from manual key press or automatic machine transmission, and therefore cannot distinguish whether the instruction is a configuration instruction or a control instruction.
[0003] Therefore, it is necessary to propose a new technical solution. Summary of the Invention
[0004] To address the technical problems existing in the prior art, this invention discloses a method, apparatus, and computer-readable medium for identifying the type of string transmission in serial communication.
[0005] On one hand, the present invention provides a method for identifying the string transmission type in serial communication, the method comprising:
[0006] Receive string;
[0007] Record the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte;
[0008] Determine the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte;
[0009] The type of instruction for sending characters is identified based on the judgment result. The instruction type includes control instructions and configuration instructions.
[0010] Furthermore, if the time interval between the current byte and the previous byte is greater than or equal to milliseconds, or the time interval between the current byte and the next byte is greater than or equal to milliseconds, then the instruction to send the character is identified as a control instruction.
[0011] Furthermore, the control commands are strings sent via manual keyboard input.
[0012] When the instruction to send characters is identified as a control instruction, the FPGA chip executes the identified control instruction.
[0013] Furthermore, the millisecond range is 750ms to 1s.
[0014] Furthermore, if the time interval between the current byte and the previous byte is on the order of microseconds, or the time interval between the current byte and the next byte is on the order of microseconds, then the instruction to identify the character to be sent is a configuration instruction.
[0015] Furthermore, the configuration instruction is a string sent via a computer.
[0016] When the instruction to send characters is identified as a configuration instruction, the FPGA chip executes the identified configuration instruction, pushes the configuration quality to the corresponding channel, and configures the parameters.
[0017] On the other hand, the present invention also provides a system for identifying the string transmission type in serial communication, which includes,
[0018] The receiving module is used to receive strings;
[0019] The clock module is used to record the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte;
[0020] The judgment module is used to determine the time interval between the current byte and the previous byte or the time interval between the current byte and the next byte;
[0021] The identification module is used to identify the instruction to send characters based on the judgment result. The instruction includes control instructions and configuration instructions.
[0022] Furthermore, it also includes an FPGA chip, which is used to execute instructions based on the instruction type of the identified sent character.
[0023] Furthermore, the present invention also provides a computing device comprising a processor and a memory, wherein the memory stores program instructions which are executed by the processor to implement the above-described method.
[0024] In another aspect, the present invention provides a computer-readable medium storing a computer program for performing the above-described method.
[0025] The present invention provides a method for identifying manual key press operations and machine-sent strings, which can accurately distinguish between manual key press operation commands and machine-sent commands, thus solving the content overlap defect caused by content recognition of strings.
[0026] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0027] Figure 1 This is a flowchart of a method for identifying the string transmission type in serial communication according to an embodiment of the present invention;
[0028] Figure 2 This is a system block diagram of a method for identifying the string transmission type in serial communication according to an embodiment of the present invention. Detailed Implementation
[0029] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose, the following detailed description of the specific implementation methods, structure, features and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided.
[0030] Example
[0031] Please see Figure 1 This invention discloses a method for identifying the string transmission type in serial communication, comprising the following steps:
[0032] S1. Receive string. Information in serial communication is sent byte by byte; the serial module receives strings.
[0033] S2. Record the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte. After receiving the string, the serial port module will record the time interval between the current byte and the previous byte, as well as the time interval between the next byte. The time interval is recorded using the built-in clock of the serial port module.
[0034] S3. Determine the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte.
[0035] S4. Identify the instruction type for sending characters based on the judgment result. The instruction type includes control instructions and configuration instructions.
[0036] If there is a time interval of >= milliseconds (ms) between the preceding and following bytes, it indicates that the string was sent by manual key press. In this case, the instruction is a control instruction, and the FPGA chip will execute the instruction after recognition to switch the operating mode or push the instruction to other corresponding channels. If the time interval between the preceding and following bytes is on the order of microseconds (μs), it is a configuration instruction issued by a computer. The FPGA chip will directly push it to the corresponding channel to configure the parameters.
[0037] The application scenario of this invention is serial communication used in FPGA testing. The principle behind this invention's method of distinguishing the input type of a string based on the interval between adjacent bytes is as follows: Strings sent manually via keystrokes will have a significantly longer time interval before and after reception compared to strings sent automatically by the machine. This time interval is determined by the operator's reaction time, at least in the millisecond range, and typically between 750ms and 1s; this reaction time cannot be avoided. However, strings sent by the machine have a freely configurable time interval, generally in the microsecond range. Therefore, the method described in this invention can accurately distinguish between manual keystroke commands and automatically sent machine commands, solving the content overlap defect caused by content recognition of strings.
[0038] In another embodiment, the present invention also provides a system for identifying the type of string transmission in serial communication, which includes a receiving module, a clock module, a judgment module, an identification module, and an execution module.
[0039] The receiving module is used to receive strings. Information during serial communication is sent byte by byte, and the serial port module receives strings.
[0040] The clock module is used to record the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte.
[0041] The judgment module is used to determine the time interval between the current byte and the previous byte or the time interval between the current byte and the next byte.
[0042] The recognition module is used to identify the instruction to send characters based on the judgment result. The instruction includes control instructions and configuration instructions.
[0043] The execution module is used to execute instructions according to the instruction type of the identified sent characters.
[0044] In another embodiment, the present invention also provides a computing device including a processor and a memory, the memory storing program instructions which are executed by the processor to implement the method described above.
[0045] In another embodiment, the present invention also provides a computer-readable medium storing a computer program for performing the above-described methods.
[0046] The method described in this invention can accurately distinguish between manual key press operation commands and machine-automated commands, thus solving the content overlap defect caused by content recognition strings.
[0047] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. In addition, those skilled in the art can combine and integrate the different embodiments or examples described in this specification.
[0048] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for identifying the string transmission type in serial communication, characterized in that, The method includes: Receive string; Record the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte; Determine the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte; The type of instruction for sending characters is identified based on the judgment result. The instruction type includes control instructions and configuration instructions. If the time interval between the current byte and the previous byte is ≥ milliseconds, or the time interval between the current byte and the next byte is ≥ milliseconds, then the instruction for sending characters is identified as a control instruction. The millisecond range is 750ms to 1s. If the time interval between the current byte and the previous byte is on the order of microseconds, or the time interval between the current byte and the next byte is on the order of microseconds, then the instruction to identify the character to be sent is a configuration instruction. The control commands are strings sent via manual keyboard input, while the configuration commands are strings sent via computer.
2. The method for identifying string transmission type in serial communication according to claim 1, characterized in that, When the instruction to send characters is identified as a control instruction, the FPGA chip executes the identified control instruction.
3. The method for identifying string transmission type in serial communication according to claim 1, characterized in that, When the instruction to send characters is identified as a configuration instruction, the FPGA chip executes the identified configuration instruction, pushes the configuration quality to the corresponding channel, and configures the parameters.
4. A system for identifying the type of string transmission in serial communication, characterized in that, It includes, The receiving module is used to receive strings; The clock module is used to record the time interval between the current byte and the previous byte, and the time interval between the current byte and the next byte; The judgment module is used to judge the time interval between the current byte and the previous byte and the time interval between the current byte and the next byte; if the time interval between the current byte and the previous byte is ≥ milliseconds, or the time interval between the current byte and the next byte is ≥ milliseconds, then the instruction to send the character is identified as a control instruction, where the millisecond range is 750ms to 1s; if the time interval between the current byte and the previous byte is microseconds, or the time interval between the current byte and the next byte is microseconds, then the instruction to send the character is identified as a configuration instruction. The recognition module is used to recognize the instruction to send characters based on the judgment result. The instruction includes a control instruction and a configuration instruction. The control instruction is a string sent by manual keyboard input, and the configuration instruction is a string sent by computer.
5. The system for identifying string transmission type in serial communication according to claim 4, characterized in that, It also includes, An FPGA chip is used to execute instructions based on the type of instruction that is identified when the character is sent.
6. A computing device, characterized in that, It includes a processor and a memory, wherein the memory stores program instructions that are executed by the processor to implement the method of any one of claims 1-3.
7. A computer-readable medium, characterized in that, The readable medium stores a computer program that performs the method according to any one of claims 1 to 3.