introduction
In the early 1980s, Japan was the first to use infrared remote control technology in television products, and it has now been widely used in televisions. TV remote controls use dedicated integrated transmitter chips to transmit remote control codes, such as Toshiba TC9012, Philips SAA3010T, etc. These chips are expensive, and the remote control coding formats used are incompatible with each other, so the remote controls of different models can usually only be used for their own remote control objects and cannot be used universally. Based on experimental verification, this article introduces how to use the low-cost MCS-51 series microcontroller to realize the simulation transmission of remote control codes and realize the universalization of remote controls.
The basic principle of remote control transmission technology
Figure 1 Master code representation under NEC standard
Figure 2 Representation of data 0 and 1 under NEC standards
Figure 3 Full code representation under the PHILIPS standard
Figure 4 Hardware schematic diagram
Usually, the transmission of color TV remote control signals is to modulate the control instructions and system codes (a sequence of 0s and 1s) corresponding to a certain button on a carrier in the range of 32~56KHz, and then amplify and drive the infrared transmitting tube to transmit the signal.
Remote control chips from different companies use different remote control code formats. Here we introduce two common ones, one is the NEC standard and the other is the PHILIPS standard.
NEC standard: The frequency of the remote control carrier is 38KHz (duty cycle is 1:3); when a key is pressed, the system first transmits a complete full code, and then transmits a series of simple codes after a delay until the key is released and stops transmitting. The simple code repeats with a delay of 108ms, and the interval between the rising edges of each two guide pulses is 108ms. A complete full code is shown in Figure 1. Among them, the guide code has a high level of 4.5ms and a low level of 4.5ms; the system code is 8 bits, the data code is 8 bits, and there are 32 bits in total; data 0 is represented by "high level 0.5625ms + low level 0.5625ms", and data 1 is represented by "high level 0.5625ms + low level 1.6875ms", as shown in Figure 2: a simple code = guide code + the inverse code of system code bit 0 + end bit (0.5625ms) high level.
Functions of each code: The boot code is used to inform the receiver that the following is remote control data. The system code is used to distinguish which model the data is for, and the receiver uses this to determine whether the subsequent data is a command to be executed. The data code is used to distinguish which key is pressed, and the receiver determines what action should be performed based on the data code. The short code is the code sent when the key is pressed continuously. It tells the receiver that a certain key is being pressed continuously.
The key to remote control data transmission system is the reliability of data transmission. In order to improve the reliability of coding, NEC standard stipulates that the same code or inverse code should be transmitted after the system code and data code for error checking.
PHILIPS standard: carrier frequency is 38KHz; no simple code, when the key is pressed, the control code switches between 1 and 0, if the key is pressed continuously, the control code remains unchanged. A full code = start code '11' + control code + system code + data code, as shown in Figure 3.
Data 0 is represented by "low level 1.778ms + high level 1.778ms"; data 1 is represented by "high level 1.778ms + low level 1.778ms". The continuous code repetition delay is 114ms.
Hardware Schematic
Figure 4 is the hardware schematic diagram. The circuit mainly consists of three parts: AT89C52 and its peripheral circuit part; 8×8 key matrix part; and DC power supply part.
The control and remote control code generation part composed of AT89C52 single-chip microcomputer and its peripheral circuits mainly includes external interrupt signal processing, 12M clock, CPU reset, I/O port pull-up circuit, infrared remote control transmission, key indication, etc. The key matrix is built by P0 port and P2 port. When a key is pressed, the generated external interrupt request signal (low level is valid) is sent to P32 terminal after passing through the eight-input NAND gate and NOT gate, so that the CPU enters interrupt processing and lights up the key indicator light at the same time. The remote control code signal generated by the system is sent through P14 terminal, and after amplification, it drives the transmitting tube to be transmitted. The function of the DIP switch DIP is to switch different movement states. For example, when the DIP is set to "1000", the system is in the Changhong CH-10 movement state; when it is "1001", it is in the CN-12 movement state. R13, C11 and the key KEY constitute the reset circuit of the single-chip microcomputer.
8×8 key matrix part: It is composed of 64 keyboard switches. You can choose the appropriate number of keys according to your needs. 8*8 keys is the maximum number of keys without adding expansion devices.
The working power supply of the whole system is DC +5V. It consists of power module IC31 (PS0500DS), rectifier bridge HBA, HBK, etc. [page]
Program Implementation
The NEC encoding program is written in the assembly language of the MCS-51 series microcontrollers, and the PHILIPS encoding can be deduced in the same way.
The encoding formats of NEC, TOSHIBA and SAMSONG have something in common: the remote control full code is composed of "boot code + system code + system code (or system code inversion) + data code + data code inversion"; the definition of data "0" and "1" is the same; the difference is only the duration of the high and low levels of the boot code, the number of system code bits, the delay between the first simple code and the last bit of the full code, and the boot pulse of the simple code. Therefore, the same part can be made into a general subroutine, including the subroutines "ONE" and "ZERO" for generating data "0" and "1", and the time control subroutines such as 9ms, 4.5ms, 2.25ms, 22ms, and 45ms. The
8×8 key matrix processing adopts the external interrupt method. When a key is pressed, an interrupt request is sent to the CPU, and then it is scanned one by one according to the "first column and then row" to find the pressed key. Of course, this also includes the processing part of de-jittering and only processing one key when multiple keys are pressed at the same time.
The different states of the movement are distinguished and judged by the input values of the four bits P3.5, P3.4, P3.1, and P3.0 of the single-chip microcomputer P3 port. For example, "0000" means working in the Toshiba TC90×× series state, and "0001" means working in the NEC PD61×× series state.
After determining which key is pressed and which state the movement is in, the program will strictly transmit the remote control code according to the corresponding remote control coding method, that is, modulate the level pulse of a certain period of time and a certain value on the 38KHz carrier and transmit them one by one.
The flow chart is shown in Figure 5
Figure 5 Program flow chart
Part of the program segment:
Here is the main part of generating NEC remote control code, and the more common program segments such as key scanning are no longer provided.
The main program initialization part:
ORG 100H
main: mov psw,#0;
mov sp,#30h; set up the stack
mov tmod,#02h; mode 2 timing
mov th0,#0f3h; 38KHZ square wave time number
mov p2,#0;
mov p0,#0ffh
setb ex0; enable external interrupt 0
setb pt0; external interrupt 0 (key pressed) priority
clr it0; level trigger mode
clr mdl; set a no-key flag
setb p3.2;
setb p3.4
setb p3.5
setb p3.1
setb p3.0; set P3.0~P3.5 to input state
clr c; clear carry flag
clr p1.4; clear remote control output terminal
clr a; clear accumulator A
mov KEYHAO,#0H ; Clear key number memory
xrl a,#11000000b ;0000(p3.5 p3.4 p3.1 p3.0)
jz TV1
mov a,r7
xrl a,#11000001b ;0001
jz TV2
mov a,r7
xrl a,#11000010b ;0010
jz VCD
mov a,r7
……
SET ETO
SET EA ; Enable interrupt
pp:jnb mdl,pp ; Loop and wait for key
clr mdl ;
CLR KEYHAO
sjmp pp……
'0' subroutine and '1' subroutine part:ZERO: CLR A
SETB TR0 ; Start timer 0#
CJNZ A,#39,$ ;0.5625ms high level
CLR TR0 ; Stop timer 0#
ACALL DE05625 ;Edge time 0.5625ms
CLR A
RET
ONE: CLR A
SETB TR0 ;Start timer 0#
CJNE A,#39,$ ;0.5625ms high level
CLR TR0 ;Stop timer 0#
ACALL DE16875 ;Edge time 1.6875ms
RET
Conclusion
This article introduces the design of a universal TV remote control using the AT89C52 single-chip microcomputer instead of a dedicated remote control chip. This solution has the advantages of simple structure and low cost. By using the method introduced in this article to simulate the single-chip microcomputer remote control signal, you can make a universal remote control for your own home.
References
1 "MCS-51 Series Single Chip Microcomputer Application System Design". He Limin. Beijing University of Aeronautics and Astronautics Press
2 "Changhong's Latest Series of Movement Color TVs". University of Electronic Science and Technology Press
3 NEC Company. PHILIPS Company's Special Remote Control Chip Data
Previous article:Application of Z8E000 single chip microcomputer in air heater
Next article:A residential combined alarm system architecture
Recommended ReadingLatest update time:2024-11-16 22:35
- Popular Resources
- Popular amplifiers
- Real-time driver monitoring system via modal and viewpoint analysis
- STC MCU Principles and Applications: Analysis and Design from Devices, Assembly, C to Operating Systems: A Three-Dimensional Tutorial (He Bin)
- STC8 series MCU development guide: analysis and application of processors, programming and operating systems
- 51 MCU Reverse Learning Practical Tutorial
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
- EEWORLD University Hall ---- Electromagnetic Field and Electromagnetic Wave
- About the development of ST's 8032 core microcontroller uPSD3234A-40u
- I burned a stmf103 minimum board today
- Basic knowledge of embedded Linux development
- MSP430 has 5 low power modes
- Some recent updates of MicroPython
- Media Interview: Qorvo Experts Talk About UWB
- Xi'an Datang Telecom_FPGA Experience
- What is the general speed of stm32 reading and writing TF?
- FPGA_100 Days Journey_DA Design