I want to create a program to count the number of times the d0 pin of the parallel port goes from high to low and have this code so far. I tried sending +6V in pulses to d0 and its not counting, please help me out.
In both DOS and Windows there are functions available that return the installed parallel port addresses, you should use those functions to allocate your actual address!.
I also believe that programs have direct access to hardware
I don't use C, but a standard parallel port is unidirectional (it's only an output), for inputs you need to use some of the handshake lines, or use the port in a bidirectional mode - there is LOT'S of information about this on the net!.
Some PC systems do not support bi-direction data register (0x378 in - out), you can check it through PC's BIOS setting whether it has ECP standards (bi-direction port) or SPP (one direction output only).
that beyond logic site that instruite gave is loaded with info on the parallel port..
and please be careful you dont damage your motherboard ,it is not fun..
I want to create a program to count the number of times the d0 pin of the parallel port goes from high to low and have this code so far. I tried sending +6V in pulses to d0 and its not counting, please help me out.
I used a 9V battery with the + terminal connected to a 22k resistor(multimeter reads 5V) before connecting to a status pin of the parallel port(tried 13, 15) and the ground from the battery to a ground in the parallel port(pins 18-25 ?)
I used a 9V battery with the + terminal connected to a 22k resistor(multimeter reads 5V) before connecting to a status pin of the parallel port(tried 13, 15) and the ground from the battery to a ground in the parallel port(pins 18-25 ?)
I assume that when you say before connecting to status pin then you connected your multimeter at open end of 22K resistor and ground
In this case the multimeter should read 9V and not 5V?
If my assumption is correct then either check your multimeter or your battery.
you have tied pin 13 and 15 to battery which means bit S4 and S3 are set to HIGH
you are getting data Decimal (120) = Hex ( 78 ) = BCD (0111 1000) = (/S7 S6 S5 S4 S3 - - - )
from above statement S4 = S3 = 1 which is correct
I guess you have left pins 10, 11, 12 open so which makes the pin state HIGH and its giving the corresponding data
I just want to use a single pin(including ground of course) but want I ment was that I tRied(NOT tied lol) pins 13 and 15 and that I keep getting an output value in my program of 120, regardless if I set voltage on or off to a pin.
Whats this value(120) supposed to mean, could it be an error code :?:
Setting a voltage on or off may be (give ) the same results..
it depends on how you are doing it..
as instruite said your parallel port (input) pins float high ..
SO if you want to read a low you must ground the input pin (Through a resistor is probably best )...
as you can see this value is the basic value which you will get if you dont connect anything to the parallel port or connect them to logic HIGH (because all the inputs float to high)
So if you want to check the working of your software you need to assure logic LOW at your port
which you can do as suggested by WilliB (connect the port pin to ground using a resistor
It is good if you use the regulator IC but you can do it without the IC also
Since you have a 9V battery just make a voltage divider network such that it will suppy 5V to the port input
If you use the switch to ON/OFF the port then make sure switch is after the Ground resistor (one connecte to ground and port)