CN104156334A - Serial port self-adaption data transparent transmission protocol for multimachine communication - Google Patents

Serial port self-adaption data transparent transmission protocol for multimachine communication Download PDF

Info

Publication number
CN104156334A
CN104156334A CN201410408317.9A CN201410408317A CN104156334A CN 104156334 A CN104156334 A CN 104156334A CN 201410408317 A CN201410408317 A CN 201410408317A CN 104156334 A CN104156334 A CN 104156334A
Authority
CN
China
Prior art keywords
data
time
byte
frame
interruption
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410408317.9A
Other languages
Chinese (zh)
Inventor
鲁万鑫
邵志鹏
黄权鑫
苏玉宗
韩卓振
孔红彦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NINGXIA SAIWEN ENERGY SAVING Co Ltd
Original Assignee
NINGXIA SAIWEN ENERGY SAVING Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NINGXIA SAIWEN ENERGY SAVING Co Ltd filed Critical NINGXIA SAIWEN ENERGY SAVING Co Ltd
Priority to CN201410408317.9A priority Critical patent/CN104156334A/en
Publication of CN104156334A publication Critical patent/CN104156334A/en
Pending legal-status Critical Current

Links

Landscapes

  • Communication Control (AREA)

Abstract

The invention relates to a serial port self-adaption data transparent transmission protocol for multimachine communication. In the data transmission process, a serial port receives a data byte, and meanwhile an interruption time is set through a microprocessor timer of communication equipment; timer interruption is started, when the serial port receives the next data byte and timing interruption is not generated, the length of data is accumulated every time a byte is received, and the timer is reloaded with an initial value; when the timing interruption is generated, one frame of data is completely received, the data are stored, zero clearing is carried out on accumulation, the next frame of data is waited for to be received, or the timer interruption is turned off, and the received data are sent to the serial port to be displayed. According to the method of the protocol, the length of a data package can be automatically recognized according to the interval of the receiving time of two adjacent bytes, whether the data of the frame are complete or not is determined, the transmission of a lower-layer protocol does not need to be considered in the data transmission process, and the use flexibility and universality of serial devices are improved.

Description

