Data Acquisition System Based on Printer Parallel Interface

Publisher:lxy64420245Latest update time:2010-09-05 Keywords:Printer Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

In the construction field such as road and bridge construction, there are many raw material processing control equipment imported from abroad. The operating system on these devices is not the common WINDOWS operating system. Although it can realize the data printing function, these data cannot be stored in the management PC of the WINDOWS operating system as files, so it is not convenient to count and analyze these data, which seriously affects the management efficiency. For this reason, it is necessary to expand the functions of these devices so that they can store the required data as required and provide corresponding data analysis and processing functions, so as to facilitate the work of the management department and improve production efficiency and project management quality.

Solution Analysis

Under the premise of not affecting the normal operation of the original equipment, the data collection function of the parallel printer is completed. The following two solutions are considered:

(1) After the data is output to the printed paper, use the scanner to identify the data on the printed paper and input the identified data into the data management software of the management PC.

(2) Add a data acquisition device between the control device and the printer. The device intercepts data from the parallel port of the control device connected to the printer and completes the data forwarding to the management PC. The management PC is responsible for receiving, counting and analyzing data, as shown in Figure 1.


Figure 1 Schematic diagram of data collection scheme

Compared with the above two solutions, solution (1) requires regular manual operation of the scanner, which is labor-intensive and requires high investment, and it is impossible to guarantee that the data will be completely correctly identified. The data acquisition device in solution (2) can be completely independent of human intervention, is easy to use, and has a high cost-effectiveness. Therefore, solution (2) is adopted.

In March 1994, the IEEE committee announced the new IEEE1284 parallel interface standard, which defines five working modes of the parallel port. These five modes are Centronics compatible mode (also called standard mode), byte transfer mode, nibble transfer mode, enhanced parallel port (EPP) mode, and extended function port (ECP) mode. The parallel port connected to the printer usually works in Centronics compatible mode, and the other four modes are fully compatible with the parallel port pin definition of this mode. Therefore, the data acquisition system is designed according to the characteristics of this mode, which is also conducive to the expansion and upgrading of other parallel port equipment data acquisition systems in the future.

There are two types of parallel ports: 25-pin and 36-pin. The printer is equipped with a 36-pin standard plug and socket, which actually only uses the signals in the 25-pin plug and socket. The 25-pin signals can be divided into three categories: data signals, control signals, and status signals.

The fastest communication speed of Centronics parallel port can only reach 150kB/S. The author tested the control device and the target printer EPSON LQ-1600K III and found that the communication speed between the two is 50kB/S.

Hardware Design

According to the working characteristics of the parallel port, the author uses a hardware circuit with a 51 series single-chip microcomputer as the core to complete the parallel port data acquisition and forwarding functions. The system circuit block diagram is shown in Figure 2, which mainly includes 6 components:

(1) Central Processing Unit. The communication speed between the control device and the printer is not very high, so the cost-effective AT89C52 is used as the core processing unit. The chip includes 256 bytes of RAM, most of which can be used as a data receiving buffer, so there is no need to expand the RAM unit. The STROBE signal is used as the external interrupt source 0. Whenever the falling edge of the STROBE signal appears, it indicates that the data is in a valid state, and the CPU reads the collected data through the P1 port. The operating frequency of the CPU is selected at 22.1184MHz to ensure that there is a sufficiently long interrupt program response time.

(2) Signal preprocessing. The acquisition system cannot affect the normal operation of the control equipment and printer, so the parallel port input signal needs to be buffered and optically isolated. The buffer chip is 74HC245 and the optical coupler is 6N137.

(3) Data latch. The data retention time of the data line on the parallel port is very short. The latch unit ensures the accuracy of the data read by the CPU each time. The latch chip is 74HC573.

(4) Watchdog and power supply monitoring: The X5045 chip is selected to complete the functions of system power-on reset, system crash reset and power supply voltage abnormality reset.

(5) Communication circuit: The MAX232 asynchronous communication interface chip is used here to complete the function of forwarding data to the management PC.

(6) Power supply. This part is responsible for providing the required power to each circuit module.


Figure 2 System circuit block diagram

The main circuit diagram of the hardware design is shown in Figure 3.


Figure 3 Main hardware circuit diagram of the system

Software Design


Figure 4 Program flow chart

Figure 4 is a flow chart of the microcontroller program. The program consists of a main program and an interrupt service program. The interrupt service program is responsible for timely collecting valid data sent to the parallel port by the receiving control device and storing it in the buffer. The main program is mainly responsible for serial communication with the management PC and forwarding the data in the buffer. In this way, the management PC only needs to use a visual programming language to implement a software with data reception and file storage functions to lay the foundation for future data statistics and analysis.

Conclusion

Based on the analysis of the working characteristics of the parallel printing interface, this paper designs a parallel port data acquisition system with 51 single chip microcomputer as the core. This system has been successfully applied to several construction units of expressways. The operation experience shows that the design is simple, stable and reliable, which greatly facilitates the construction units to count and analyze various raw material data.

Keywords:Printer Reference address:Data Acquisition System Based on Printer Parallel Interface

Previous article:Simulation of High Power Factor Rectifier Based on Single Cycle Control
Next article:Design of LD driver power supply with adjustable continuous or pulse output power

Latest Analog Electronics Articles
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号