1 Introduction In the development process of many single-chip control systems, in order to achieve the best control state and the highest technical performance of the control system, it is essential to repeatedly and carefully adjust the control parameters online. In the past, the human-computer dialogue between the single-chip microcomputer and the outside world was realized through the programmable keyboard display interface device 8279, but the addition of 8279 occupied a large amount of program space, some of which were nearly one-third of the entire program. In addition, it was not convenient to use the small keyboard to make small corrections to the control parameters. Furthermore, product developers are very interested in the calculation process inside the control system. If the calculation results of each step can be transmitted for analysis and inspection, it will definitely benefit product development. Although serial communication between the microcontroller and the PC can also realize data exchange between the microcontroller and the PC, the speed is relatively low (up to 19200byte/s), which cannot meet the requirements of real-time transmission of large amounts of data. For this reason, a method of using the dual-port RAM IDT7132 and the parallel printer interface of the PC to realize parallel communication between the microcontroller and the PC was developed. This method can be used by simply connecting to the PC printer interface through the interface circuit, and the communication speed can also meet the requirements.
Figure 1 IDT7132 structure and function block diagram 2 Structure and Features of Dual-Port RAM IDT7132 IDT's dual-port RAM timing is compatible with INTEL's single-chip microcomputer system and is compatible with the popular MCS-98/96 series single-chip microcomputers. It is particularly suitable for high-speed two-way transmission of large amounts of data between single-chip microcomputers and single-chip microcomputers, and between single-chip microcomputers and PCs. IDT7132 is a high-speed 2K×8 CMOS dual-port static RAM. It provides two independent ports with their own control, address and I/O pins, which can independently read and write any unit in the memory. IDT7132 also has an on-chip hardware port bus arbitration circuit, which provides a BUSY bus arbitration mode, allowing two machines to synchronously read or write any unit in the memory while ensuring data integrity. See Figure 1 for the IDT7132 structure and function block diagram, and the non-competitive read and write control is shown in Table 1. |
|
Left or right port | Function | |||
R/ | D0-7 | |||
X | H | X | Z | Power-down mode |
L | L | X | Data Entry | Data written to memory |
H | L | L | Data Output | Data output from memory |
H | L | H | Z | Output is high impedance |
Note: L = low level, H = high level, X = any, Z = high impedance |
Figure 3 Hardware interface circuit 3 The functions of the signals of the PC parallel printer interface PCs are equipped with a standard CENTRONICS parallel printer adapter interface, which has long been used as a printer interface. Through analysis, it is found that it can also be used as a general I/O parallel port. By controlling the three I/O ports in the adapter, the input and output of data and control signals can be realized [1]. The following describes the functions of each I/O port and each pin of the parallel port. The PC parallel printer adapter interface has 8-bit data input and output lines, which can read and write data on the external leads through the read and write 378H I/O port. A write operation to this port means that an 8-bit data is written to an 8-bit register latched and output to the external leads. A read operation to this port only reads the value latched in the output register by the write operation, so the read operation can only be used for the self-test of the printer interface. For dual-machine communication, the 8-bit data line can only play the role of sending data from the PC to the outside. The PC parallel printer adapter interface has five control signal output lines. The control signal can be output to the external lead by writing to the 37AH I/O port. The output signal is also latched by the register. The control word format is shown in Table 2. |
|
Output Data | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
External lead | X | X | X | IRQEN | INIT |
The PC parallel printer adapter interface has five status input lines. The status signals on the external leads can be read into the PC by reading the 379H I/O port. The correspondence between the port input buffer and the status input lines is shown in Table 3. Table 3 379H I/O port status signal format |
Input Data | D7 | D6 | D5 | D4 | D3 | D2 | D1 | D0 |
External lead | BUSY | PE | SLCT | X | X | X |
For two-machine communication, the PC can read data through this port, and generally only uses the 4 bits D4 to D7. In addition, since the BUSY signal at D7 is inverted, a NOT gate can be connected to correct it. Note: If the interrupt mode is used, the interrupt request signal must be introduced from the D6 bit ACK, then the input data line can only use D3, D4, D5, and D7, and the data reorganization is a little troublesome. 4 Hardware interface circuit design The principle block diagram of the parallel communication is shown in FIG2 , which is composed of a PC, a parallel communication interface, and a single-chip control system including a dual-port RAM.
Figure 2 Parallel communication principle block diagram The parallel communication between the single-chip control system and the PC is realized by reading and writing the dual-port RAM. The single-chip access to the dual-port RAM is no different from the off-chip expansion RAM, while the PC side needs to design an interface circuit to read and write the dual-port RAM. From the above analysis, it can be seen that the PC parallel printer adapter interface has 13 output lines and 5 input lines for accessing the dual-port RAM, and the address bus width of the dual-port RAM IDT7132 is 11 bits and the data bus width is 8 bits. Therefore, the latch 74LS373 must be used to share the address and data buses, and the dual-way switch 74LS157 must be used to read the 8-bit data of IDT7132 into the PC twice. The hardware interface circuit is shown in Figure 3. The control word, address, and output data of the port RAM are all sent by the PC writing to the 378H port. The latch commands of the three 74LS373s and the control commands of the 74LS157 are implemented by writing to the 37A port. Also note: When the PC reads data from the dual-port RAM, H3 should be controlled to a high level so that the H3 output is in a high-impedance state to avoid affecting the read data. When the PC writes data to the dual-port RAM, H3 should be at a low level. To meet the real-time requirements, the chip select signal on the right side of the dual-port RAM can be connected to (as shown by the dotted line in the figure), and the PC print interrupt IRQ7 is used to perform parallel communication in interrupt mode. The microcontroller control system is the active party. The microcontroller writes various data into the dual-port RAM at the end of each control cycle, and then issues an interrupt request. 5 Software Design
Below are two functions written in Turbo C2.0 for read and write operations in a non-interrupt manner.
6 Conclusion The parallel communication between the single-chip microcomputer and the PC is realized by using the dual-port RAM and the parallel printer interface of the PC. It has the advantages of simple interface circuit, no need to make any changes to the PC side, easy to implement and fast communication speed. The communication rate of the PC with 486DX4/100 CPU can reach 30kbyte/s, which greatly exceeds the serial communication. This solution has been successfully applied to the development of the digital electronic speed governor of the locomotive diesel engine with MCS196KC as the control core. The retained historical data has laid the foundation for further improving the performance of the speed governor, especially the control algorithm. In addition, this solution is combined with a laptop computer and is expected to be expanded into a portable debugging and monitoring tool in the future digital electronic speed governor products.
References
|
Previous article:The Realization of MCS-51 Single Chip Microcomputer Accessing Ultra-Large Capacity Memory
Next article:The interface method between MCS-51 single chip microcomputer and two-wire serial E2PROM
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
- How to analyze the role of this diode in the MOS tube perfusion circuit?
- FPGA_100 Days Journey_2-choose-one data selector.pdf
- 【ST NUCLEO-H743ZI Review】Testing LWIP (2)
- [RVB2601 Creative Application Development] Successfully connected to Alibaba Cloud
- Designed by TouchGFX——by y909334873
- High-frequency PCB design for DSP systems
- How to prepare for the National Undergraduate Electronic Design Competition? This article explains it all
- RSL10-002GEVB expansion board design
- [GD32E231 DIY Contest] 1. Unpacking the product
- Urgently seeking online measurement method of ground resistance of fuel dispenser