For the adaptive serial port data transparent transmission agreement of multi computer communication
technical field:
The invention belongs to technology of Internet of things field, relate to the communication technology of data between many equipment, be specifically related to a kind of adaptive serial port data transparent transmission agreement for multi computer communication.
background technology:
Internet of Things is by information sensing equipment such as radio-frequency (RF) identification (RFID) (RFID+ internet), infrared inductor, GPS, laser scanner, gas sensors, by the agreement of agreement, any article and internet are coupled together, carry out message exchange and communication, to realize a kind of network of intelligent identification, location, tracking, monitoring and management.Communication protocol (communications protocol) is that both sides' entity completes communication or the service mandatory rule of institute and agreement.Protocol definition data cell use form, the information that message unit should comprise and implication, connected mode, the sequential of information sending and receiving, thus guarantee that in network, data are successfully sent to definite place.Serial ports is a kind of very general devices communicating agreement on computing machine, and it is serial ports step-by-step (bit) sending and receiving byte, is peripheral hardware and intercomputer, and by data signal line, ground wire, control line etc., a kind of communication modes of data is transmitted in step-by-step.Universal asynchronous receiving-transmitting transmitter UART(Universal Asynchronous Receiver/Transmitter), as the one of asynchronous serial communication agreement, one of each character of transmission data to be connect to one transmit, in reality, be by serial communication and parallel communications intercropping transmission conversion by data, become the chip of serial output as parallel input, conventionally be integrated in the link of other communication interfaces, interface generates the frame data format of start-stop type automatically.UART comprises dual serial channel, and one for sending data, and another is for receiving data, full-duplex operation.In UART agreement, data send with the form of frame, and one of each symbol wherein uses non-return-to-zero (NRZ) coding that data are expressed as to binary format.Receive UART by observing the restriction of start and stop bit identification data frame, and determine the optimum data sampled point of each according to predetermined baud rate.At present, existing serial communication protocol is all the form of having bound frame data, need in program, judge that whether packet frame head postamble meets the data layout of setting, exists the problem such as binding data frame length and data packet frame head identifier and postamble; And all need to depend on special hardware and interface protocol design, while carrying out serial communication with other subsystems, need to carry out artificial hardware jumper setting or procedure Selection.
summary of the invention:
The object of the invention is the problem existing in order to overcome prior art, a kind of adaptive serial port data transparent transmission agreement for multi computer communication is provided, the method of this agreement can be according to the automatic identification data packet length in the time of reception interval of adjacent two bytes, and determine whether it is the data that a frame is complete, in the transmitting procedure of data, need not be concerned about the transmission of lower-layer protocols, improve dirigibility and versatility that serial device uses.
Technical scheme of the present invention is: for the adaptive serial port data transparent transmission agreement of multi computer communication, in data transmission procedure, serial ports receives a byte data, sets a break period by the timing microprocessor device of communication apparatus simultaneously; Opening timing device interrupts, and in the time that serial ports receives next byte data and do not produce Interruption, byte of every reception adds up data length, and the timer initial value of reloading; In the time producing Interruption, frame data receive complete, store data, and accumulative total zero clearing, wait for and receive next frame data, or timeing closing device interrupts the data that receive to send to serial ports demonstration.
Be the time of reception that is greater than two adjacent byte in same frame data described break period, and be less than the time of reception of two adjacent frame data.
The length of described frame data is 1 ~ 225 byte, and the length of each frame data can be different.
Preferably, described agreement is in the situation that serial ports baud rate is certain, and the time that sends continuously adjacent two bytes is T1, and the time interval that sends two frame data is T2, and T2 is far longer than T1; Timer is set an Interruption time T 0, the T1 that T0 is twice; In the time that serial ports receives next byte and do not produce Interruption time T 0, two current data are the data in same frame, and T0 interrupts zero clearing also to be counted, the timer initial value of reloading; In the time producing Interruption time T 0, and do not receive next byte data, storage current data length accumulative total zero clearing, judge when the complete reception of last frame data.
The invention has the beneficial effects as follows: the problem that needs binding data frame length and data packet frame head identifier and postamble when 1, this agreement can solve data frame transfer, more existing serial port communicating protocol is simplified more, and redundant data is few, and power consumption is little, stability is strong, applied widely; 2, the method for this agreement can be according to the automatic identification data packet length in the time of reception interval of adjacent two bytes, and determine whether it is the data that a frame is complete, in the transmitting procedure of data, need not be concerned about the transmission of lower-layer protocols, improve dirigibility and versatility on serial device uses; 3, the principal feature of this agreement is not rely on special hardware and interface protocol design, while carrying out serial communication with other subsystems, without carrying out artificial hardware jumper setting or procedure Selection.
brief description of the drawings:
?fig. 1 is serial data transparent transmission program flow diagram of the present invention;
Fig. 2 is serial data transparent transmission schematic diagram of the present invention.
embodiment:
Below in conjunction with accompanying drawing and specific embodiment, technical scheme of the present invention is described in further detail.
As shown in Figure 1, for the adaptive serial port data transparent transmission agreement of multi computer communication, in data transmission procedure, serial ports receives a byte data, sets a break period by the timing microprocessor device of communication apparatus simultaneously; Opening timing device interrupts, and in the time that serial ports receives next byte data and do not produce Interruption, byte of every reception adds up data length, and the timer initial value of reloading; In the time producing Interruption, frame data receive complete, store data, and accumulative total zero clearing, wait for and receive next frame data, or timeing closing device interrupts the data that receive to send to serial ports demonstration; Be the time of reception that is greater than two adjacent byte in same frame data described break period, and be less than the time of reception of two adjacent frame data.
The length of frame data comprises 1 ~ 225 byte, and the length of each frame data can be different, the length that is frame in data transmission procedure can be 1 byte, also can be 255 bytes, adjacent two frame data length can be different, and do not need specific frame head identifier and postamble mark and data length tagged word, equipment all can normally be distinguished each frame data length and size by this agreement.
As shown in Figure 2, T1 is adjacent data byte time of reception interval in same packet, taking 9600bps as example, serial ports is set and is operated in asynchronous communication model, when communication, comprise 1 start bit, 8 data bit, no parity check position, 1 position of rest, 10 bit data altogether, the needed time of byte data of the every reception of serial ports is:
T1=1/9600/10=0.001041s=1.041ms
In Fig. 2, T2 is adjacent two data bag time of reception interval;
T1<<T2
Therefore can set an Interruption time T 0 by timer;
T0=1.5T1=1.5615ms
T1<T0<2T1<<T2
The interruption that does not produce yet T0 in the time receiving next byte, adjacent two data byte is same packet data, the Interruption initial value of reloading;
When arriving Interruption time T 0, when complete finishing receiving of last frame data.
Can normally receive continuously the complete different packet of multiframe for the adaptive serial port data transparent transmission agreement of multi computer communication above, do not need to consider data packet length and whether have set form frame head postamble, and can obliterated data.

