Infrared remote control is the most widely used communication and remote control method. Since infrared remote control devices have the characteristics of small size, low power consumption, strong functions and low cost, after color TVs and video recorders, other small electrical appliances such as recorders, audio equipment, air conditioners and toys have also adopted infrared remote control. Now it has also been widely used in industrial equipment.
1 Infrared remote control system
The universal infrared remote control system consists of two parts: the transmitting part and the receiving part. The encoder/decoder special integrated circuit chip is used for control operation, as shown in Figure 1. The transmitting part includes the keyboard matrix, coding modulation, and LED infrared transmitter; the receiving part includes the optical-electric conversion amplifier, demodulation, and decoding circuits.
2 Remote control transmitter and its coding
There are many special chips for remote control transmitters, which can be divided into two categories according to the coding format: pulse width modulation and pulse phase modulation. Here we use pulse width modulation, which is widely used and easier to decode, to explain the coding principle. Now we take 3310 as an example to illustrate the coding principle of the transmitter circuit. When the transmitter button is pressed, a remote control code is sent out. The remote control code is different for different keys. This remote control code has the following characteristics:
The serial code adopts pulse width modulation, with a pulse width of 0.565ms, an interval of 0.56ms, and a period of 1.125ms representing the binary "0"; and a pulse width of 0.565ms, an interval of 1.685ms, and a period of 2.25ms representing the binary "1".
The 42-bit binary code composed of "0" and "1" is modulated twice by a 38kHz carrier frequency to improve the transmission efficiency and reduce power consumption. Then the infrared emitting diode generates infrared rays and transmits them into space.
The remote control code generated by 3310 is a continuous 42-bit binary code group, of which the first 26 bits are the user identification code, which can distinguish different infrared remote control devices and prevent the remote control codes of different models from interfering with each other. The last 16 bits are the 8-bit operation code and the 8-bit operation inverse code, which are used to check whether the data is received accurately.
When any button on the remote control is pressed for more than 36ms, the oscillator of the LC7461 chip activates the chip and transmits a specific synchronization terminal, which is a 9ms low level and a 4.5ms high level for the receiving end. This synchronization terminal allows the program to know that it can start receiving data from this synchronization terminal.
The key to decoding is how to identify "0" and "1". From the definition of the bit, we can find that "0" and "1" both start with a low level of 0.56ms, but the difference is that the width of the high level is different, "0" is 0.56ms, "1" is 1.68ms, so "0" and "1" must be distinguished according to the width of the high level. If the delay starts after the 0.56ms low level, after 0.56ms, if the read level is low, it means that the bit is "0", otherwise it is "1". For reliability, the delay must be longer than 0.56ms, but not more than 1.12ms, otherwise if the bit is "0", the read level is already the next high level, so (1.12ms+0.56ms)/2=0.84ms is the most reliable, and generally about 0.84ms is sufficient.
According to the infrared coding format, the program should wait for the 9ms start code and 4.5ms result code to complete before reading the code.
Receiver and Decoder
LT0038 is a plastic-encapsulated integrated infrared receiver. It is an integrated circuit that integrates infrared reception, amplification and shaping. It does not require any external components to complete all the work from infrared reception to output compatible with TTL level signals. It is high level when there is no infrared remote control signal and low level when receiving an infrared signal. Its size is the same as that of an ordinary plastic-encapsulated triode. It is suitable for various infrared remote controls and infrared data transmission.
The following is a decoding program for the infrared remote control that comes with the 51ISP programming experimental development board. It can read the key value of each button on the infrared remote control and display it through the 8 LEDs on the P1 port of the experimental board. When the decoding is successful, it can also emit a "beep beep" prompt.
[page]
ORG 0000H
AJMP MAIN; transfer to the main program
ORG 0003H; external interrupt P3.2 pin INT0 entry address
AJMP INT; transfer to the external interrupt service subroutine (decoding program)
; the following is the CPU interrupt mode setting for the main program
MAIN: SETB EA; open the CPU total interrupt request
SETB IT0; set the trigger mode of INT0 to pulse negative edge trigger
SETB EX0; open INT0 interrupt request
; the following initializes all pins of the microcontroller and sets them all to high level
MOV P2,#11111111B
AJMP $
;The following is to enter the P3.2 pin external interrupt subroutine, that is, the decoding program
INT: CLR EA ;Temporarily turn off all CPU interrupt requests
MOV R6,#10
SB: ACALL YS1;Call 882 microsecond delay subroutine
JB P3.2,EXIT;After a delay of 882 microseconds, determine whether a high level appears on the P3.2 pin. If so, exit the decoding program
DJNZ R6, SB;Repeat 10 times. The purpose is to detect if a high level appears within 8820 microseconds and exit the decoding program
;The above completes the recognition of the 9000 microsecond initial low-level signal of the remote control signal.
JNB P3.2, $ ;Wait for a high level to avoid a 9-millisecond low-level guide pulse
ACALL YS2 ;Delay 4.74 milliseconds to avoid a 4.5-millisecond result code
MOV R7, #26; Ignore the first 26 bits of the system identification code
JJJJA:JNB P3.2,$; Wait for the high level signal of the first bit of the address code
LCALL YS1; After the high level starts, use the time ruler of 882 microseconds to judge the high and low level status of the signal at this time
MOV C,P3.2; Store the current level status of the P3.2 pin 0 or 1 in C
JNC UUUA; If it is 0, jump to UUUA
LCALL YS3; If a high level 1 is detected, delay 1 millisecond to wait for the high level of the pulse to end
UUUA: DJNZ R7,JJJJA
MOV R1,#1AH; Set 1AH as the starting RAM area
MOV R2,#2; Receive 2 memories from 1AH to 1BH to store the operation code and the inverse operation code
PP: MOV R3,#8; Each group of data is 8 bits
JJJJ: JNB P3.2,$; Wait for the high level signal of the first bit of the address code
LCALL YS1; After the high level starts, use a time ruler of 882 microseconds to determine the high and low level states of the signal at this time
MOV C,P3.2; Store the current level state of the P3.2 pin 0 or 1 in C
JNC UUU; If it is 0, jump to UUU
LCALL YS3; If a high level 1 is detected, delay 1 millisecond to wait for the high level of the pulse to end
UUU: MOV A,@R1; Give the address in R1 to A
RRC A; Move the value 0 or 1 in C to the lowest bit in A
MOV @R1,A; Temporarily store the number in A in the memory of R1 value
DJNZ R3,JJJJ; Receive a full 8-bit memory
INC R1; Add 1 to the value in R1 and change to the next RAM
DJNZ R2,PP; After receiving the 8-bit data code and the 8-bit data inverse code, store them in 1AH/1BH
MOV A,1AH
CPL A; invert 1AH and compare it with 1BH
CJNE A,1BH,EXIT; if they are not equal, it means an error occurred in receiving data, and give up
MOV P1,1AH; Display the key value through the 8 LEDs of P1 port!
CLR P2.0; The buzzer beeps, indicating that the decoding is successful
LCALL YS2
LCALL YS2
LCALL YS2
SETB P2.0; Stop the buzzer (When using, you can use the YINYUE pin of J2 to connect the XS1 pin of J4 with a jumper to use the buzzer) See the schematic diagram
EXIT: SETB EA; Allow interrupt
RETI; Exit the decoding subroutine
YS1: MOV R4,#20 ; Delay subroutine 1, accurate delay of 882 microseconds
D1: MOV R5,#20
DJNZ R5,$
DJNZ R4,D1
RET
YS2: MOV R4,#10 ; Delay subroutine 2, accurate delay of 4740 microseconds
D2: MOV R5,#235
DJNZ R5,$
DJNZ R4,D2
RET
YS3: MOV R4,#2; Delay subroutine 3, accurate delay of 1000 microseconds
D3:MOV R5,#248
DJNZ R5,$
DJNZ R4,D3
RET
END
The above programs are for reference only.
0A 01
11 12 13 14
15 16 17 18
19 10 1A 1B
0E 02 03 1C
06 04 05 0C
0D 08 09 1D
00 1F 1E 0B
07 0F
This is the key value (in hexadecimal) of the 32 keys according to the actual position of the infrared remote control keys.
Previous article:STC12C5410 MCU Simulation for Multimedia Projector Remote Control
Next article:What I want to say to microcontroller beginners
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- TI C6748 chip PRU part assembly software package sprc940.zip
- The new issue of "Analog Dialogue" is online, free download!
- Is there any domestic chip factory that makes 74 series chips?
- Vias
- Do you know about energy storage emergency power supply?
- After adding shutdown and low power consumption, stm32 will run away after working for 8-9 hours
- [Silicon Labs Development Kit Review] +6-axis inertial sensor ICM-20648
- Welcome our new moderator, Azuma Simeng~~
- Thanks to all the staff of Electronic Engineering Forum
- TI DSP--Memory space allocation and designation