1 Overview
When using remote control encoding and decoding chips, the addresses of a pair of chips are required to be completely consistent. Therefore, when one remote control chip controls multiple decoding chips, multiple switches connected to the address end need to assist in action at the same time to change the address so that it is completely consistent with the address of the decoding chip to achieve the purpose of remote control.
If a microcontroller is used to replace the encoding chip, the function of changing the output waveform by multiple switch actions can be completed by software. At the same time, the microcontroller can be operated in power-down mode when idle, which not only makes operation simple but also saves energy.
Therefore, we designed a circuit which uses the cheap single-chip microcomputer AT89C2051 to replace the remote control coding chip PT2262 to realize the coding function, and simulated the remote control coding function with software.
2 Working Principle of PT2262
2.1 Pin Function
The functions of each pin of PT2262 are shown in Table 1.
2.2-bit pulse width
There are three ways to connect the address pin of PT2262, namely, floating (high impedance), high level and low level. The output waveforms of different connections are different, as shown in Figure 1. From the figure, we can see that if the oscillation period is a, the width of the narrow pulse is 4a and the interval is 12a; the width of the wide pulse is 12a and the interval is 4a, so the width of a complete bit pulse is 32a.
When in use, the oscillation resistance of PT2262 is about 4 times that of the paired decoding chip PT2272, that is, if the oscillation resistance of PT2272 is 470kΩ, the oscillation resistance of PT2262 can be 2MkΩ. Under this condition, after multiple experiments, it was found that the narrow pulse width emitted by PT2262 is about 250μs, the wide pulse is about 750μs, and the interval between two sets of data is about 6ms.
Figure 1 PT2262 bit pulse waveform
2.3 Encoding
PT2262 has a total of 12 address terminals. Each set of data transmitted consists of 12 bit pulses, in the order from A0, A1... to A11. Since each address terminal has 3 connection methods, there are 312 forms of waveforms output by the data terminal.
3 Software Design Methodology
Take the example of one PT2262 controlling eight lights through eight PT2272s.
3.1 Reset Processing
The problem that cannot be ignored when designing a program is that the program runs from unit 0000H after the first reset after connecting the battery and after the power-off reset when a key is pressed during normal operation. Therefore, different resets should be treated differently.
For the first reset, it can be assumed that all 8 lights are off, and the power-off reset should remember the on/off status of the 8 lights before power-off, so that the lights can be turned on and off accurately when the button is pressed again.
To achieve this goal, we have opened up a memory area in the CPU's RAM, namely 20H, 21H, and 22H, and stored the reset flag in these 3 bytes.
After the first reset, write 20H=55H, 21H=AAH, 22H=00H. The eight bits of 22H correspond to eight lights in order. When a light is turned on, the corresponding bit is sent to "1", and when it is turned off, it is sent to "0". The contents of 21H and 22H units must be checked for each reset. If 20H=55H, 21H=AAH, it means a power-off reset; if the above conditions are not met, it means the first reset. Since the RAM content is random during the first reset, the two-byte reset flag ensures the accuracy of the reset judgment.
3.2 Address encoding
Use 8 bits of 2EH and the upper 4 bits of 2FH to store the 12-bit address A0~A11 state, "1" represents high level, "0" represents low level. At this time, the maximum number of lights that can be controlled is 212. If the third state is required, just use two bits of a byte to represent it, such as "00", "01", and "10" to represent high, low level and high impedance state respectively. At this time, the maximum number of lights that can be controlled is 312.
We designed a circuit to control 8 lights. When using two states, the 9-bit code A3~A10 output by the microcontroller remains unchanged, so that the 9 address termination methods of the 8-chip decoder PT2272 of the 8 lights are completely consistent. A0~A2 determines the address code of the 8 lights, as shown in Table 2.
Each connection method corresponds to the corresponding decoder PT2272 of the receiving lamp. A11 also serves as the data D0 bit. When D0=1, the control lamp is turned on; otherwise, the control lamp is turned off.
3.3 Key-value reading
In order to save power, a 1 millisecond delay is set in the program. Within 1 millisecond, if a key is pressed, the key value will be processed. If no key is pressed, the power-saving state will be entered.
When processing key values, in order to prevent a key press from being processed repeatedly, you need to wait until the key press ends before processing.
There are two contents in key value processing. First, the switch flag bit of the light corresponding to the key is inverted. For example, if the flag byte is set to 23H, when the key AN0 is pressed, 23H.0 is inverted and the inverted result is sent to the storage bit of A11/D0. Then the code of the light corresponding to the key is sent to the storage bit of A0~A2 according to Table 2.
3.4 Analog pulse
The pulse sending program sends 12 consecutive "1", "0" or high-impedance data pulses according to the contents of 2EH and 2FH. The width of the pulse is achieved by delay. In the program, several delay subroutines can be compiled and called by the main program. It should be noted that the delay time must be repeatedly adjusted through multiple experiments.
4 Conclusion
This system has been put into use. It is not only simple in structure, low in price, easy to operate, accurate and flexible in control, but also has good energy-saving effect. It makes up for the limitations of the transmitter chip and makes it more intelligent and ideal. Based on this, the application of single-chip microcomputer in remote control system will be more extensive.
Previous article:Design of Remote Measurement and Control Terminal Based on 80C196KB
Next article:Design of electronic password lock based on single chip microcomputer
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- Share the C language program of FIR filter implemented by MSP430 microcontroller
- [2022 Digi-Key Innovation Design Competition] CAN Communication Data Display Terminal
- Oscilloscope waveform jitter can be turned into stable waveform by setting trigger properly
- How to measure the noise floor of an oscilloscope
- PLC online monitoring control cloud configuration software SCADA
- Is this dime-sized millimeter-wave sensor evaluation board worth trying?
- Xintang M2354 Fault Injection Attack Protection
- Date in spring - go to the beach and relax
- Sub-library: BlueCoin Development Platform
- Power amplifier driving capacitive load case sharing