Claims (2)

1. for the adaptive serial port data transparent transmission agreement of multi computer communication, it is characterized in that: in data transmission procedure, serial ports receives a byte data, set a break period by the timing microprocessor device of communication apparatus simultaneously; Opening timing device interrupts, and in the time that serial ports receives next byte data and do not produce Interruption, byte of every reception adds up data length, and the timer initial value of reloading; In the time producing Interruption, frame data receive complete, store data, and accumulative total zero clearing, wait for and receive next frame data, or timeing closing device interrupts the data that receive to send to serial ports demonstration;
Be the time of reception that is greater than two adjacent byte in same frame data described break period, and be less than the time of reception of two adjacent frame data;
The length of described frame data is 1 ~ 225 byte, and the length of each frame data can be different.
2. the adaptive serial port data transparent transmission agreement for multi computer communication according to claim 1, it is characterized in that, in the situation that serial ports baud rate is certain, the time that sends continuously adjacent two bytes is T1, the time interval that sends two frame data is T2, and T2 is far longer than T1; Timer is set an Interruption time T 0, the T1 that T0 is twice; In the time that serial ports receives next byte and do not produce Interruption time T 0, two current data are the data in same frame, and T0 interrupts zero clearing also to be counted, the timer initial value of reloading; In the time producing Interruption time T 0, and do not receive next byte data, storage current data length accumulative total zero clearing, judge when the complete reception of last frame data.
CN201410408317.9A 2014-08-19 2014-08-19 Serial port self-adaption data transparent transmission protocol for multimachine communication Pending CN104156334A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410408317.9A CN104156334A (en) 2014-08-19 2014-08-19 Serial port self-adaption data transparent transmission protocol for multimachine communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410408317.9A CN104156334A (en) 2014-08-19 2014-08-19 Serial port self-adaption data transparent transmission protocol for multimachine communication

Publications (1)

Publication Number Publication Date
CN104156334A true CN104156334A (en) 2014-11-19

Family

ID=51881839

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410408317.9A Pending CN104156334A (en) 2014-08-19 2014-08-19 Serial port self-adaption data transparent transmission protocol for multimachine communication

Country Status (1)

