Using TC9148 to remotely control MCS-51 microcontroller circuit
Source: InternetPublisher:小胖友 Keywords: Infrared remote control Updated: 2011/05/09
TC9148 is a CMOS low-power infrared remote control transmitter dedicated IC. It is usually used in conjunction with TC9149/TC9150 infrared remote control receiving IC to control household appliances. TC9148 can be connected to 18 keys, 12 of which are pulse transmission keys (that is, pressing once will transmit a coded pulse, and the receiver will generate a single pulse signal after demodulation), and the remaining 6 keys have a continuous transmission function (that is, pressing the transmit key , the infrared transmitting tube continuously emits the coded signal of the key until the key is released, and the receiver can get a series of pulse signals). This article introduces the method of directly using the timer and external interrupt function of the MCS-51 microcontroller to receive the infrared coded signal of the TC9148 without using the dedicated receiving circuit corresponding to the TC9148, that is, using the TC9148 to remotely control the MCS-51 microcontroller. 1. Encoding of TC9148 To use a microcontroller to receive the remote control signal of TC9148, you should first know the encoding signal of TC9148. The author used a self-made emulator with 8031 as the CPU to monitor and analyze the encoding of TC9148, and obtained the encoding of TC9148, as shown in the attached table. It can be seen from the table that the coding signal rules of TC9148 are as follows: 1. The code length is 24 bits and the bit width is 840μs. 2. The 1st, 3rd, 5th...23rd bits of the code are all 1, as identification marks. 3. In the pure code after removing the identification marks in items 1 and 2, only 4 bits are 1, and the remaining 8 bits are 0. 4. The code of the pulse emission key starts with EE, and the code of the continuous emission key starts with EF (for the convenience of encoding and decoding, the above two identification marks will be removed after reception and verification). After manually pressing the key, the key code will be transmitted once, and will be transmitted again after a delay of 40 bits. If the continuous transmission key is pressed, after a delay of 80 bits, repeat the above process until the key is disconnected. The MCS-51 microcontroller checks the received encoded signal according to the above rules. If it does not comply, it is regarded as invalid. 2. Transmitting and receiving electrical schematic diagram The transmitter principle is shown in Figure 1. TC9148 has extremely low static power consumption and does not need a power switch. Readers can also choose the finished remote control made by TC9148. When using it, pay attention to the connection method of the diodes between pins to, and between pins. These three diodes correspond to the first three digits of the code. The author codes the first 3 bits as "101", so the second diode is not connected. The receiver principle is relatively simple, as shown in Figure 2. The infrared receiver is a finished product, and after inverting the phase through an inverter, the signal is sent to the INT1 end of the microcontroller (INT0 can also be connected, but the corresponding program must be modified). 3. Receiving and decoding program Assume the crystal oscillator used by the microcontroller is 6MHz. Set the timer's timing time to 0.42ms, timing mode 2, and INT1 as 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, external interrupt 1 is turned off and timer 0 is started. After 0.42ms, the timer interrupts and the data is read. At this time, it is exactly in the middle of the bit of data. In the future, the timer will read one bit of data every two times. After reading 24 bits of data, save the data in the memory, delay 40 bits, and then read 24 bits of data. If If the 24-bit data is the same as the previous one, it will be verified and decoded to obtain the corresponding control program entry and execute the corresponding program. If any of the above steps cannot be passed, the result of the reception will be given up. The program provided in this article is designed to be embedded in other programs. The program uses timer T0, external interrupt 1, memory units 10H, 11H, 12H, 30H, 31H, 32H, 33H, 34H, 35H, bit address 77H, if Readers who have used the above resources in the main program can also replace them, but be careful not to conflict with the stack. If this program is embedded in other programs, just program the initialization program into the initialization part of the main program. The interrupt service routine can be placed anywhere in program memory. This program is equivalent to executing in the background and does not affect the main control program. Note that 6 consecutive emission keys will cause the corresponding processing program to be executed repeatedly. Source program list (omitted). The program in this article runs successfully in a self-made emulator. Practice has proved that this method has good stability, high reliability and excellent anti-interference performance. Users can embed this program into the control program to complete very complex remote control functions.
- Manual automatic air compressor control circuit
- Using P110C to control 6 DC motors simultaneously
- Design and principle analysis of practical electric curtain remote control device
- Car audio system anti-theft circuit
- Large range laser burglar alarm
- Rolling door anti-theft device
- Automatic controller for electric iron
- Refrigerator Thermostat Replacement Device
- New type of wind and rainproof automatic window that is simple and easy to make
- White noise electronic hypnotist
- Electronic rhythm control circuit
- Ringtone control circuit
- Water dispenser double sheet control circuit
- DC voltage stabilizing circuit and zero-crossing detection circuit in the indoor unit control circuit of Hisense KFR-25GW-06BP inverter air conditioner
- PLC chain alarm control circuit used in production process
- Multi-pole leakage protector circuit b
- Multi-pole leakage protector circuit a
- Small power electric heater temperature detection control circuit
- Forward and reverse control circuit of micro DC motor b
- Voltage stabilization control circuit in power circuit