WO2019104531A1 - 一种基于查询方式模拟串口通信的方法和装置 - Google Patents
一种基于查询方式模拟串口通信的方法和装置 Download PDFInfo
- Publication number
- WO2019104531A1 WO2019104531A1 PCT/CN2017/113591 CN2017113591W WO2019104531A1 WO 2019104531 A1 WO2019104531 A1 WO 2019104531A1 CN 2017113591 W CN2017113591 W CN 2017113591W WO 2019104531 A1 WO2019104531 A1 WO 2019104531A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- bit
- timer
- time
- data
- interrupt time
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2213/00—Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F2213/0002—Serial port, e.g. RS232C
Definitions
- the present application relates to the field of communications technologies, and in particular, to a method and apparatus for simulating serial port communication based on a query mode.
- serial port In the field of industrial control, the serial port is very common because it is easy to use and easy to use.
- the serial interface uses an extended interface of serial communication to transmit data one bit at a time.
- MCU Microcontroller Unit
- the existing software analog serial port method generally detects the edge signal on the communication line by using the interruptable IO interface of the microcontroller, which not only increases the limitation of the selection of the microcontroller, but also requires the clock precision of the microcontroller. Higher.
- the existing analog serial communication method requires an IO interface with external interrupt capability to be used as a communication port.
- the special requirements for the IO interface increase the selection limitations of the microcontroller of the product.
- using the interrupt edge to record the level waveform will record the idle time between the two data messages in the data time, and an additional data parsing handler is required.
- the data parsing processing program needs to extract the data packet from the level waveform and determine whether the data packet of one frame is accepted. Therefore, the data communication processing process is complicated, which affects the serial communication efficiency.
- the clock of the microcontroller generally has errors, and the clock error of the microcontroller also brings unstable factors to the analog serial communication, and communication abnormalities or data errors occur.
- the present application provides a method and device for simulating serial port communication based on the query mode, and adopts a general-purpose timer and a general-purpose IO interface to implement the analog serial port communication function, and dynamically adjust the data message start bit.
- the timing interrupt time, the data reception is completed with a longer second interrupt time, and then the first interrupt time is restored to perform the detection and sampling, thereby avoiding the abnormality of the communication data caused by the clock error of the microcontroller, and improving the data reception accuracy.
- the embodiment of the present application provides a method for simulating serial communication based on a query mode, and the serial port communication is simulated by a timer and a general IO interface, including the following steps:
- the timer is controlled to sample the level of the general-purpose IO interface at a first interrupt time (T 1 );
- the first interrupt time of the timer is adjusted to be the second interrupt time (T 2 ) Sampling, receiving the data message in bits;
- the timer After receiving the stop bit of the data message, the timer is resumed to query the level of the general-purpose IO interface at the first interrupt time (T 1 ).
- the third interrupt time (T 3 ) of the timer is set according to the bit rate of the general IO interface, and the simulation is set according to the data bit of the transmitted data message in each third interrupt time period.
- the level status of the serial port stops the timer when a data message is sent.
- the second interrupt time (T 2 ) of the timer is: Where A is the communication bit rate;
- the third interrupt time (T 3 ) of the timer is: Where A is the communication bit rate.
- the delay time, the analog serial reception data, the first timer interruption time (T 1) the generic sampling timing IO interface level, when the first interruption time (T 1) sampling point just At the falling edge of the start bit, the timer is turned off, the first interrupt time (T 1 ) is delayed by a specified time (T), and then the timer is reset to the second interrupt time (T 2 ) for sampling.
- the sampling point that is sampled by the timer at the first interrupt time (T 1 ) falls close to the falling edge in the start bit, and the timer is turned off. Determining the first interrupt time (T 1 ) by a specified time (T), and then resetting the timer to the second interrupt time (T 2 ) for sampling,
- the analog serial port When the analog serial port receives data, it also includes the following steps:
- the second interrupt time (T 2 ) is, the start bit is received, and the modified state is the received data bit;
- the second interrupt time (T 2 ) is, the data bit is received, and the number of readings is recorded. If the number of readings is equal to the effective number of bits of the data message, the modified state is the received check digit;
- the second interrupt time (T 2 ) is, the check bit is received, and the check result is determined according to the received data content and the check bit; when the check result is incorrect, an error flag is set; when the check result is correct, the modified state is the receive stop bit. ;
- the second interrupt time (T 2 ) is reached, the stop bit is received; when the error stop bit is received, the error flag is set; when the correct stop bit is received, the modified state is the receive start bit.
- the embodiment of the present application further provides an apparatus for simulating serial communication based on a query mode, including a timer setting unit, a timing query unit, a delay module, and a receiving module.
- the timer setting unit is configured to sample the level of the general IO interface at a timing of the first interrupt time (T 1 );
- the delay module is configured to delay the sampling point of the first interruption time (T 1 ) by a specified time (T), and the timer setting unit further The first interruption time is used to sample the second interruption time (T 2 ), and the receiving module is configured to receive the data message in bits;
- the timer setting unit is further configured to resume querying the level of the general-purpose IO interface at the first interrupt time (T 1 ).
- the device further includes a sending module, when the analog serial port transmits data, the timer setting unit is configured to set a third interrupt time (T 3 ) according to a bit rate of the universal IO interface, and the sending module is used in each third During the interrupt time period, the level status of the analog serial port is set according to the data bit of the transmitted data message, and the timer is stopped when a data message is sent.
- T 3 third interrupt time
- the second interrupt time (T 2 ) of the timer is: Where A is the communication bit rate;
- the third interrupt time (T 3 ) of the timer is: Where A is the communication bit rate.
- the received analog serial data the means for setting a first timer interruption time (T 1) the generic sampling timing IO interface level, when the first interruption time (T 1) at the sampling point
- the falling module is configured to delay the first interrupt time (T 1 ) by a specified time (T), and then reset the timer to the second interrupt time (T 2 ) for sampling.
- the delay module when the analog serial port receives the data, is configured to: when the sampling point sampled by the timer at the first interruption time (T 1 ) falls in a position close to the falling edge in the start bit, the An interrupt time (T 1 ) is delayed by a specified time (T), and then the timer is reset to the second interrupt time (T 2 ) for sampling,
- the receiving module is configured to receive the data message in bits, including a start bit receiving unit, a data bit receiving unit, a check bit receiving unit, and a stop bit receiving unit.
- the start bit receiving unit is configured to receive a start bit, and the modified state is a receive data bit;
- the data bit receiving unit is configured to receive the data bit, and record the number of readings. If the number of readings is equal to the effective number of bits of the data message, the modified state is the receiving check digit;
- the check bit receiving unit is configured to receive the check bit, determine the check result according to the received data content and the check bit; set an error flag when the check result is incorrect; and modify the state to receive the stop bit when the check result is correct;
- the stop bit receiving unit is configured to receive the stop bit; when the error stop bit is received, the error flag is set; when the correct stop bit is received, the modified state is the receive start bit.
- the utility model has the beneficial effects of providing a method and a device for simulating serial port communication based on a query mode, and realizing analog serial port communication function by using a general-purpose timer and a general-purpose IO interface, There are no restrictions on the selection and the hardware resources of the microcontroller can be saved.
- the timing interrupt time of the data message start bit the data reception is completed with a longer second interrupt time, and then the first interrupt time is restored to detect and sample, thereby avoiding the communication data caused by the clock error of the microcontroller. Abnormal, improve data reception accuracy.
- the method and apparatus for simulating serial communication based on the query mode can increase the allowable clock error range of the microcontroller by setting a specified time for delay.
- FIG. 1 is a flowchart of a method for simulating serial port communication based on a query mode according to an embodiment of the present application
- FIG. 2 is a block diagram of an apparatus for simulating serial port communication based on a query mode according to an embodiment of the present application
- FIG. 3 is a schematic diagram of timing interrupt sampling of received data in a method for simulating serial communication based on a query mode according to an embodiment of the present application
- FIG. 4 is a schematic diagram of timing interrupted delay sampling when receiving data based on a query mode analog serial communication method according to an embodiment of the present application
- FIG. 5 is a schematic diagram of another timing interrupt delay sampling when receiving data according to the query mode analog serial communication method provided by the embodiment of the present application;
- FIG. 6 is a flow chart of receiving a single data packet according to a method for simulating serial port communication based on a query mode according to an embodiment of the present application
- FIG. 7 is a flowchart of sending a single data packet according to a method for simulating serial port communication according to a query mode according to an embodiment of the present application.
- the method and device for simulating serial communication based on query mode in the present application can realize analog serial communication function by using universal timer and general IO interface, and there is no limitation on the selection of the microcontroller, and the hardware of the microcontroller can be saved. Resources.
- the timer is controlled to sample the level of the general-purpose IO interface at a first interrupt time (T 1 ); when the start bit of the data message is queried, the first interrupt time (T) 1 ) delay the specified time (T), adjust the first interrupt time of the timer to sample the second interrupt time (T 2 ), receive the data message in bitwise; after receiving the stop bit of the data message, The timer is resumed to query the level of the general-purpose IO interface at the first interrupt time (T 1 ).
- the data reception is completed with a longer second interrupt time (T 2 ), and then resumes to the first interrupt time (T 1 ) to continue detecting the sample.
- T 2 the timing interrupt time of the data message start bit
- the first interruption time (T 1 ) is set to be smaller than the second interruption time (T 2 ) required by the communication protocol.
- T 1 the sampling point of the first interrupt time (T 1 ) of the device is just at the falling edge of the start bit
- the first interrupt time (T 1 ) is delayed by a specified time (T) and the interrupt time of the timer is changed to The second interrupt time (T 2 ) required by the communication protocol to avoid the communication error caused by the instability of the microcontroller's clock, such as the internal clock of the microcontroller.
- the time T 2 1/A seconds required for receiving one bit of data.
- the allowed clock error of the microcontroller is X%
- the allowed error time T T 2 ⁇ X%. That is, after detecting the start bit, the delay time T, and then switching the timing interrupt sampling time is the second interrupt time T 2 .
- the first interruption time T 1 of the timing interrupt sampling start bit is calculated, wherein the reasoning process is as follows:
- the communication bit rate of 9600 bits/second the start bit is 1 bit
- the data bit is 8 bits
- the check bit is 1 bit
- the stop bit is 1 bit
- the allowable error range is 10% as an example.
- the following embodiments are described by taking the first interruption time T 1 , 83 microseconds; the second interruption time T 2 , 104 microseconds; and the specified time (T) 10 microseconds as an example. It can be understood that when other microcontrollers receive data messages of different data formats, the interrupt time correspondingly changes.
- the embodiment relates to an apparatus for simulating serial communication based on a query mode, including a receiving module 10, a buffer unit 17, a delay module 20, a timer setting unit 40, a timing query unit 30, and a sending module 50.
- the timer setting unit 40 is configured to periodically sample the level of the general-purpose IO interface with the first interrupt time T 1 .
- the timer setting unit 40 is further configured to adjust the first interrupt time to be sampled for the second interrupt time T 2 , and the receiving module 10 is configured to press The bit receives the data message.
- the timer setting unit 40 is further configured to restore the first interrupt timer time T 1 level of the generic query IO interface.
- FIG. 3 is a schematic diagram of terminal sampling of a normally received waveform.
- the query unit 30 a timing a timing IO interface level query, the query when the start bit, the first timer setting unit 40 disposed interruption time T 1 is 80 sec, 3 short solid-line arrows shown in FIG.
- the specified time T is delayed, for example, 10 microseconds, and the timer interrupt time is reset to the second interrupt time T 2 104 microseconds, as indicated by the long solid arrow in the figure.
- the timing interrupt sampling time is reset to the first interruption time T 1 80 microseconds, and the previous query step is repeated.
- the second interrupt time T 2 of the timer is: Where A is the communication bit rate;
- the third interrupt time T 3 of the timer is: Where A is the communication bit rate.
- the delay module 20 is also used to avoid data errors at specific sampling points.
- the delay module 20 delays the first interrupt time T 1 by a specified time T, and then restarts.
- the sampling point of the first interruption time (T 1 ) just falls on the falling edge of the level signal.
- the timing inquiry unit 30 periodically interrupts sampling the IO interface level.
- the sampling point of the first interruption time (T 1 ) is just at the falling edge, the first interruption time T 1 is delayed by a specified time T 10 microseconds, and then the timing interrupt sampling is set.
- T 2 the time is the second interrupt time T 2 104 microseconds, it can be guaranteed that each sampling point is about 10 microseconds away from the falling edge, avoiding the instability of the microcontroller clock and sampling twice in one clock cycle.
- the setting of the delay module 20 can prevent the sampling point from falling on the falling edge of the start bit, and avoid sampling the signal twice in one pulse due to the clock error of the microcontroller, resulting in data error.
- the delay module 20 when the sampling point sampled by the timer at the first interruption time T 1 falls in a position close to the falling edge in the start bit, The first interruption time T 1 is delayed by a specified time T, and then the timer is reset to the second interruption time T 2 for sampling.
- the sample points shown are close to the falling edge of the level signal.
- the timing query unit 30 interrupts the sampling of the IO interface level by the first interrupt time T 1 , and when the sampling point is 80 microseconds from the right side of the first falling edge, the actual time is less than 80 microseconds.
- the delay module 20 Delay 10 microseconds, and then reset the timing interrupt sampling time to the second interrupt time T 2 104 microseconds, then each sample point has a margin of 14 microseconds from the rising edge of the waveform, and will not appear in the same pulse. The case of repeated sampling within the signal.
- the analog serial communication method of the present application can increase the error range of the microcontroller clock by delay time. Reduce the problem that the microcontroller cannot simulate serial communication due to large clock error.
- the receiving module 10 includes a start bit receiving unit 12, a data bit receiving unit 14, a check bit receiving unit 15, and a stop bit receiving unit 16.
- the start bit receiving unit 12 determines and receives the start bit, and after the start bit is received, the modified state is the received data bit.
- the data bit receiving unit 14 determines and receives the data bit, and records the number of readings. If the number of readings is equal to the effective number of bits of the data message, the modified state is the received parity bit.
- the check bit receiving unit 15 determines and receives the check bit, determines the check result according to the received data content and the check bit; sets an error flag when the check result is incorrect; and the modified state is the receive stop bit when the check result is correct.
- the stop bit receiving unit 16 determines and receives the stop bit; when the error stop bit is received, the error flag is set; when the correct stop bit is received, the modified state is the receive start bit.
- the method for simulating serial communication based on the query mode in the embodiment the serial port communication is simulated by the timer and the general IO interface, and the improvement part is mainly in the data receiving process, and mainly includes the following steps:
- Step 101 When the analog serial port receives data, the timer is controlled to periodically sample the level of the general-purpose IO interface by using the first interrupt time T 1 ;
- Step 102 When the start bit of the data message is queried through the sampling point, delay the current sampling point with the first interruption time T 1 by a specified time T, and then adjust the first interruption time of the timer to be the second time.
- the interruption time T 2 continues to be sampled;
- Step 103 Receive the data message by bit.
- the data message includes a start bit of 1 bit, a data bit of 8 bits, a check bit of 1 bit, and a stop bit of 1 bit;
- Step 104 After completing the receiving the stop bit of the data message, the timer is resumed to periodically query the level of the general-purpose IO interface by the first interrupt time T 1 .
- the second interrupt time (T 2 ) to, the start bit is received, the modified state is the received data bit; the second interrupt time (T 2 ) is received, the data bit is received, and the record is read.
- the result is incorrect; when the verification result is incorrect, the error flag is set; when the verification result is correct, the modification state is the reception stop bit; the second interruption time (T 2 ) is reached, the stop bit is received; when the error stop bit is received, the error flag is set; When the correct stop bit is received, the modification status is the reception start bit.
- Step 1 Set the first interruption time T 1 to 80 microseconds. Set the IO interface mode to data reception mode and go to step 2.
- Step 2 The timing of the first interrupt time T 1 is interrupted, and the IO interface level is read. If it is low, the start bit is read. The timer is turned off, the specified time T is delayed, and the timer interrupt time is reset to the second interrupt time T 2 104 microseconds, and the timer interrupt sampling is started, and the process proceeds to step 3. If it is high, go to step 2.
- Step 3 The timing of the second interrupt time T 2 is interrupted, the IO interface level is read, and the number of readings is recorded. If the number of readings is equal to the set effective number of data packets, such as N bits, Determined by the data bits specified in the communication protocol, go to step 4 to execute, otherwise go to step 3.
- the set effective number of data packets such as N bits, Determined by the data bits specified in the communication protocol
- Step 4 The timing of the second interrupt time T 2 is interrupted, the IO interface level is read, and the checksum is determined according to the received valid data and the check digit. If the checksum is incorrect, set the parity error flag. If the verification is correct, go to step 5 to execute.
- Step 5 The timer interrupt time sampled by the second interrupt time T 2 is reached, and the read valid data message is saved to the serial port receive buffer buffer unit 17. Read the IO interface level to determine if the end bit is correct. If the end bit is low, set the receive data error flag. If the end bit is high, go to step 1.
- the method for simulating serial communication based on the query mode further includes a data sending process: when the analog serial port transmits data, the third interrupt time T 3 of the timer is set according to a bit rate of the general IO interface, at each third interrupt time. During the period, the level status of the analog serial port is set according to the data bit of the transmitted data message, and the timer is stopped when a data message is sent.
- FIG. 7 shows a flow chart of sending a single data message
- Step 1 Set the timer interrupt time to the third interrupt time T 3 104 microseconds. Set the IO interface mode to send mode, go to step 2.
- Step 2 The timing of the third interrupt time T 3 is interrupted, the start bit is transmitted, and the process proceeds to step 3.
- Step 3 The timing of the third interrupt time T 3 is interrupted, the data bit of the data message is sent, and the number of times of transmission is recorded. If the number of times of transmission is equal to the effective number of bits of the data message N, the data specified by the communication protocol If the bit is determined, go to step 4 to execute, otherwise continue with step 3.
- Step 4 The timing of the third interrupt time T 3 is interrupted, and the check digit is calculated according to the transmitted data content and the check mode, and transmitted. Go to step 5 to execute.
- Step 5 a third timer interrupt to time T 3 to time the sampling interrupt, stop bit. Set the send completion flag. Go to step 1 to execute.
- the second interruption time T 2 is: Where A is the communication bit rate;
- the third interruption time T 3 is: Where A is the communication bit rate.
- the timer When the analog serial port receives data, the timer periodically samples the level of the general-purpose IO interface with the first interrupt time T 1 , and when the sampling point of the first interrupt time (T 1 ) is just at the falling edge of the start bit, the timer is turned off. The timer delays the first interrupt time T 1 by a specified time T, and then resets the timer to the second interrupt time T 2 for sampling.
- the error range of the microcontroller clock can be increased. Reduce the problem that the microcontroller cannot simulate serial communication due to large clock error.
- the method for simulating serial communication based on the query mode can implement the analog serial port communication function by using the general-purpose timer and the general-purpose IO interface, and has no limitation on the selection of the microcontroller, and can save the hardware of the microcontroller. Resources.
- the timing interrupt time of the data message start bit the data reception is completed with a longer second interrupt time, and then the first interrupt time is restored to detect and sample, thereby avoiding the communication data caused by the clock error of the microcontroller. Abnormal, improve data reception accuracy.
- the method and apparatus for simulating serial communication based on the query mode can increase the allowable clock error range of the microcontroller by setting a specified time for delay.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Systems (AREA)
- Synchronisation In Digital Transmission Systems (AREA)
Abstract
Description
Claims (12)
- 一种基于查询方式模拟串口通信的方法,由定时器以及通用IO接口来模拟串口通信,其特征在于,包括以下步骤:模拟串口接收数据时,控制所述定时器以第一中断时间(T1)定时采样所述通用IO接口的电平;当查询到数据报文的起始位时,对所述第一中断时间(T1)的采样点延时指定时间(T)后,调整所述定时器的所述第一中断时间(T1)为第二中断时间(T2)进行采样,按位接收所述数据报文;完成接收所述数据报文的停止位后,恢复所述定时器以第一中断时间(T1)定时查询所述通用IO接口的电平。
- 根据权利要求1所述的方法,其特征在于,还包括:模拟串口发送数据时,根据通用IO接口的比特率设定所述定时器的第三中断时间(T3),在每个第三中断时间的周期内根据发送数据报文的数据位设定模拟串口的电平状态,当一个数据报文发送完成后停止定时器。
- 根据权利要求1-3任意一项所述的方法,其特征在于,模拟串口接收数据时,所述定时器以第一中断时间(T1)定时采样所述通用IO接口的电平,当第一中断时间(T1)的采样点在起始位的下降沿时,关闭所述定时器,对所述第一中断时间(T1)延时指定时间(T),之后重新设置所述定时器至所述第二中断时间(T2)进行采样,其中,所述指定时间(T)为:T=T2*X%,X%是系统允许的时钟误差。
- 根据权利要求4所述的方法,其特征在于,模拟串口接收数据时,所述 定时器以第一中断时间(T1)定时采样的采样点落在起始位中接近下降沿的位置时,关闭所述定时器,对所述第一中断时间(T1)延时指定时间(T),之后重新设置所述定时器至所述第二中断时间(T2)进行采样,其中,所述指定时间(T)为:T=T2*X%,X%是系统允许的时钟误差。
- 根据权利要求5所述的方法,其特征在于,模拟串口接收数据时,包括以下步骤:第二中断时间(T2)到,接收起始位,修改状态为接收数据位;第二中断时间(T2)到,接收数据位,并记录读取次数,若读取次数等于数据报文的有效位数,修改状态为接收校验位;第二中断时间(T2)到,接收校验位,根据接收到的数据内容以及校验位确定校验结果;校验结果错误时设置错误标志;校验结果正确时修改状态为接收停止位;第二中断时间(T2)到,接收停止位;收到错误的停止位时,设置错误标志;收到正确的停止位时,修改状态为接收起始位。
- 一种基于查询方式模拟串口通信的装置,其特征在于,包括定时器设定单元、定时查询单元、延时模块以及接收模块,模拟串口接收数据时,所述定时器设定单元用于以第一中断时间(T1)定时采样通用IO接口的电平;当所述定时查询单元查询到数据报文的起始位时,所述延时模块用于对所述第一中断时间(T1)的采样点延时指定时间(T),所述定时器设定单元还用于调整所述第一中断时间为第二中断时间(T2)进行采样,所述接收模块用于按位接收所述数据报文;所述接收模块完成接收所述数据报文的停止位后,所述定时器设定单元还用于恢复所述第一中断时间(T1)定时查询所述通用IO接口的电平。
- 根据权利要求7所述的装置,其特征在于,还包括发送模块,所述模拟串口发送数据时,所述定时器设定单元用于根据通用IO接口的比特率设定第三中断时间(T3),所述发送模块用于在每个第三中断时间的周期内根据发送数据 报文的数据位设定模拟串口的电平状态,当一个数据报文发送完成后停止定时器。
- 根据权利要求7-9任意一项所述的装置,其特征在于,模拟串口接收数据时,所述定时器设定单元用于以第一中断时间(T1)定时采样所述通用IO接口的电平,当第一中断时间(T1)的采样点在起始位的下降沿时,所述延时模块用于对所述第一中断时间(T1)延时指定时间(T),然后重新设置所述定时器至所述第二中断时间(T2)进行采样,其中,所述指定时间(T)为:T=T1*X%,X%是系统允许的时钟误差。
- 根据权利要求7-9任意一项所述的装置,其特征在于,模拟串口接收数据时,所述延时模块用于在所述定时器以第一中断时间(T1)定时采样的采样点落在起始位中接近下降沿的位置时,对所述第一中断时间(T1)延时指定时间(T),之后重新设置所述定时器至所述第二中断时间(T2)进行采样,其中,所述指定时间(T)为:T=T1*X%,X%是系统允许的时钟误差。
- 根据权利要求11所述的装置,其特征在于,所述接收模块用于按位接收所述数据报文,包括起始位接收单元、数据位接收单元、校验位接收单元以及停止位接收单元,所述起始位接收单元用于接收起始位,修改状态为接收数据位;所述数据位接收单元用于接收数据位,并记录读取次数,若读取次数等于数据报文的有效位数,修改状态为接收校验位;所述校验位接收单元用于接收校验位,根据接收到的数据内容以及校验位确定校验结果;校验结果错误时设置错误标志;校验结果正确时修改状态为接收停止位;所述停止位接收单元用于接收停止位;收到错误的停止位时,设置错误标志;收到正确的停止位时,修改状态为接收起始位。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2017/113591 WO2019104531A1 (zh) | 2017-11-29 | 2017-11-29 | 一种基于查询方式模拟串口通信的方法和装置 |
CN201780009007.1A CN108701112B (zh) | 2017-11-29 | 2017-11-29 | 一种基于查询方式模拟串口通信的方法和装置 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2017/113591 WO2019104531A1 (zh) | 2017-11-29 | 2017-11-29 | 一种基于查询方式模拟串口通信的方法和装置 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2019104531A1 true WO2019104531A1 (zh) | 2019-06-06 |
Family
ID=63844115
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/113591 WO2019104531A1 (zh) | 2017-11-29 | 2017-11-29 | 一种基于查询方式模拟串口通信的方法和装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN108701112B (zh) |
WO (1) | WO2019104531A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11905626B2 (en) | 2014-12-24 | 2024-02-20 | The Lycra Company Llc | Easily settable stretch fabrics including low-melt fiber |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110879791B (zh) * | 2019-09-30 | 2021-03-19 | 湖南格兰博智能科技有限责任公司 | 一种非阻塞的两线串口通讯模拟方法 |
CN110908940B (zh) * | 2019-10-14 | 2021-03-19 | 百富计算机技术(深圳)有限公司 | 串口通讯参数调整的方法及终端设备 |
CN111610359B (zh) * | 2020-05-29 | 2021-05-14 | 上海挚达科技发展有限公司 | 一种充电桩控制引导电路电压采集的滤波方法 |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102521183A (zh) * | 2011-12-02 | 2012-06-27 | 深圳市科陆电子科技股份有限公司 | 用于嵌入式系统的模拟串口方法 |
CN103699509A (zh) * | 2014-01-03 | 2014-04-02 | 烟台东方威思顿电气有限公司 | 基于定时器录波的串口通讯方法 |
CN107357742A (zh) * | 2017-07-14 | 2017-11-17 | 上海瀚银信息技术有限公司 | 一种串口模拟方法和计算机设备 |
-
2017
- 2017-11-29 CN CN201780009007.1A patent/CN108701112B/zh active Active
- 2017-11-29 WO PCT/CN2017/113591 patent/WO2019104531A1/zh active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102521183A (zh) * | 2011-12-02 | 2012-06-27 | 深圳市科陆电子科技股份有限公司 | 用于嵌入式系统的模拟串口方法 |
CN103699509A (zh) * | 2014-01-03 | 2014-04-02 | 烟台东方威思顿电气有限公司 | 基于定时器录波的串口通讯方法 |
CN107357742A (zh) * | 2017-07-14 | 2017-11-17 | 上海瀚银信息技术有限公司 | 一种串口模拟方法和计算机设备 |
Non-Patent Citations (1)
Title |
---|
JIA, ZHENGXUE ET AL.: "Realization and Optimization of Serial Port Data Receiving Program Based on MCU", MICROCONTROLLERS & EMBEDDED SYSTEMS, 31 August 2016 (2016-08-31), pages 1 - 4 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11905626B2 (en) | 2014-12-24 | 2024-02-20 | The Lycra Company Llc | Easily settable stretch fabrics including low-melt fiber |
Also Published As
Publication number | Publication date |
---|---|
CN108701112A (zh) | 2018-10-23 |
CN108701112B (zh) | 2020-04-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019104531A1 (zh) | 一种基于查询方式模拟串口通信的方法和装置 | |
EP2832051B1 (en) | Method, device, and system for delaying packets during a network-triggered wake of a computing device | |
US20190213166A1 (en) | Methods and apparatus for reduced-latency data transmission with an inter-processor communication link between independently operable processors | |
WO2014201990A1 (zh) | 唤醒控制方法、装置和终端设备 | |
TW201217964A (en) | Method and system of adapting communication links to link conditions on a platform | |
WO2019105143A1 (zh) | 一种基于蓝牙的数据通讯的方法、设备及存储介质 | |
US11243560B2 (en) | Methods and apparatus for synchronization of time between independently operable processors | |
WO2017065923A1 (en) | Methods to avoid i2c void message in i3c | |
CN104461972A (zh) | 一种数据信号采样的方法和设备 | |
Liu et al. | A flexible hardware architecture for slave device of i2c bus | |
CN109471588B (zh) | 一种同步方法及设备 | |
WO2020063782A1 (zh) | 一种通信方法及装置 | |
CN109062850B (zh) | 一种单片机的数据发送和接收方法 | |
CN102546033A (zh) | 采用脉冲调制结合串口方式实现的多机通信装置 | |
US11175397B2 (en) | Wireless fidelity Wi-Fi ranging method and system, and related device | |
CN103577378A (zh) | 一种全双工异步串行通信方法 | |
WO2023273048A1 (zh) | 通信时延确定方法和电子设备 | |
CN212969687U (zh) | 异步串口通信波特率自动检测装置 | |
WO2017091963A1 (zh) | 一种信息处理方法及装置 | |
CN114500204B (zh) | Fsk数据发送控制装置、方法、定时器、mcu及设备 | |
US20210109887A1 (en) | I3c pending read with retransmission | |
CN105446863A (zh) | 具有记录能力的电子装置与电路状态记录方法 | |
TWI791977B (zh) | 伺服系統、資料傳輸系統及其資料傳輸之方法 | |
CN116860672B (zh) | 一种数字处理SMBus通讯系统及方法 | |
CN114253879B (zh) | 一种基于软件模拟的多通道串口通信方法及系统 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17933411 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17933411 Country of ref document: EP Kind code of ref document: A1 |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.01.2021) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17933411 Country of ref document: EP Kind code of ref document: A1 |