Application of infrared remote control in automobile
infrared remote control is the most widely used means of communication and remote control. Because the infrared remote controller has the characteristics of small volume, low power consumption, strong function and low cost. Therefore, infrared remote control is also used in color TV sets, video recorders, audio equipment, air conditioners, toys, doorbells, remote control car road signs and other small devices. In order to change the defect that the front road sign indicator light (hereinafter referred to as the car number device) on the current car can not be changed flexibly, the infrared remote control is used in it, so that it can easily realize the purpose of changing the car number at one time with long-distance and non-contact, so as to change the old mode of manual license plate turnover
I. infrared remote control system of car number device
the car number device on the car was originally controlled by a simple LED nixie tube, which is very inconvenient to use. In order to control it far away, infrared remote control was adopted. Generally, the infrared remote control system consists of transmitting and receiving parts. The special integrated circuit chip of encoding/decoding circuit is used for control operation. As shown in Figure 1, the transmitting part includes keyboard matrix, encoding modulation and infrared transmitter. The receiving part includes photoelectric conversion amplifier, demodulation and decoding circuit. Infrared transmission each coded transmission is a key value, that is, a hexadecimal data. In order to send a group of data at a time (such as train number, which is usually a three digit decimal number), we can use the software coding/decoding method of 89C2051, first input a group of train numbers at one time, press the send key, and then send them all; At the same time, when receiving, all data are decoded at one time by using the continuous receiving method
II. Remote control transmitter and its code
there are many special chips for remote control transmitter, but 89C2051 chip is used in the remote control of car number controller. Use P1 port to form matrix scanning feedback, obtain key value, and use internal timer 1 to generate a 38K software timing interrupt to drive P1 0 generates a 38K square wave as the modulation fundamental wave of infrared. The data to be transmitted is sent directly to the serial port transmitting end of TXD in serial mode with baud rate of 1200 and parity check, and then TXD and P1 0, after 40106 shaping, the infrared emitter is driven by a triode and sent directly. The schematic diagram is as follows:
III. The infrared remote control receiver and its display
receiver are mainly composed of CX20106 and 89C2051, display drivers 4094 and 2803, data memory and watchdog 25045. After filtering the 38K carrier wave with the decoding chip CX20106, a group of waveforms are obtained, that is, the serial port data with baud rate of 1200 is directly sent to the RXD of 89C2051 for reception, the serial port is read with software, the buffer is input, and a group of data is obtained, After the judgment is correct, it is stored in the nonvolatile eeprom25045. At the same time, it directly uses the pulse shift mode to send the data to 4094. After being driven by 2803, it is displayed. At the same time, it is timed with the watchdog of 25045 to ensure that it can return correctly without error reception in case of program out of control. Due to the serial port transmission, it has parity check and start stop check, which can greatly improve the reliability of the data. At the same time, the cumulative sum check is added to the data group to improve the reliability again. Therefore, in practical application, even in the open air, direct sunlight, strong illumination and other harsh environments, it can ensure that there will be no misreception of data and display errors. The schematic diagram is as follows:
IV. software programming
single chip microcomputer 89C2051 software includes three parts: main program, serial port interrupt service program and timing interrupt service program. The corresponding working unit and flag bit are established in the RAM area of 2051 single chip microcomputer
(I) sending procedure: send-bufo ≓ send-buf3 is a four character sending buffer, and send-mark is a request sending flag. When the keyboard scans that there is a request to send, start the timer at P1 0 outputs a 38K square wave, starts the serial port at the same time, and sends the data from send-bufo to send-buf3 to SBUF for synthesis and transmission. The program flow is as follows:
send the main program: set the timer, watchdog and serial port during initialization, clear the display, and then scan the keyboard. If a key is pressed, press the key; If it is the send key, set the serial port send flag, start the timer and serial send program, then return to the display program in the main program and send the display data to the buffer
serial port interrupt program: for on-site protection, take the sending data to the sending buffer. It is recommended that you pay more attention to the quality and production standards. Start the software to generate a 38K square wave regularly, and then judge whether the data is sent. When it is finished, clear the sending flag. Otherwise, return to continue sending data
timing interrupt program: protect the backfilling timing length on site, start the counting timing, and set it on the designated pin P1 0 takes the inverse, becomes the inverse level, and returns
(II) receiving procedure: rec-bufo ≓ rec-buf4 is a four character receiving buffer, and rec-mark is a sign of complete data reception. When the serial port interrupt is generated, the data is received to rec-buf0 to rec-buf3 in sequence. When the data is full, the cumulative sum is calculated. If correct, set rec-mark mark; On the contrary, the buffer data is cleared. If the rec-mark mark is judged in the main program, the data will be processed and sent to the external memory 25045 and the display buffer for display. At the same time, because the reception is carried out in the vehicle, there are many power supply voltage and other interferences, including possible serial port misjudgment. Therefore, in order to ensure the normal operation of the program, the watchdog circuit in 25045 is started to refresh regularly every 500ms. The program flow is as follows:
receive the main program: set the timer, watchdog, clear display and external memory 25045 during initialization to judge whether there is a data receiving flag. If there is data judgment, the correct further improved productivity and part of the quality gain benefit from the significant improvement of the software slicing algorithm, write it to the data external memory and send it to the display area for display. On the contrary, return to the display program of the main program and refresh the watchdog
serial port interrupt receiving program: after on-site protection, judge whether the received data is head or tail data, make corresponding processing, store the cache when it is normal data, and add one pointer. When a complete set of data is received normally, set the received data flag and return
the timing interrupt program is the same as sending, but the watchdog is refreshed regularly
v. conclusion
the above methods very simply realize the reception and decoding of infrared remote control signals, which greatly saves the resource overhead of hardware implementation. The design of the infrared remote control system has been applied to the bus, which improves the basic principle of the service of the bus system, has no major correction quality, and improves the work efficiency. (end)
AnnouncementLINK
Copyright © 2011 JIN SHI