Here it is:'INPUT CHANNEL MONITOR WITH DATALOGGER
'GJ Fleming
'4 Nov 2006
'using 7 seg display driver 4026 (2 inputs)
'7 segment display runs through while scanning for high input on channels
'each channel LED lights while scanning through
'channel input will stay high if activated by latching relay (until manually released)
'when high input occurs, channel LED latches on (until hard reset)
init:
let pins=%00000000
let pinsc=%00000000
main:
let b0=0
let b1=1
let b2=2
let b3=3
let b4=4
let b5=5
scanning:
sertxd("SCANNING! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",cr,lf)
scan:
high 2 'turn on LED 1
if pin1 = 1 then show_1
gosub thump1 'display 1
low 2 'turn off LED 1
high 3 'turn on LED 2
if pin2 = 1 then show_2
gosub thmpadv 'display 2
low 3 'turn off LED 2
high 4 'turn on LED 3
if pin3 = 1 then show_3
gosub thmpadv 'display 3
low 4 'turn off LED 3
high 5 'turn on LED 4
if pin4 = 1 then show_4
gosub thmpadv 'display 4
low 5 'turn off LED 4
high 6 'turn on LED 5
if pin5 = 1 then show_5
gosub thmpadv 'display 5
low 6 'turn off LED 5
goto scan
display:
show_1:
gosub thump1
if pin1 = 0 then show_2
sertxd("Channel 1 activated",cr,lf)
high 2 'latch chan1 LED
pause 1000 'pause chan1 display
show_2:
gosub thmpadv
if pin2 = 0 then show_3
sertxd("Channel 2 activated",cr,lf)
high 3 'latch chan2 LED
pause 1000 'pause chan2 display
show_3:
gosub thmpadv
if pin3 = 0 then show_4
sertxd("Channel 3 activated",cr,lf)
high 4 'latch chan3 LED
pause 1000 'pause chan3 display
show_4:
gosub thmpadv
if pin4 = 0 then show_5
sertxd("Channel 4 activated",cr,lf)
high 5 'latch chan4 LED
pause 1000 'pause chan4 display
show_5:
gosub thmpadv
if pin5 = 0 then display
sertxd("Channel 5 activated",cr,lf)
high 6 'latch chan5 LED
pause 1000 'pause chan5 display
goto display
thmpadv: 'thump advance (pulse increment up one)
for b3 = 1 to b1
pulsout 1,10
next b3
return
thump1: 'reset display to zero & pulse to show 1
pulsout 1,10
for b3 = 1 to b1
pulsout 0,10
next b3
return