
public x as long
public val as byte
Public y as byte
Public hour as byte
Public minute as byte
Public seconds as single
Public pin88 as byte 

Sub Main()
Register.DDRH = &H00  ' set the direction
Register.PORTH = &H00 ' turn off pullups

Call PutPin(87, ZXOutputHigh)
Call PutPin(89, ZXOutputHigh)
Call PutPin(86, ZXOutputHigh)   'enable

for x = 1 to 50000000
pin88 = Getpin(88)
'debug.print " pin 88 = " & pin88
If pin88 = 0 then  
Call getval
end if
next
End Sub

Sub getval ()
Call PutPin(86, ZXOutputLow)   'disble
Call GetTime(hour, minute, seconds)
debug.print hour;
debug.print " " & Minute;
debug.print " " & seconds;
debug.print " x = " & x
val = Register.PinH
debug.print "val = " & val
val = Register.PinH
'debug.print "val = " & val 
Call PutPin(89, ZXOutputLow)    'reset latch low does it
Call PutPin(89, ZXOutputHigh)  '
Call PutPin(87, ZXOutputHigh)  'reset count 
Call PutPin(87, ZXOutputLow)     'reset
Call PutPin(86, ZXOutputHigh)   'enable

end sub