Country Link
CN (1) CN104156334A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106209496A (en) * 2016-06-23 2016-12-07 珠海格力电器股份有限公司 A kind of communication abnormality detection device and method
CN107423239A (en) * 2017-05-05 2017-12-01 山东大学 Low-power scm complete data frame method of reseptance under Halt patterns
CN109558279A (en) * 2017-09-26 2019-04-02 株洲中车时代电气股份有限公司 A kind of serial data method of reseptance and exception monitoring localization method
CN109710550A (en) * 2018-12-14 2019-05-03 中国航空工业集团公司西安航空计算技术研究所 A kind of frame length based on Double buffer is not fixed RS422 data communication system
CN110032532A (en) * 2019-03-15 2019-07-19 北京控制工程研究所 A kind of master-slave mode serial port communication method based on Interruption triggering
CN110177035A (en) * 2019-05-15 2019-08-27 北京猎户星空科技有限公司 Data receiver and sending method, device and data receiving-transmitting system
CN111026694A (en) * 2019-11-01 2020-04-17 珠海奔图电子有限公司 Data receiving method, data receiving apparatus, image forming system, and electronic apparatus
CN113342720A (en) * 2021-05-12 2021-09-03 辅易航智能科技(苏州)有限公司 High-speed serial port communication method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
宁占彬 等: "基于时间间隔的嵌入式***通用串口数据接收涉及与实现", 《电脑编程技巧与维护》 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106209496A (en) * 2016-06-23 2016-12-07 珠海格力电器股份有限公司 A kind of communication abnormality detection device and method
CN107423239A (en) * 2017-05-05 2017-12-01 山东大学 Low-power scm complete data frame method of reseptance under Halt patterns
CN107423239B (en) * 2017-05-05 2019-04-30 山东大学 Low-power scm complete data frame method of reseptance under Halt mode
CN109558279A (en) * 2017-09-26 2019-04-02 株洲中车时代电气股份有限公司 A kind of serial data method of reseptance and exception monitoring localization method
CN109710550A (en) * 2018-12-14 2019-05-03 中国航空工业集团公司西安航空计算技术研究所 A kind of frame length based on Double buffer is not fixed RS422 data communication system
CN109710550B (en) * 2018-12-14 2022-05-27 中国航空工业集团公司西安航空计算技术研究所 Double-cache-based RS422 data communication system with unfixed frame length
CN110032532A (en) * 2019-03-15 2019-07-19 北京控制工程研究所 A kind of master-slave mode serial port communication method based on Interruption triggering
CN110032532B (en) * 2019-03-15 2021-02-09 北京控制工程研究所 Master-slave serial port communication method based on timing interrupt triggering
CN110177035A (en) * 2019-05-15 2019-08-27 北京猎户星空科技有限公司 Data receiver and sending method, device and data receiving-transmitting system
CN111026694A (en) * 2019-11-01 2020-04-17 珠海奔图电子有限公司 Data receiving method, data receiving apparatus, image forming system, and electronic apparatus
CN111026694B (en) * 2019-11-01 2021-03-02 珠海奔图电子有限公司 Data receiving method, data receiving apparatus, image forming system, and electronic apparatus
CN113342720A (en) * 2021-05-12 2021-09-03 辅易航智能科技(苏州)有限公司 High-speed serial port communication method

Similar Documents

Publication Publication Date Title
CN104156334A (en) Serial port self-adaption data transparent transmission protocol for multimachine communication
CN100366029C (en) Communication controller, host-side controller, communication equipment, communication system and method
CN102780705B (en) Ethernet-(controller area network) CAN protocol converter
RU2009138237A (en) METHOD AND DEVICE FOR ORDERED POLLING IN A WIRELESS COMMUNICATION SYSTEM
CN107819659B (en) Intelligent cascade communication network based on SPI
CN104539712A (en) Intelligent household appliance data transmission method
CN104038499A (en) MODBUS RTU protocol based data transmission method
CN103986610A (en) Communication interface matching method, device and controller
CN202190284U (en) Protocol converter for CAN bus and SpaceWire bus
CN104317762A (en) Method for adaptively controlling transmitting and receiving directions of RS485 chip by aid of FPGA (field programmable gate array)
CN105635176A (en) Network data transmission method based on RapidIO
CN101493806B (en) Data-transmission method of communication adapter
CN102937944B (en) A kind of based on Arcnet serial server
CN102377505A (en) Serial port-based IPMI (Intelligent Platform Management Interface) package transmission method
CN104702371A (en) Dual-link data transmission method based on network reliable transmission protocol
CN110266442A (en) A kind of digital signal serial transmission method
CN104348523A (en) Data transmission method for wireless sensor node
CN101197742B (en) System and method for transmitting additional data between equipments through Ethernet interface
CN102035733B (en) Method for establishing serial data transparent transmission channel by Ethernet
CN104144137B (en) A kind of high speed LVDS serial synchronous communication controllers
CN204305007U (en) A kind of handheld device infrared communication system
WO2022127448A1 (en) Message transmission method, terminals and storage medium
CN206805761U (en) A kind of data transmission device with master and slave wireless module
CN104767590A (en) Reliable data transmission and control method for serial communication
WO2017000737A1 (en) Transmission checking method, node, system and computer storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 750001 the Ningxia Hui Autonomous Region Jinfeng District, Yinchuan City Plover Cove Road No. 411 Yinchuan Yindu trade limited company hospital

Applicant after: Ningxia Saiwen technology Limited by Share Ltd

Address before: 750001 the Ningxia Hui Autonomous Region Jinfeng District, Yinchuan City Plover Cove Road No. 411 Yinchuan Yindu trade limited company hospital

Applicant before: Ningxia Saiwen Energy Saving Co., Ltd.

COR Change of bibliographic data
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20141119

WD01 Invention patent application deemed withdrawn after publication