Remote control MCS-51 single chip circuit diagram with TC9148

Single chip microcomputer STM32L151CCU6

TC9148 is a CMOS low-power infrared remote control transmitter dedicated IC, usually used in conjunction with TC9149/TC9150 infrared remote control receiver IC to control household appliances. TC9148 can be connected with 18 keys, 12 of which are pulse emission keys (that is, one code pulse is transmitted once, the receiver demodulates to generate a single pulse signal), and the remaining 6 keys have continuous transmission function (ie, press the emission key). The infrared transmitting tube continuously transmits the coded signal of the key until the key is released, and a series of pulse signals are obtained at the receiver end). This article introduces the special receiving circuit corresponding to TC9148, directly uses the timer and external interrupt function of MCS-51 single-chip microcomputer to receive the infrared coded signal of TC9148, that is, the method of remote control MCS-51 single-chip microcomputer with TC9148.

First, the coding of TC9148

To receive the remote control signal of TC9148 with a single-chip microcomputer, you should first know the coded signal of TC9148. The author uses the self-made simulator with 8031 ​​CPU to monitor and analyze the code of TC9148, and obtain the code of TC9148, as shown in the attached table.

From the table, the coded signal rules of TC9148 are as follows:

1. The code length is 24 bits and the bit width is 840μs. 2. The first, third, fifth, ..., 23 bits of the code are all 1, as an identification mark. 3. Only 4 of the pure codes after removing the identification marks in 1, 2 are 1, and the remaining 8 are 0. 4. The code of the pulse emission key starts with EE, and the code of the continuous transmission key starts with EF (for the convenience of codec, the above two identification marks will be removed after receiving the check).

After the manual button is pressed, the key code is transmitted once, and the delay is 40 bits before transmitting again. If the continuous emission key is pressed, after delaying 80 bits, repeat the above process until the key is disconnected.

The MCS-51 MCU verifies the received coded signal according to the above rules. If it does not, it is considered invalid.

Second, the transmission and reception of electrical schematics

The transmitter principle is shown in Figure 1. The TC9148 has very low static power consumption and does not have a power switch. Readers can also choose the remote control finished product made by TC9148. Pay attention to the connection of the diode between {13} foot to {12}, {11} and {10}. These three diodes correspond to the first 3 digits of the code. . The author encodes the first 3 bits as "101", so the second diode is not connected. The receiver principle is simpler, as shown in Figure 2. The infrared receiving head selects the finished product. After inverting through an inverter, the signal is sent to the INT1 end of the MCU (it can also be connected to INT0, but the corresponding program should be modified).

Third, receiving and decoding procedures

Set the crystal oscillator used by the microcontroller to 6MHz. Set the timer's timing to 0. 42ms, timing mode 2, INT1 is the negative edge trigger. When the first bit of data arrives, the INT1 interrupt is triggered and an interrupt is generated. In the INT1 interrupt service routine, the interrupt 1 is turned off, and the timer 0, 0 is started. After 42 ms, the timer is interrupted and the data is read. At this time, just in the middle of the bit data, after the timer reads 2 bits of data every 2 interrupts, after reading 24 bits of data, the data is stored in the memory, delay 40 bits, then read 24 bits of data, if read The 24-bit data is the same as the previous one, then it is verified and decoded, and the corresponding control program entry is obtained, and the corresponding program is executed. If any of the above steps cannot be passed, the result of the reception will be abandoned.

The program provided in this article is designed to embed other programs. The program uses timer T0, external interrupt 1, memory unit 10H, 11H, 12H, 30H, 31H, 32H, 33H, 34H, 35H, bit address 77H, if The reader uses the above resources in the main program, and can also be replaced. Be careful not to conflict with the stack.

If you embed this program in another program, just put the initialization program into the initialization part of the main program. The interrupt service routine can be placed anywhere in the program memory. This program is equivalent to executing in the background and does not affect the main control program. Note that 6 consecutive transmit keys will cause repeated execution of the corresponding handler.

Source list (omitted).

The program in this article runs through the homebrew simulator. Practice has proved that this method has good stability, high reliability and excellent anti-interference performance. The user embeds this program in the control program to perform very complex remote control functions.

Single chip circuit diagram



Ring And Fork Type Insulated Terminals

Taixing Longyi Terminals Co.,Ltd. , https://www.lycopperlugs.com

Posted on