CN101404559B - Short-distance wireless communication anti-interference simple encoding and decoding method for single-chip - Google Patents

Short-distance wireless communication anti-interference simple encoding and decoding method for single-chip Download PDF

Info

Publication number
CN101404559B
CN101404559B CN2008101949174A CN200810194917A CN101404559B CN 101404559 B CN101404559 B CN 101404559B CN 2008101949174 A CN2008101949174 A CN 2008101949174A CN 200810194917 A CN200810194917 A CN 200810194917A CN 101404559 B CN101404559 B CN 101404559B
Authority
CN
China
Prior art keywords
data
data bit
short
chip microcomputer
square wave
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.)
Expired - Fee Related
Application number
CN2008101949174A
Other languages
Chinese (zh)
Other versions
CN101404559A (en
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.)
Nanning Universal Environmental Protection Technology Co., Ltd.
Original Assignee
Jiangnan University
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 Jiangnan University filed Critical Jiangnan University
Priority to CN2008101949174A priority Critical patent/CN101404559B/en
Publication of CN101404559A publication Critical patent/CN101404559A/en
Application granted granted Critical
Publication of CN101404559B publication Critical patent/CN101404559B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The invention relates to a simple anti-interference coding method for single-chip microcomputer short-distance wireless communication, and is particularly suitable for occasions with low functional requirements for communication equipment. A start bit of a data frame is represented by a square wave having the same high level duration and low level duration on a sending terminal; a data bit '1' is represented by a square wave having a short high level duration and a long low level duration; a data bit '0' is represented by a square wave having a long high level duration and a short low level duration; a fixed sampling time is set on a receiving terminal to sample the received data waveform; and finally the data bits are discriminated according to the number of the sampled high levels and the sampled low levels. The method achieves the anti-interference purpose of the single-chip microcomputer short-distance wireless communication by a simple data coding method, greatly reduces the probability of wrong data discrimination caused by ingression of interference signals during the data transmission; a small memory space is occupied after programming, and a great memory space is saved for the single-chip microcomputer.

Description

