STC12C5410 MCU Simulation for Multimedia Projector Remote Control

Publisher:心灵飞翔Latest update time:2012-01-07 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

At present, projectors are common equipment in multimedia classrooms of colleges and universities. However, due to frequent use and mixed personnel, the projector remote control is often damaged or lost. Because the projectors used in schools are all imported products, it is difficult to match the remote control, and the price is very expensive if you can buy it. Using the function of the single-chip microcomputer to simulate the remote control, the low-cost projector remote control has practical promotion value.

The key to making a projector remote control is to first read out the control code data of all the buttons of the original projector remote control (same model), and then make a button control code table. During simulation, the microcontroller will transmit different control code data under button operation to achieve the purpose of remote control of the projector.

1. How to read the remote control button code

1.1 Hardware circuit for reading remote control key codes


Figure 1 shows the control circuit of the microcontroller reading the projector remote control key code. The microcontroller uses STC12C5410 from Hongjing Company. The P1.6 port light is used to indicate the code reading status. The light is on, indicating the code reading status. The P1.7 port light is used to indicate the remote control transmission operation. When it flashes, it means that the remote control code is being transmitted. In the code reading status, when the P1.6 port light is off and the P1.7 port light is on, it means that the code has been read. Pin (1) is the reset pin of the microcontroller, using a simple RC power-on reset circuit. Pin (6) is the external interrupt input port, used for the conversion control of the code reading function. When the switch at pin (6) is pressed, the system enters the interrupt code reading status. Pin (8) is used to read the output signal of the infrared receiver. Pin (11) is used as the infrared signal output port of the remote control, used to output 40KHz carrier code. Pin (12) is connected to the remote control test switch. Pins (4) and (5) are connected to an external 12M crystal oscillator.

Figure 1 Schematic diagram of the circuit for reading remote control key codes using a single chip microcomputer

When the "learning" switch is pressed, the code reading light of the P1.6 port turns on, indicating that the code reading state has been entered. At this time, press a button of the remote control that needs to be simulated against the infrared receiving head. When the light of the P1.6 port goes out and the indicator light of the P1.7 port turns on, the code reading is successful. The key code data can be obtained from the computer super terminal serial port. In order to test whether the read code is correct, you can press the transmission test switch to see if the projector function can be correctly operated. According to the above method, all the key codes of the original projector remote control are read into the computer for standby. Figures 2 and 3 are the waveform diagrams of the infrared receiving head output port and the microcontroller output port when the remote control code is transmitted.

Figure 2 Waveform of infrared receiver output port

Figure 3 P3.7 output waveform during remote control transmission test

1.2 Design of software for reading remote control key codes

Figure 4 is the main program flow of the remote control key code control software. Figure 5 is the program flow chart of interrupting the reading of key code data.

Figure 4 Main program flow chart

Figure 5 Flowchart of interrupt key code reading program


The interrupt key code reading program is very important in programming design. It needs to complete the functions of identifying the start bit of the remote control code and counting the pulse width, counting the width of the remote control code coding bit, and identifying the end bit. Through a large number of experimental analyses of different types of remote control code waveforms, the frame intermittent bit width of the remote control code is more than 10 ms, the start bit code width is between 100μs-20ms, and the coding bit is between 100μs-5ms. In order to ensure the success of reading codes for all remote controls, the following design method is adopted:

(1) Method for finding the start bit: Use a 16-bit DPTR counter to count the width of the high level. The counting sampling period is 21μs. When the high level ends, if the high 8-bit counter is non-zero, it means that the high level width exceeds 5.35ms (255×21μs). The following low level code is the start bit, otherwise start over.

(2) Reading start bit method: Use 16-bit DPTR to count the width of the low level (the maximum readable width is 1.376s). When the high level jumps, the counting ends and the high 8 bits and low 8 bits of DPTR are stored in the R4 and R5 registers respectively .

(3) Method for reading remote control code: Use the DPTR low 8-bit counter to count the width of the code (high level or low level). The counting ends when the level changes, and the value is stored in the specified address. When counting the high-level code, if the DPTR high 8-bit counter is non-zero (the width is greater than 5.35ms), it is determined to be the end frame interval bit, and OOH is written to the corresponding storage unit as the end mark.

2 Design of projector simulation remote control

2.1 Design of the hardware circuit of the simulated remote control


Figure 6 is the circuit diagram of the projector simulation remote control. It uses a 4*8 matrix key switch and can have 32 operation keys. The remote control outputs a 40K infrared modulation signal from the P3.7 port.


Figure 6 Projector simulation remote control circuit schematic

2.2 Design of remote control simulation software

In the simulation remote control, the corresponding key code transmission function is executed through the loop check key of the main program. The key code table is written in the ROM, so it cannot be changed after programming. The program includes the following main modules:

(1) Initialization procedure. Set the P1 and P3 ports, and set the counter counting mode, control word, etc.

(2) Keyboard scanning program. Complete the scanning of 32 keys and translate them into corresponding 32 key numbers to enable the execution of corresponding key functions.

(3) Button function program. Use the timer interrupt function to realize the generation of 40KHz carrier; use the corresponding start bit control data, high level control data, and low level control data of each button on the ROM table to control the carrier transmission time and interval time. The algorithm of remote control code modulation transmission is as follows:

①[Send start bit modulation wave]

Get the start bit data in the ROM table;

Turn on the 40KHZ square wave timer;

The start bit data is reduced by 1, and if it is not zero, the sentence is repeated after a delay of 21μs;

If it is zero, execute the next sentence;

②[Send high level interval bit]

Turn off 40KHZ square wave timer;

Get the high-level data in the ROM table; if the data is 0, the algorithm ends after a delay of 10ms; if it is not zero, execute the next sentence;

The data is reduced by 1, not zero, and the sentence is repeated after a delay of 21μs;

If it is zero, execute the next sentence;

③[Send low level modulation wave]

Get the low level data in the ROM table;

Turn on the 40KHZ square wave timer;

The low-level data is reduced by 1. If it is not zero, the sentence will be repeated after a delay of 21μs. If it is zero, the loop will be turned to ②.

④ Algorithm ends

3 Main performance indicators

(1) Maximum learning code length of the code reader: 206 bits

(2) Code reader recognition range: start bit: 21μs~1.376s, encoding bit: 21μs ~5.355ms

(3) Code reading error: + 21μs

(4) The frame intermittent position recognition range of the code reader is less than 1.37s and greater than 5.355ms.

(5) Simulation remote control transmission distance: greater than 10M

4 Summary

The performance of the multimedia projector's single-chip microcomputer simulation remote control is closely related to the software design, especially the sampling period of the code width count, which is related to whether the start position and the remote control code sampling accuracy can be identified. Multiple experimental tests are required during programming to balance each other. The code reading sampling period in this design is 21μs. After testing, it can correctly simulate commonly used projectors, color TVs, air conditioners and other equipment on the market.

References:

[1] An Qiling. Remote control interface of DVOD system. Microcomputer Information, 2002, 18(1): 54-55

[2] Lou Ranmiao. Design of single chip intelligent simulation remote control. Journal of Zhejiang Ocean University, 2001, 20(1): 70-73

[3] Li Jingda. Infrared remote control software decoding and its application. Microcontrollers and Embedded Systems Applications, 2002, (12): 66-67

Reference address:STC12C5410 MCU Simulation for Multimedia Projector Remote Control

Previous article:Design of an ultra-low power consumption dairy cow estrus monitor
Next article:Proteus virtual simulation software for single chip microcomputer

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号