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:
- set pin 14 high it will enable opto #3 and the DATA pins will need to READ the value
- set pin 16 high it will enable opto #1 and the DATA pins will need to WRITE
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;
- To read from OPTO block #3, I'd need to send "01000100" to LPT+2 to enable reading on the DATA pins as well as setting PIN 14 (C1) so the correct OPTO is enabled. Now I can READ the DATA pins values
- To write to OPTO block #1, I'd need to send "00100000" to LPT+2 to enable writing on the DATA pins as well as setting PIN 16 (C2) so the correct OPTO is enabled, then I can WRITE a value to the DATA pins.
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
I greatly appreciate any assistance.
http://i34.photobucket.com/albums/d150/BassTeQ/misc/WiringDiagram_zps84fdcfc6.jpgThanks