Quantcast
Channel: MachineGrid » parallel port
Viewing all articles
Browse latest Browse all 2

Parallel Port Tutorial – Part 2 (Handling Inputs)

$
0
0

Disclaimer : The information provided here is correct to my best knowledge.You may use it at your own risk.
This is a followup of the first tutorial which described using the port as an output. This tutorial demonstrates how to use the parallel port as an input. This feature is a great help in robotics as it is used to collect data of what the robot really is encountering.

The INPUT PINS

Picture Courtesy :: Ian Harries

The 10,11,12,13,15 pins of the STATUS PORT are the basic input pins.

Though the CONTROL PORT pins can also be used as inputs,only accessing the status pins are described here.Follow these steps to read an input


Step1
Construct the following TEST circuit.
In this example I have taken pin 13 of the STATUS port as an input.
WARNING   Please do not feed your port more than 5V.You’ll blow it up.
Check all the voltages with a Multimeter before proceeding




Step2
Fire up your C compiler and typre the following program:


The program scans the STATUS[0x379] port and give an appropriate integer number,depending on what combinations of pins have gone high or low.
In this example ,since I have used pin 13 and connected to a high value i.e a binary “1″, I get a value of “127″ on my PC. Please note that this number will differ from PC to PC. Now we test for a Low value i.e a binary “0″. Modify the above circuit as shown below:

Short pin13 to GND.
When you do this and run the above program ,you get a different number.
On my PC ,i get a “230″

Step3
Now using a simple switch case statement you can monitor the input at pin13.

When pin13 is set HIGH:

When pin13is set LOW:

This is for monitoring a particular pin.
You can use all the status pins as inputs ,note down the numbers for different combinations and then write your program.Please note that the 11th pin is inverted i.e If u give a HIGH to it ,the port reads it as LOW.
That’s it for the parallel port inputs.

No related posts.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images