Making a Universal TV Remote Control Using a Single Chip Microcomputer

Publisher:SereneMeadow7Latest update time:2012-02-17 Source: 电子设计应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

Reference address:Making a Universal TV Remote Control Using a Single Chip Microcomputer

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

Explanation of data, bdata and code in keil C of microcontroller
In terms of data storage type, the 8051 series has on-chip and off-chip program memory, on-chip and off-chip data memory. The on-chip program memory is also divided into direct addressing area and indirect addressing type, corresponding to code, data, xdata, idata and pdata type set according to the characteristics of
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号