introduction
Infrared remote control technology has been widely used in industrial control, instrumentation, home appliances, and other fields due to its stable performance, simple structure, and mature technology. Usually, IS200AEPAH1BKE IS215WEPAH2BB dedicated paired encoding and decoding chips are used to form infrared emission and reception circuits, completing remote control of equipment or appliances. Figure 1 shows the general working process of infrared remote control using this method.
The use of dedicated paired encoding and decoding chips to form infrared emission circuits and infrared reception circuits is not particularly contradictory when the number of control channels is small. However, when there are many control paths, the design and implementation of their interfaces become more cumbersome; In addition, because encoding and decoding chips are usually used in dedicated pairing, that is, a certain decoding chip can only recognize the encoding of a certain encoding chip, and cannot recognize the encoding of other models of encoding chips. Therefore, different encoding and decoding chips have almost no interchangeability.
This article proposes a method of using a microcontroller to achieve infrared remote control, which uses a transmission circuit composed of a certain encoding chip to transmit encoding, and directly sends the preprocessed encoding signal of the infrared pre receiving circuit to the microcontroller for decoding processing.
1 Working principle
Usually, the IS200AEPAH1BKE IS215WEPAH2BB infrared encoding chip can emit pulse sequences composed of pulses of different widths. The most common pulse carrier frequencies are 38 and 36 kHz, and the pulse sequence composition is shown in Figure 2. In the figure, the guidance segment and synchronization segment are the same for the same encoding chip, namely 9ms low level and 4.5ms high level; The address segment consists of two bytes of data, with the second byte being the inverse of the first byte. The encoding varies for different remote controllers; The data segment is also composed of two bytes, with the second byte being the inverse of the first byte. For different keys, the data segment will be different, and the recognition of keys is also determined based on the data segment.
In the decoding of pulse sequences, the most important thing is to determine 0 and 1. Taking the carrier frequency of 38kHz as an example, 0 is composed of a low level of 0.56ms and a high level of 0.56ms, and 1 is composed of a high level of 1.68ms and a low level of 0.56ms. Therefore, accurate timing is crucial in decoding, and using the interrupt system and timer of the microcontroller can conveniently and accurately achieve this function.
2 Implementation Plan
This design adopts the 212 bit encoding chip HT12C and MCS produced by HOLTEK company?? The 8051 microcontroller of the 51 series.
A scheme for implementing infrared remote control technology has been proposed, namely:
(1) The encoding circuit emits different codes based on the buttons, which are received by the infrared receiving circuit. After amplification, shaping, and inversion, they are sent to the external interrupt 0 (INT0) pin.
(2) Each input of a digit causes an interrupt, and the pulse width of that digit is measured in the interrupt processing program.
(3) Record the TH0 value representing the digit and store it in the digital temporary storage table.
(4) After storing a complete encoding, use a table lookup method to find the TH0 value representing 0.
(5) Use the position value of this digit as the feature value and find the corresponding processing function in the scatter processing program.