I've got custom hardware attached to the parallel port. The firmware is being developed to Tx/Rx data using EPP.
I'm familiar with the protocol and have read "Parallel Port Complete" and beyondlogic.com, etc.
I currently am trying inpout32.dll (logix4u.cjb.net) under WinXP to write a byte to the device using EPP: Here's my code:
'Initialize Control Register
Call Out(Control, 4)
'Make sure port is "ready"
RxB = Inp(Status)
If RxB And &H80 = &H80 Then Debug.Print "Port Ready"
'Clear_EPP_Timeout
Call Out(Status, 0)
Call Out(Status, 1)
RxB = Inp(Status)
'Set to EPP Mode
'Set the highest 3 bits to match the selected mode.
ecpMode = 4
ecrdata = (ecrdata And &H1F) + ecpMode * &H20
'Write the result back to the ECR.
Call Out(ECR, ecrdata)
'Setup Port - Set to OUTPUT
RxB = Inp(Control)
RxB = RxB And &HDF
Call Out(Control, RxB)
'Send Byte
Call Out(EPPAddress, &H88) 'Send byte to parport
RxB = Inp(EPPAddress)
'Check for timeout
RxB = Inp(Status)
RxB = RxB And 1
If RxB = 1 Then Debug.Print "Timeout"
The problem is that After writing the byte to the EPPAddress register, "DataStrobe" (Pin14) never goes low. As I understand it, the parport hardware should handle all the handshaking and should bring DataStrobe low to start the xfer. The device on the port initializes by keeping "Wait" Pin 11 low.
As an alternative solution, how can I call the standard Windows device driver (parport.sys?) to send a byte over the parallel port via EPP under VB6. I understand it requires some CreateFile() and DeviceIOCtl() calls but code would be helpful.
Thanks in advance!
Start Free Trial