PORTS Forum

Ports and Interfaces => Parallel Port => Topic started by: BassTeQ on May 28, 2013, 08:31:33 pm

Title: Need some help reading a schematic to work out best way to interface the port.
Post by: BassTeQ on May 28, 2013, 08:31:33 pm
Hi all, I have a schematic (link at end of post), I'm trying to work out the logic required to read/write to/from the attached devices.

Looking at the info at the LPT port, I'm presuming numbers 1-7 are referring to the DATA register, not the actual PIN number, as pin Number 1 on the LPT is a CONTROL pin not a data pin.
And number 14,16,17 are PIN numbers, and are accessed by the CONTROL register.

The way this looks to work, and please correct me if I'm wrong is when one of the CONTROL pins is pulled high it switches the logic to the connected OPTP block. Eg:

The PC's BIOS can set the LPT mode to SPP, EPP or ECP, which would be the best option?

With that assumption what would be the best way drive this logic using inpout32?
I've read I need to set bit 5 to 0 or 1 in the CONTROL register depending if we want the data pins to read or write.
Is this just a matter of sending the decimal value of a binary string "00000100" to the LPT+2 ?

So for instance;


I also read that on the CONTROL register BITS 0,1,3 are inverted, so does this mean when usually I'd need to write a 0 it now needs to be 1?

Sorry If I've confused things in my post, but hopefully by looking at the schematic what I've said might make some sense :P
I greatly appreciate any assistance.

http://i34.photobucket.com/albums/d150/BassTeQ/misc/WiringDiagram_zps84fdcfc6.jpg (http://i34.photobucket.com/albums/d150/BassTeQ/misc/WiringDiagram_zps84fdcfc6.jpg)

Thanks
Title: Re: Need some help reading a schematic to work out best way to interface the port.
Post by: Jan Axelson on May 28, 2013, 10:16:46 pm
You'll have to test (use an ohmmeter) to find out if the schematic is correct.

CONTROL register BITS 0,1,3 are inverted - yes.

Use ECP to enable reading the data port's bits.

I believe you're correct about the rest.
Title: Re: Need some help reading a schematic to work out best way to interface the port.
Post by: BassTeQ on May 28, 2013, 10:56:51 pm
Thanks for the reply!
Great to know I'm on the right track!
Title: Re: Need some help reading a schematic to work out best way to interface the port.
Post by: BassTeQ on June 02, 2013, 09:05:20 pm
Hi just like to check then this logic is correct with inverted bits.

To set ALL bits to LOW I'd need to send "11010000"

To get 5v ONLY from C1, and all other pins remain low I'd need to send "10010000"
To get 5v ONLY from C3, and all other pins remain low I'd need to send "11000000"
To get 5v ONLY from C2, and all other pins remain low I'd need to send "11110000"

Thanks
Title: Re: Need some help reading a schematic to work out best way to interface the port.
Post by: Jan Axelson on June 03, 2013, 03:44:17 pm
You have it backwards, the LSB is on the right:

To set ALL bits to LOW send "00001011"

You can also read the port and use a logical operator to set or clear one (or more) bits.

To write 0 to C1 to set pin C1 high:

Input = Inp(base address + 2)
Output = Input AND 11111101
Title: Re: Need some help reading a schematic to work out best way to interface the port.
Post by: BassTeQ on June 03, 2013, 07:28:25 pm
Thanks Jan,

I didn't realise in my binary to decimal function I already had logic to reverse the string before calculating the decimal value. I'm thinking left to right as it makes more sense logically to me, and the function corrects it :P

Cheers