Single-chip microcomputer short-distance wireless communication anti-interference simple decoding method
Technical field
The present invention relates to a kind of short-distance wireless communication anti-interference simple encoding method for single-chip, be particularly useful for the less demanding occasion of communications device functions.
Background technology
The wireless serial communication of single-chip microcomputer has a wide range of applications in productive life and industrial control field with its flexibility and low cost.Usually adopt the serial i/O mouth of single-chip microcomputer to finish data communication, the conventional method that serial ports detects data is from data mid portion sampling three times.Have only when occurring twice identical value in three sampled values at least, data just are identified.Yet the antijamming capability of this Data Detection method is very poor.Because the existence of various electromagnetic interference signals in the space, distortion had very likely taken place at sampled point in data that receiver receives, thereby increased the possibility of single-chip microcomputer erroneous judgement data.
Summary of the invention
Because decaying and distort, data cause the erroneous judgement of single-chip microcomputer in order to eliminate to data, the invention provides a kind of novel communication decoding method, can effectively overcome the shortcoming of microcomputer series interface communication poor anti jamming capability, guarantee the validity and the reliability of single-chip microcomputer RFDC.
According to technical scheme provided by the invention, a kind of single-chip microcomputer short-distance wireless communication anti-interference simple decoding method comprises data-encoding scheme and data decoding method:
Described data-encoding scheme, the square wave that equates with the high-low level duration is represented the start bit of Frame; Frame identical by position and last of data bit to be sent; Short with high level lasting time, the long square wave of low duration is represented data bit ' 1 '; Long with high level lasting time, the short square wave of low duration is represented data bit ' 0 '; The transmitting terminal single-chip microcomputer is represented Frame to be sent by software program with square wave;
Described data decoding method, the receiving terminal single-chip microcomputer is set a fixed sampling time at interval by software program, write down the high and low level number of times that samples in each data bit period, according to the high and low level occurrence number that samples judge the data bit that receives be ' 0 ', ' 1 ' or the start bit signal.
Described data bit period is for sending the required time of each data bit, and described data bit period is divided by sampling time interval, and promptly the sampling number of each data bit is between 100 to 400.For example, data bit period 906us=9.06 * 10 -3S, sampling period 3.6us=3.6 * 10 -5S, then sampling number is 251 times or 252 times.
By adjusting described data bit period, adjust message transmission rate.
The present invention has overcome when utilizing serial ports to carry out data communication, each data bit is only sampled three times and is prone to the shortcoming of misjudgement.Because it be not by simple sampling three times with regard to judge the data bit that receives be ' 0 ', ' 1 ' or the start bit, but to sample hundreds of times, make data declare wrong possibility with regard to having avoided greatly because of scurrying into interference signal in the data transmission procedure like this.
The invention has the beneficial effects as follows, utilize simple data-encoding scheme to realize the anti-interference of single-chip microcomputer short-distance wireless communication.With respect to other coding method, memory space shared after the design programmes is minimum, and for single-chip microcomputer has been saved a large amount of memory spaces, this was very important with regard to little single-chip microcomputer for memory capacity originally.
Description of drawings
Fig. 1 is a data bit method for expressing of the present invention.
Fig. 2 is the program flow diagram of transmitting terminal of the present invention.
Fig. 3 is the program flow diagram of receiving terminal of the present invention.
Embodiment
Among Fig. 1: 1. the method for expressing of start bit, the 2. method for expressing of data bit ' 1 ', the 3. method for expressing of data bit ' 0 '.
The present invention is further described below in conjunction with accompanying drawing and specific implementation process.
Adopt the AT89c2051 single-chip microcomputer with transmitting terminal, it is that example illustrates design philosophy of the present invention that receiving terminal adopts PIC16F73.If adopt other model single-chip microcomputer, method is similar.
For example data frame content is (form of Frame can be other type, but the representation of each data bit is similar):
Start bit (1)+data bit (8)+by position (1)
As shown in Figure 1, the present invention represents start bit (1) with equal square wave of high-low level duration; Short with high level lasting time, the long square wave of low duration is represented data bit ' 1 ' (2); Long with high level lasting time, the short square wave of low duration is represented data bit ' 0 ' (3); Determining according to last position of the 8 bit data positions that send by the position, that is to say, if last position of data bit is ' 1 ', also is 1 by the position then, and last position of data bit is ' 0 ', is ' 0 ' just by the position then.
At receiving terminal, software program makes the single-chip microcomputer of receiving terminal sample by turn to the data that receive with regular time interval (as 3.6us), and write down detected high-low level number of times in each data bit period (906us), determine that by the occurrence number of differentiating high-low level the data bit of reception is ' 0 ' at last, ' 1 ' or the start bit.Time in sampling interval and data bit period can change, thereby reach the purpose of adjusting message transmission rate.By sampling hundreds of times, avoided greatly making data declare wrong possibility because of scurrying into interference signal in the data transmission procedure.
As shown in Figure 2: transmitting terminal at first sends the start bit, represents the beginning of a frame information.Simultaneously to some registers that need use, flag bit initialize.The transmission of data is to adopt the ring shift right of bringing the position into to realize, as long as read the value of carry flag bit like this, just can read 8 bit data successively from the low level to a high position, has made things convenient for reading of data bit, is convenient to the operation of back.The data bit figure place that sends deposits register R6 in advance in, operates the transmit operation that realizes 8 bit data positions by carrying out the ring shift right of bringing the position for 8 times into.Deciding by the position by last position of differentiating the transmission data at last is ' 0 ' or ' 1 ', and it is sent, and indicates the end of frame data.
As shown in Figure 3: by the predefined sampling time, and duration of high-low level in data bit and the start bit, data bit ' 0 ' under the good normal condition of calculated in advance, ' 1 ' and the start bit high and low level number of times that should occur and give its certain nargin.Prevent from data to be judged by accident because of interference makes the receiving terminal single-chip microcomputer.The same ring shift right of bringing the position into that utilizes of receiving terminal is realized the reception of data is operated.To the data that receive, detect by turn at interval with regular time, and write down detected high-low level number of times in each data bit period, it is stored in respectively among variable i and the j.By judging that the value among i and the j is the determined zone of high and low level occurrence number that falls into the start bit, still fall into the determined zone of high and low level occurrence number of data bit ' 1 ', or the determined zone of high and low level occurrence number of data bit ' 0 ' and determine the data bit that receives be ' 0 ', ' 1 ' or the start bit signal.If commencing signal is then to counting unit num (data bits of reception) initialize 8, and begin to carry out the ring shift right operation of bringing the position for 8 times into, realize storage operation data bit.Before carrying out ring shift right, need utilize the same method that data bit is detected at every turn and differentiate, differentiate the result by flag bit STATUS is operated realization.Flag bit STSTUS is the 0th STATUS<0 of STATUS register in the PIC single-chip microcomputer 〉: carry and borrow sign.The value that it is controlling the carry flag bit of ring shift right operation is ' 0 ' or ' 1 '.

