摘要
针对数据帧格式固定、校验方式单一以及传输速率不便于更改等问题,提出了一种通过STC89C516RD+单片机实现的软件编解码方法。该方法通过定时器的延时来实现对数字信号的编码;通过外部中断与定时器相结合的方式进行解码,即利用接收到的脉冲信号的上升沿启动定时器工作,下降沿停止定时器工作并触发外部中断,然后读取计数寄存器的值并识别数据。实验证明,该方法的数据帧格式及校验方式灵活多变,而且可以降低无线传输系统的成本,适用于无线控制、数据采集、故障报警等多种无线数据通信场合。
Some disadvantages are found, such as fixed form of frame and a simplex checkout way. It is also hard to change the transmission speed. So a new software encoding and decoding method based on STC89CS16RD+ single-chip microcomputer is proposed. The timer is used to encode, and both the peripheral interrupt and the timer are used to decode. The timer will start to work when a rising-edge of the pulse signal received is detected, and it will stop working when a falling-edge is detected. The falling-edge will generate the peripheral interrupt at the same time. ~l^e value of tile counter registers will be used to decode. It is proved that this method has flexible form of frame and diverse checkout ways. The cost of the wireless communication system is also diminished. It is fit for the wireless control, data acquisition and trouble alarm.
出处
《微型机与应用》
2011年第5期92-94,共3页
Microcomputer & Its Applications
关键词
编码
解码
定时器
外部中断
encoding
decoding
timer
peripheral interrupt