Whoops, sorry about that!
here's the code:
oSCCON = %01100000 ' Ocs set to 4 MHz
TRISIO = %00000000 ' Set all ports to outputs, in this example
CMCON0 = 7 ' Analog comparators off
ANSEL = 0 ' Analog select set to digital, pg 69 data
ADCON0 = 0 ' A/D turned OFF, pg 68 of data
input gpio.4
inpulse VAR Word
memory var word
low gpio.4
low gpio.3
start:
SEROUT 0, 2, [12]
start2:
PULSIN 1, 1, inpulse
if inpulse<50 then
read 5, memory
serout 0,2,[12,17, "Activating",13,"Failsafe :", #memory*10]
goto start2
else
endif
if gpio.4=1 then
write 5, inpulse
serout 0,2,[12,17,"Failsafe",13,"Stored :", #inpulse*10]
high gpio.3
low gpio.4
else
low gpio.3
endif
SEROUT 0, 2, [17,22,#inpulse*10]
PAUSE 20
GOTO start
END




Bookmarks