0 Preface
For industrial control microcomputer systems, input device keyboards are almost indispensable. When the number of keys is small, the high and low levels of the key control interface line are generally used directly to indicate, so corresponding interface support is required. Due to the limited number of interface lines in the single-chip industrial control microcomputer system, in order to reduce the occupation of interface lines, one key definition of multiple functions is often used, but this increases the complexity of the software; when the number of keys is large, most of them use dynamic scanning to form a keyboard matrix. Although this keyboard has a simple structure principle and the driver is easy to design, it often takes a lot of time to design the printed circuit board and consider the panel layout in the specific implementation. In addition, when the hardware resources are relatively tight, it is also necessary to consider expanding the I/O port, which makes the circuit more and more complicated.
2. System Introduction
This paper introduces an interface principle and implementation method of using an infrared transmitter as an input keyboard for industrial control computers. This interface can minimize the hardware resource requirements for the single-chip microcomputer system, occupying only one interface line and requiring only a small receiving window on the system panel. The entire interface consists of two parts: the transmitter and the receiver. When the number of keys required for a single-chip industrial control microcomputer system is less than 30, the transmitter can directly use a finished infrared remote control transmitter. If the transmitter is designed by yourself, it can support about 60 keys, of which two keys are used to form a combination key. The interface circuit of the receiver is also very simple and does not require wiring. It only needs to connect the output of the finished module directly to any I/O interface line of the single-chip industrial control microcomputer system. At the same time, the driver is also easy to design. Since the keyboard adopts a wireless method, the single-chip microcomputer formed can easily meet some occasions that require long-distance control, as well as some special occasions, such as: the single-chip industrial control microcomputer system is in a sealed container, and parameters are input or controlled through a small glass window; the surrounding environment of the single-chip industrial control microcomputer is not suitable for close operation by users, etc.
3. Hardware composition of infrared remote control keyboard
The infrared remote control keyboard transmitter circuit composed of the integrated chip PT2248 is shown in Figure 1. 00H~09H are numeric keys, 0AH is the reset key, and 0BH is the cancel key.
Figure 1 Schematic diagram of infrared remote control keyboard transmitter circuit
The infrared remote control keyboard transmitting circuit adopts the pulse time modulation (PPM) method to modulate the remote control command into a pulse sequence and drive the infrared transmitting tube to send it out in the form of light pulses. The remote control command consists of 12-bit code, see Table 1.
Table 1 Remote control command format
C1, C2, C3 are user codes. Connecting diodes between T1, T2, T3 and CODE respectively means C1, C2, C3 are high level "1", and not connecting diodes means low level "0". In Figure 2, C1C2C2=111. D1, D2, D3, D4, D5, D6 are the data codes to be sent. The corresponding relationship between key numbers and key codes is shown in Table 2.
Table 2 Correspondence between key numbers and key codes
The waveform of the PT2248 remote control command is that the duty cycle of the positive pulse is 1/4, which represents "0", and the duty cycle of the positive pulse is 3/4, which represents "0".
Table “1” is shown in Figure 2.
Figure 2 Waveform of remote control command
Whether "0" or "1", the positive pulse is modulated on the 38KHZ carrier during transmission, and the duty cycle of the carrier is 1/3, which is conducive to reducing power consumption. Each transmission cycle is sent serially in the order of C1, C1, C2, H, S1, S2, D1, D2, D3, D4, D5, D6, with a total length of 48a, where a is 1/4 of each bit code period, and its size is: a=192/fosc seconds=192/455KHE=0.422ms. When a key from 00H to 0BH is pressed, the output pin TXOUT sends two cycles of 12-bit code, with an interval of 80a. The infrared remote control keyboard receiving circuit composed of GL3276A is shown in Figure 3.
Figure 3 Schematic diagram of infrared remote control keyboard receiving circuit
When the infrared remote control keyboard receiving circuit is working, after the receiving tube PH302B receives the infrared signal of the remote control command with a carrier frequency of 38KHZ, it will amplify, limit and detect, detect the pulse envelope of the remote control command, filter out the 38KHZ carrier frequency, and obtain the pulse signal of the remote control command. After shaping and reversing, it will be output from OUT. The OUT of GL3276A will be shaped by the 74LS14 Schmitt trigger, and finally the ideal reverse pulse signal of the remote control command will be obtained. The waveform of the reverse pulse signal of the remote control command obtained is that the duty cycle of the positive pulse is 1/4, representing "1", and the duty cycle of the positive pulse is 3/4, representing "0", as shown in Figure 4. Figure 4 Waveform of the reverse pulse signal of the remote control command
4. Software design of infrared remote control keyboard
The OUT output signal of GL3276A is shaped by the two-stage Schmitt inverter of 74LS14 and then connected to P3.2 (/INTO) of 89C51. Since each bit of code has a cycle of 4a, and the start of each bit is always from high level to low level, the decoding process can use the starting edge of each bit of code as the interrupt request signal of /INTO. After the interrupt response, the /INTO interrupt is turned off, and then a/2 is delayed. The output signal of the infrared remote control receiving circuit is sampled by P3.2, and then a is delayed. The sampling is performed at 3a/2, 5a/2, and 7a/2 respectively. The corresponding relationship between the waveform and the sampling time is shown in Figure 5. [page]
Figure 5 Correspondence between waveform and sampling time
As shown in Figure 5, the received "0" is composed of 'low-high-high', and the "1" is composed of 'low-low-high'. When the sampling is completed at 7a/2, the /INTO interrupt is turned on to prepare for the sampling of the next bit code until the /INTO interrupt is 24 times (two cycles of serial 12-bit code). The interrupt service subroutine starts to preset the sample code 0FH, and P3.2 samples the output signal of the infrared remote control receiving circuit at a/2, 3a/2, 5a/2, and 7a/2 respectively. If it is a high level, the sample code remains unchanged. If it is a low level, the corresponding position of the sample code is 0, and finally the sample code is stored in the specified RAM unit.
The reliability of the remote control keyboard is a key issue to be considered in the design of software and hardware. In terms of hardware, the OUT of GL3276A is shaped by 74LS14 Schmitt to improve the anti-interference ability. In terms of software, to decode correctly, it is necessary to start receiving from the start bit of each bit of the code. In this design, the start code of the remote control command sent by PT2248 is the user code C1C2C3=111. Because the "1" received by P3.2 is composed of 'low low low high', the received code should be three "0001". If not, this reception is invalid. Secondly, in order to prevent receiving errors, the 12-bit serial codes of the two cycles received twice before and after should be compared for consistency. If they are the same, they should be compared with the key code in the key code table to find the corresponding key number, otherwise this reception is invalid. See Figure 6 for the flowchart of the decoding program.
Figure 6 Decoding program flow chart
5. Conclusion
This article introduces an interface principle and method of using an infrared remote control as a microcontroller input keyboard. The design is ingenious, the structure is reasonable, and the cost is low. We have successfully used this interface method to realize the wireless operation of the microcontroller keyboard. In this article, the PT2248 integrated chip is used as the transmitting part. For other types of transmitting chips, this interface principle is still applicable. You only need to modify the interrupt service program accordingly. If the microcontroller system has extra external interrupt resources, the received signal can be input to the interrupt pin. By combining the external interrupt with the timer, the CPU time occupied during the receiving process can be reduced. Using this technology, we have achieved good application in the "Development of Intelligent Milk Quality Rapid Detector" project.
Remote control technology has gone through wired remote control, radio wave remote control, and now infrared remote control. The technology is quite mature, with more and more powerful functions, more and more stable operation, and more and more extensive applications. If advanced remote control technology is used in industrial control with single-chip microcomputers, the operation of the control system will become easier, faster, more convenient, and safer.
references
[1] Chen Mingying, 8051 Microcontroller Course Design, Tsinghua University Press, 2004
[2] Qiushi Technology Microcontroller Typical Module Design Example Navigation? People's Posts and Telecommunications Press, 2004
[3] Li Jianhua, Principles and Production of Practical Remote Control, Posts and Telecommunications Press, 1996.
[4] Zheng Fengyi, Principles and Maintenance of Color TV Remote Control System, Posts and Telecommunications Press, 1997.
[5] Fan Changxin, Zhang Puxu, Xu Bingxiang, and Wu Chengke, Principles of Communications, National Defense Industry Press, 2001.
[6] Wang Ting, Microcontroller Decoding Technology for Color TV Remote Controls, Publishing House of Electronics Industry, 1997.
Previous article:Interface design of bank queuing system based on I2C bus
Next article:Inkjet Printer Control Technology Based on 51 Single Chip Microcomputer
Recommended ReadingLatest update time:2024-11-16 15:27
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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
- Pointer variables as function parameters
- Transistor one-button switch circuit
- Analysis and application of key technologies of BLE low-power Bluetooth
- Power-saving Mode of ADI AD5933 Impedance Converter
- "New Concept Analog Circuit" - Signal Processing Circuit, Yang Jianguo's new book
- How to use the IP of Video On-Screen Display in zynq
- STM32F103 brushless DC motor control program
- [GD32E231 DIY Contest] Part 2: Dynamic QR Code Display
- EEWORLD University ----PI power chip: Learn about BridgeSwitch in one minute
- CCS compilation optimization and volatile