I have had trouble with some of the handshaking signals not seeming to work properly. So I wrote some code to read out the signal states when needed.
But when I use GetPin(), it appears to reset the SetPin() settings it once had. Here is the code:
Code: Select all
'Handshaking pins
#Define NDAC 12
'12 'Green
#Define DAV 14
'14 'Red
#Define NRFD 16
'16 'Yellow
Sub Main()
Call PutPin(NDAC,0)
call sleep (1.0)
Call PutPin(NDAC,1)
call Sleep(1.0)
Call PutPin(DAV,zxOutputLow)
Call PutPin(NRFD,zxOutputLow)
Call PutPin(NDAC,zxOutputLow)
Debug.print(Chr(10)+chr(13)+"testing all asserted")
Call GPIBSendState()
call sleep(5.0)
Call PutPin(DAV,zxOutputHigh)
Call PutPin(NRFD,zxOutputHigh)
Call PutPin(NDAC,zxOutputHigh)
Debug.print(Chr(10)+chr(13)+"testing all released")
Call GPIBSendState()
call sleep(5.0)
Call PutPin(DAV,zxInputTristate)
Call PutPin(NRFD,zxInputTristate)
Call PutPin(NDAC,zxInputTristate)
Debug.print(Chr(10)+chr(13)+"testing all cleared")
Call GPIBSendState()
end sub
'**************************************
'
'
'*************************************
sub GPIBSendState()
dim x as byte = 0
dim cnt as byte =0
for x=1 to 10
if GetPin(DAV)=1 then cnt = cnt+1
next x
Debug.print(Chr(10)+Chr(13) + "DAV:")
if (cnt = 0) then Debug.print("ASSERTED ")
if (cnt = 10) then Debug.print("RELEASED ")
if ((cnt > 0) and (cnt < 10)) then Debug.print("CHANGING ")
cnt = 0
for x=1 to 10
if GetPin(NDAC)=1 then cnt = cnt+1
next x
Debug.print(" NDAC:")
if (cnt = 0) then Debug.print("ASSERTED ")
if (cnt = 10) then Debug.print("RELEASED ")
if ((cnt > 0) and (cnt < 10)) then Debug.print("CHANGING ")
cnt = 0
for x=1 to 10
if GetPin(NRFD)=1 then cnt = cnt+1
next x
Debug.print(" NRFD:")
if (cnt = 0) then Debug.print("ASSERTED ")
if (cnt = 10) then Debug.print("RELEASED ")
if ((cnt > 0) and (cnt < 10)) then Debug.print("CHANGING ")
cnt = 0
end sub