Design of infrared wireless communication circuit based on serial infrared protocol transceiver module

At present, UART is generally used for communication between the application systems of single-chip microcomputers, and the signal is converted into RS232 or RS485 signal through the level conversion port for direct communication. The advantage of this kind of wired communication is that the communication bit error rate is relatively low, and the probability of being interfered is relatively small, but for a system that requires frequent plugging and unplugging of communication lines, wired communication is prone to failure. When the author develops the loom control system, a handheld programmer is used to modify the working parameters of the control system. In the actual use process, because the staff often plugs and unplugs the communication line, it often occurs that the contact is poor and the communication chip is damaged.Utilize ZiLOG

Author: Zhu Yanzhao

At present, UART is generally used for communication between the application systems of single-chip microcomputers, and the signal is converted into RS232 or RS485 signal through the level conversion port for direct communication. The advantage of this kind of wired communication is that the communication bit error rate is relatively low, and the probability of being interfered is relatively small, but for a system that requires frequent plugging and unplugging of communication lines, wired communication is prone to failure. When the author develops the loom control system, a handheld programmer is used to modify the working parameters of the control system. In the actual use process, because the staff often plugs and unplugs the communication line, it often occurs that the contact is poor and the communication chip is damaged. An infrared wireless communication circuit is designed using the IrDA chip ZHX1010 produced by ZiLOG Company.

1 Introduction of ZHX1010

ZHX1010 is a transceiver Module of IrDA SIR (Serial Infrared, Serial Infrared Protocol), the maximum speed of this module can reach 115.2kbps within 1 meter range. And its power supply range is wide (2.4 ~ 5.5V), which can be easily interfaced with CPUs of various voltages.

When ZHX1010 is powered by 3V, its typical current is only 90μA, which is very suitable for battery-powered products. In addition, the ZHX1010 is small in size, only 9.9mm×3.7mm, and has few peripheral components (only one resistor and one capacitor).

ZHX1010 has 6 pins, which are LEDA, TXD, RXD, SD, Vcc and GND in sequence. The LEDA is internally connected to the IRED infrared light-emitting diode, and the external is connected to a current limiting resistor to Vcc to provide the infrared tube with operating current. However, it should be noted that the maximum current supplied cannot exceed 500mA (20% duty cycle). TXD is a data transmission pin, which has a pull-down resistor inside, which can be directly connected to the data transmission terminal of the MCU. When the device enters the power-saving mode, the pull-down resistor is open. RXD is the output pin after receiving infrared data, it is a three-state output pin, the slew rate controlled CMOS output driver can drive standard CMOS or LSTTL loads. No external resistor is required for this pin. SD is the power-saving mode control pin. When this pin inputs a high level, the ZHX1010 enters the power-saving mode, and the maximum current at this time is only 1μA.

2 ZHX1010 and AT89C51 interface circuit

The working voltage of AT89C51 is 5V, while the working voltage of ZHX1010 is wider, from 2.4V to 5.5V, so it can be directly connected. In addition, the AT89C51 has a UART, which is very suitable for transferring serial data, and its maximum baud rate can reach 115.2kbps when using a 22.1184MHz crystal.

Design of infrared wireless communication circuit based on serial infrared protocol transceiver module

Figure 1 shows the specific interface connection between ZHX1010 and AT89C51.

3 Programming

The purpose of using ZHX1010 is to carry out wireless data communication between two microcontroller systems. Therefore, the UART of AT89C51 should work in mode 2, and its baud rate should be adjustable to suit applications with different communication distances. How it works The initializer is as follows:

InitComm:

MOV TMOD, #21H
MOV TH1, #250; 22.1184M crystal oscillator
MOV TL1, #250; 9600bps
SETB TR1
MOV SCON, #50H
MOV 87H, #0H
CLR RI
SETB REN
SETB ES ; enable receive interrupt
RET

In order to avoid data loss, the infrared data is received in an interrupt mode, and the received data can be stored in cReceBuffer. The specific program of the interrupt part is as follows:

cReceBuffer EQU 40H ; data receiving buffer
cReceLen EQU 50H; data receiving length

CommIntProc:

PUSH ACC
PUSH R0
MOV A, #cReceBuffer ; Calculate the current address to save the data
ADD A, cReceLen
MOV R0, A
MOV A, SBUF
MOV @R0, A; save the received data
INC cReceLen ; add 1 to the length of the received data
POP R0
POP ACC
RETI

After the data is received, different functions can be completed according to different commands:

MOV A, cReceBuffer; the first byte is the command number
CJNE A, #1, Command1;
Read the set data

Command1:

CJNE A, #2, Command2
;Modify the set data

Command2:
;Other commands
RET

4 Summary

When using the ZHX1010, pay attention to the on-site environment. In the actual use process of the author, there is often a high bit error rate of sending and receiving. After inspection, it is found that the infrared sending and receiving heads of the ZHX1010 are dirty. The sending and receiving ends collect dust, which affects communication. In addition, when a system completes the state transition from sending to receiving, a delay of at least 2 ms is required to ensure that the receiving is relatively reliable.

The Links:   CLAA104XA02CW 2MBI150NC-120 SEMIKRONIGBT

Related Posts