Claims (2)

1. a single-chip microcomputer short-distance wireless communication anti-interference simple decoding method comprises data-encoding scheme and data decoding method, it is characterized in that:
Described data-encoding scheme, the square wave that equates with the high-low level duration is represented the start bit of Frame; Frame identical by position and last of data bit to be sent; Short with high level lasting time, the long square wave of low duration is represented data bit ' 1 '; Long with high level lasting time, the short square wave of low duration is represented data bit ' 0 '; The transmitting terminal single-chip microcomputer is represented Frame to be sent by software program with square wave;
Described data decoding method, the receiving terminal single-chip microcomputer is set a fixed sampling time at interval by software program, write down the high and low level number of times that samples in each data bit period, according to the high and low level occurrence number that samples judge the data bit that receives be ' 0 ', ' 1 ' or the start bit signal;
Described data bit period is for sending the required time of each data bit, and described data bit period is divided by sampling time interval, and promptly the sampling number of each data bit is between 100 to 400.
2. single-chip microcomputer short-distance wireless communication anti-interference simple decoding method as claimed in claim 1 is characterized in that: by adjusting described data bit period, adjust message transmission rate.
CN2008101949174A 2008-10-27 2008-10-27 Short-distance wireless communication anti-interference simple encoding and decoding method for single-chip Expired - Fee Related CN101404559B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101949174A CN101404559B (en) 2008-10-27 2008-10-27 Short-distance wireless communication anti-interference simple encoding and decoding method for single-chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101949174A CN101404559B (en) 2008-10-27 2008-10-27 Short-distance wireless communication anti-interference simple encoding and decoding method for single-chip

Publications (2)

Publication Number Publication Date
CN101404559A CN101404559A (en) 2009-04-08
CN101404559B true CN101404559B (en) 2011-06-22

Family

ID=40538438

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101949174A Expired - Fee Related CN101404559B (en) 2008-10-27 2008-10-27 Short-distance wireless communication anti-interference simple encoding and decoding method for single-chip

Country Status (1)

