This is a simple routine of sending and reading a byte from the LPT1 port under Windows XP.
LPT port has four types of pins:
- 8 output pins accessed via the DATA Port
- 5 input pins (one inverted) accessed via the STATUS Port
- 4 output pins (three inverted) accessed via the CONTROL Port
- The remaining 8 pins are grounded
![LPT_pinout](https://scienceprog.com/wp-content/uploads/2021/01/image-125.gif)
Now we are interested in Data pins.
I have written and compiled examples under the DEV-CPP tool-set, which you can download from https://www.bloodshed.net/.
Start New console project
![New_DEV_CPP_Proj.PNG](https://scienceprog.com/wp-content/uploads/2021/01/image-96.png)
Create a new CPP file and save it to the project directory. Also, copy porttalk_IOCTL.h and pt_ioctl.c files to project directory. These files you will find in the package portalk22.zip.
Test program:
![sample_LPT1_XP.PNG](https://scienceprog.com/wp-content/uploads/2021/01/image-97.png)
Compile this program and run it. You should see results like this:
![running_ports_on_XP.PNG](https://scienceprog.com/wp-content/uploads/2021/01/image-98.png)
Now it is time to connect your microcontroller and start experimenting. Good luck.
Test routine project files for DEV-CPP are here: LPT1 Sample Project
Thanks!
i am just looking for this.Thanks for you sharing
it.
Thank you very much! It was very useful for me!