Questioning the use of the printer port to read and write memory 24cxx

Publisher:心想的45号Latest update time:2012-06-06 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Many electronics enthusiasts have read such an article: "A Practical Serial E2PROM Reading and Writing Software - 24Cxx", and some enthusiasts have also made the circuit by themselves. The software can use the output port 378H port and the input port 379H on the computer's printer port to read and write the memory 24cxx. Port 378H is an output port, corresponding to pins 2 to 9 of the computer's printer port. After my trial, the effect is quite good. But once I did a few small experiments on the computer's printer port, I couldn't help but break out in a cold sweat! Now write it out and discuss it with the capital:

Test 1: Observe the level changes of the computer printer port during the startup process

Specific steps: Use the following circuit, connect it to the computer print port, and observe the changes in the brightness of each LED.

Observation results: During the self-test phase of the machine, the 8 LEDs connected to the output port 378H on the printer port kept flashing; during the Windows 98 startup process, these LEDs also flashed a few times. The LEDs were sometimes on and sometimes off, and the naked eye could not tell the pattern. After Windows 98 was started, the LEDs of each machine were also on and off differently.

Observation conclusion: Due to different machine hardware and operating systems, the electrical levels of the output lines of port 378H on the printer port are irregular.

Experiment 2: Write a program to read data from the printer port

Specific steps: Use the programming software Delphi under Windows 98 to write a code to read the data on the printer port: After starting Delphi , put a button button1 in the design form , double-click the button, switch to the code window, and you can see that Delphi has prepared a framework for us:

procedure Tform1.Button1Click(Sender: Tobject);

begin

end;

We add the variable declaration on the line before begin : var t:byte;

Enter the following code between begin and end :

asm mov dx , $378

in al , dx

mov t , al

end;

form1.Button1.Caption:=inttostr(t);

After running the program, we can read the data of port 378H on the printer port at any time . [page]

Observation results: Taking one time as an example, after pressing button1 , the number displayed on the button is the data read from the port, which is 108. Using the "Calculator" program that comes with Windows , we convert this decimal number into a binary number, which is " 01101100 "; at the same time, we observe that the on and off conditions of the light emitting diodes connected to the printer port are: "off, off, on, off, on, off, on, off".

Observation conclusion: This time the electrical levels of pins 2 to 9 on the print port are: "low-low-high-high-low-high-low".

Test three: Test the input and output current capabilities of the printer port.

Specific steps: Set the pointer multimeter to the 25 mA position, connect the black test lead to a low-level end of the print port, and momentarily touch the red test lead to a high-level end.

Observation results : If the high and low level terminals are directly connected, the current must be greater than 10 mA.

Now let's go back and look at the circuit that is widely circulated on the Internet, which uses the printer port to read and write memory:

In this circuit, in order to provide enough current to the IC , the 4th , 5th , 6th and 7th pins of the printer port may be connected together.

Potential danger: If the circuit is connected to the computer's printer port when the printer port reading and writing software is not started or even when the computer power is not turned on, then there will be a period of time after the computer is turned on when the levels of the 4567 pins on the printer port are high or low. The high level end tries to output current, and the low level tries to absorb current. Who knows when the printer port will be written off! However, if the printer port reading and writing software is started, I measured that the four pins 4567 on the printer port are all high.

The environment in which I conducted the experiment is:

Mingzhi M748MR motherboard, Celeron 400 CPU

Windows 98 SE

The Delphi versions used were 5.0 , 6.0 and 7.0 , and the above programs were all successful.

I secretly felt lucky that I didn't use my newly bought computer for the test, and I was also lucky that my old motherboard didn't break down. What is the rated input and output current of the printer port? Will the above circuit damage the printer port of the computer? I hope the experts can give me some advice!

Long, long ago, on the computer motherboard, the 378H port of the printer port used an IC such as 74LS374 . This IC is relatively strong, and even if it breaks, it can be replaced. But it seems that this IC is no longer found on the current motherboard. If the printer port is broken one day, it will be a big trouble. If audiophiles are still using the above circuit, I suggest that a diode be connected to each pin 4567 on the computer printer port , and the negative lead end of the diode is connected to the Vcc power supply end of 24cxx , so as to completely prevent current backflow!

Reference address:Questioning the use of the printer port to read and write memory 24cxx

Previous article:Design of High-Speed ​​Serial Data Acquisition System Based on McBSP
Next article:Design of multi-channel read-write SDRAM interface

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号