Free Electronic Circuits & 8085 projects

Electronic projects with circuit diagram and 8085 microprocessor projects.

Infrared remote control circuit with a single chip decoder

Published on Oct 27 2010 // Micrcontroller circuits

Infrared remote control  circuit with a single chipdecoder

Infrared remote control with a single chip decoder
Remote easy to use, features and more. Has been widely used in TV sets, VCD, DVD, air conditioning and other household appliances, and the price is cheap, very easy to buy on the market. If you can a lot of buttons on the remote control decoded. SCM system for the input. Is to solve the conventional matrix keypad circuit board is too large, complex wiring, occupy I / O port too many ills. And through the use of remote control operation can be the separation of man and equipment, which is more convenient to use. Below the TC9012-p.htm "target =" _blank "title =" TC9012 data sources and PDF "> TC9012 remote control as an example encoding chips. Talk about how to use the standard remote control 51 of the decoding system microcontroller.
First, the encoding format
1,0 and 1 encoding
Remote control signal emitted by the binary string of O’s and 1’s code. Different chip encoding of 0 and 1 are different. Manchester encoding and usually pulse width encoding. TC9012-p.htm "target =" _blank "title =" TC9012 data sources and PDF "> TC9012 of O and a method of encoding using PWM, the pulse width modulation, the O code and 1 yard shown in Figure 1 (based on remote receiver output waveform example). O code from the O.56ms combination of low and high 0.56ms. 1.12ms.1 yards from the pulse width of 0.56ms and 1.69ms high mix low made. pulse width of 2.25ms. in the preparation of decoding program. by determining the pulse width can be 0 or 1.
2, the encoding key
When we press the remote control button, the remote control will send a string of binary code in Figure 2, we call it a frame of data. According to the function of each part. They can be divided into five parts, namely, boot code, address code, address code, data code, data counter code. Remote control transmitter code. Are low in the former. High in the post. Figure 2 can be obtained from the analysis. High boot code for the 4.5ms, low as 4.5ms. When
When receiving this code. That the start of a frame of data. SCM can be ready to receive the following data. 8-bit binary address code formed by a total of 256. The figure re-issued an address code. Are to enhance the reliability of the remote control. If the two address code is not the same. Is illustrated in the frame wrong. Should be discarded. Different devices can have a different address codes. So. The same encoding settings as long as the address of the remote control code is different and will not interfere with each other. The address map for the hexadecimal code 0EH (note least significant bit first.) In the same remote control. All keys issued by the address code is the same. 8-bit data code, and encoded 256 state, on behalf of the actual key pressed. Anti-code data is the data you find anti-code, code and data by comparing the data against code. Can determine the received data is correct. If the data code and data between anti-code does not meet the opposite relationship. The remote control receiver is wrong. Data should be discarded. In the same remote control. The data of all key codes are not the same. In Figure 2, the data as hexadecimal code 0CH, anti-code data in hexadecimal 0F3H (note least significant bit first.) Of both and should be 0FFH.
Second, the single chip remote control receiver circuit
Infrared remote control receiver infrared receiver diode can be added earlier infrared processing circuit dedicated approach. If CXA20106, circuit complexity of this method, it is generally not used. Better integration of the receiver is to use infrared receiver, infrared receiver diodes will, amplification, demodulation, plastic and other circuits do together, only three pins. Are 5V power, ground and signal output. Common form of integration and the pin receiver shown in Figure 3 and Figure 4. Infrared receiver input signal
INTO MCU out of access or INTl feet. A typical circuit is shown in Figure 5. The figure increased by a PNP-type transistor to amplify the output signal.
Third, the remote control signal decoding algorithms and programming
Peacetime. No key is pressed the remote control. Infrared emitting diodes do not send a signal, the output signal a remote receiver. A key is pressed. O and 1-encoded reverse-phase high by remote control after the first output signal O. As connected with the microcontroller interrupt pin will cause an interrupt microcontroller (MCU pre-set for the falling edge). Microcontroller used in the interrupt timer 0 or timer 1 starts. To the next pulse arrives, the interrupt again, the first time the value out. Clear time value and then start the timer. By judging each interrupt with the previous time interval between interruption. They will know that the boot code is received, or O and 1. If the time is 9ms. Boot code is received, if the time value is equal to 1.12ms, received a code O. If the timer value is equal to 2 25ms. Received a code 1. In determining the time, consideration should be given a certain error. Because of the different parameters of the remote control causes the crystal, transmitting and receiving time there will be a small error.
To receive TC9012-p.htm "target =" _blank "title =" TC9012 data sources and PDF "> TC9012 remote control codes, for example, decoding method is as follows:
(1) Let the external interrupt 0 (or 1) for the falling edge interrupt, timer 0 (or 1) for the 16-bit timer. The initial values are O.
(2) After the first break into the remote control to start timing.
(3) into the remote control from the second break, the first stop the clock. And the value of saving time, and then re-timing. If the timer value is equal to the preamble of the time, the establishment of a preamble symbol. Ready to receive the data following a remote control, if the time value is not equal to the preamble of the time, but the previously received preamble, the judge is O or 1 remote data.
(4) continue to receive the following address code, data code, data counter code.
(5) When 32-bit data is received, indicating that a data reception is completed. Time to stop the timer at this time, and determine the validity of this receiver. If the same address code and equal to twice the system address, data, code and data and is equal to anti-yards 0FFH, is receiving valid data code of the frame. Otherwise, discard this received data.
(6) has been received, initialization data received this time, ready for the next remote control receiver.
Example procedures are as follows: E1INT:
PUSHACC
PUSH PSW
CLRTR1
MOV RM-TLEN, TH1,
MOVTH1, # 00H
MOV TL1, # 00H
SETBTR1
MOV A, RMJLEN
JNZ LBL-RM-DAT-BIT
MOV RM-ADDR. # 00H
MOV RM-RADDR, # 00H
MOV RM-DAT, # 00H
MOV RM-RDAT, # 00H
MOV RM-BIT_CNT, # 00H
CLR RM-OK
CLR RM-GUIDE
POPPSW
POPACC
RET1 I BI RM DAT BIT:
MOV A, RM_TLEN
CJNE A, # 23H, LBL-RM_ADDR_DAT
SETB RM-GUIDE
SJMP LBLE1 INT-RET
LBLRM_ADDR_DAT;
JNB RM-GUIDE, LBL-RM-ERROR
CJNE A, # 04H, LBL_RM_ONE
CLR C
SJMP LBL_RM-SHIFT
LBLRM-ONE:
CJNE A. # 08H. LBL-RM-ERROR
SETB C
LBL_RM_SHIFT:
MOV A, RM-RDAT
RRC A
MOV RM-RDAT. A
MOV A, RM-DAT
RRC A
MOV RM-DAT, A
MOV A, RM-RADDR
RRC A
MOV RM RADDR. A
MOV A. RM – ADDR
RRC A
MOV RM-. ADDR. A
LBL-RM-END:
INC RM-BIT-CNT
MOV A, RM_BIT_CNT
CJNE A, # 32, LBLE1 INT_RET
CLRTR1
MOV TH1, # 00H
MOVTL1, # 00H
MOV HOUR. RM-ADDR
MOV MINUTE, RM-DAT
MOV RM-_ADDR, # 00H
MOV RM-RADDR, # 00H
MOV RM-DAT, # 00H
MOV RM-RDAT, # 00H
MOV RM a 8IT_CNT, # 00H
CLR RM-GUIDE
SEITB RM-OK
SJMP LBL-E1 INT-RET LBL-RM-ERROR:
CLRTR1
MOV TH1, # 0OH
MOVTL1, # 00H
MOV RM-_ADDR, # 00H
MOV RM-RADDR, # 00H
MOV RM-DAT, # 00H
MOV RM-RDAT, # 00H
MOV RM-B1T-CNT, # 00H
CLR RM-GUIDE
LBL-E1 INT-RET:
POPPSW
POPACC
RETI
Fourth, the remote control code and the keyboard code converter
In the application system, with remote control equipment generally with keys. And both feature the same. Will be converted into the standard remote button key value. Bulk transfer form remote control button to switch the keyboard loose form reuse. Conversion method can look-up table. Look-up table. The key value of the remote control unit keyboard, the value of the switching costs. In this way, you can use the key operation, you can also use the remote control, and the corresponding process is very simple.
Encoding format to Tc9012 example above to illustrate the principles and methods of decoding. Note that one as long as the data format and boot code, O yards and 1 yard length of time. Other encoding chips, such as HT6121, M50560, LC7461, also very easy to decode.