Country Link
CN (1) CN101404559B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108574535A (en) * 2017-03-09 2018-09-25 深圳光启智能光子技术有限公司 For the coding method of optic communication, sender unit and reception device and method

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101604161B (en) * 2009-04-17 2012-05-23 北京铱钵隆芯科技有限责任公司 Bit synchronization decoding method
CN102271029A (en) * 2011-09-13 2011-12-07 北京邮电大学 method for realizing coding FSO (file system object) system based on sequential detection and spatial diversity
CN102694598B (en) * 2012-04-28 2015-04-15 深圳光启创新技术有限公司 Coding method and transmission method of visible light signals
CN102694597B (en) * 2012-04-28 2015-05-27 深圳光启创新技术有限公司 Decoding method and controlling method of visible light signal
CN103812557B (en) * 2013-07-31 2015-05-27 深圳光启创新技术有限公司 Visible light signal encoding and decoding method, device and system
CN107592184A (en) * 2017-10-08 2018-01-16 胡明建 A kind of adopted using the time presses the design method counted as signal identification
CN109143877A (en) * 2018-07-31 2019-01-04 湛江市中新电气有限公司 A kind of smart home changes in temperature environmental management system and its application method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101093534A (en) * 2007-07-13 2007-12-26 江苏瑞福智能科技有限公司 Method for identifying data of electronic label on truck in high speed
CN101223709A (en) * 2005-07-14 2008-07-16 富士通株式会社 Data decoding method, data decoder using the same

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101223709A (en) * 2005-07-14 2008-07-16 富士通株式会社 Data decoding method, data decoder using the same
CN101093534A (en) * 2007-07-13 2007-12-26 江苏瑞福智能科技有限公司 Method for identifying data of electronic label on truck in high speed

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
.单片机在无线通讯系统应用中的抗干扰措施.《电子技术应用》.1995,(第12期),全文.
黄李庚
黄李庚;.单片机在无线通讯系统应用中的抗干扰措施.《电子技术应用》.1995,(第12期),全文. *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108574535A (en) * 2017-03-09 2018-09-25 深圳光启智能光子技术有限公司 For the coding method of optic communication, sender unit and reception device and method

Also Published As

Publication number Publication date
CN101404559A (en) 2009-04-08

Similar Documents

Publication Publication Date Title
CN101404559B (en) Short-distance wireless communication anti-interference simple encoding and decoding method for single-chip
CN109075742B (en) Baud rate calibration circuit and serial port chip
CN101132189B (en) Guard section length detection method and system
CN102546084B (en) Anti-interference error-correcting and sampling system and method in process of receiving asynchronous serial communication data
WO1999026384A1 (en) Baud rate detection in serial data transmission
CN101458876B (en) Wireless communication transceiving module for communication principle experiment teaching system
CN102222211B (en) Magcard decoding method and magcard reading device
CN101321015A (en) Full-digital pulse position modulation signal receiver
CN111742324A (en) Code printing method, code printing device, active pen and code printing system
CN102980604A (en) Photoelectric direct-reading decoder and decoding method
CN104682981A (en) Decoding board of ADS-B (automatic dependent surveillance broadcast) receiver
CN112649901A (en) Telemetering terminal with rainfall false alarm preventing function and implementation method thereof
CN110224702B (en) Time code IRIG-B self-adaptive decoding device and decoding method
CN1501247A (en) Programmable glitch filter for asynchronous data communication interface
CN202758482U (en) Control code study lamp
WO2002031987A3 (en) Simplified quality indicator bit test procedures
CN1276592C (en) Garage door opener
US6567487B1 (en) Method for the sampling of biphase coded digital signals
CN111104166B (en) Register writing method and device
CN108614798B (en) PCIe link elastic buffer circuit
CN106374932A (en) Decoder and decoding method of dual-mode UHF-RFID reader-writer
EP0012509B1 (en) Function coding system via digital addresses in a communication system
CN213986435U (en) Real-time water quality detection system
CN1316777C (en) Unit for determining samping phase
CN102255632B (en) Adaptive pulse position modulation signal demodulation method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: NANNING PURIYOU ENVIRONMENTAL PROTECTION TECHNOLOG

Free format text: FORMER OWNER: JIANGNAN UNIVERSITY

Effective date: 20111130

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 214122 WUXI, JIANGSU PROVINCE TO: 530000 NANNING, GUANGXI ZHUANG AUTONOMOUSREGION

TR01 Transfer of patent right

Effective date of registration: 20111130

Address after: 530000, Guangxi, Nanning headquarters Road No. 3 - China ASEAN enterprise headquarters base, phase 9, building 5, building two

Patentee after: Nanning Universal Environmental Protection Technology Co., Ltd.

Address before: A road Binhu District 214122 Jiangsu city of Wuxi province No. 27 Jiangnan University University Science and Technology Park C District

Patentee before: Jiangnan University

DD01 Delivery of document by public notice

Addressee: Nanning Universal Environmental Protection Technology Co., Ltd.

Document name: Notification of Termination of Patent Right

C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110622

Termination date: 20131027