Robot Pemadam Api (KRCI) dengan UVTRON.OSC

'

' UVTron Example for OOPic

'

dim uvOut as new oDio1 ' flame indicator

dim uvIn as new oDio1 ' UVTron input

dim uvPEvent as new oEvent ' UV pulse event

dim uvTEvent as new oEvent ' 1-second timer event

dim uvGate1 as new oGate ' UV event buffer

dim uvGate2 as new oGate ' Timer event buffer

dim uvCt as new oByte ' user pulse ct

dim uvCtx as new oByte ' temporary pulse ct

sub main()

call inituv

uvOut.ioline=17

uvOut.direction=cvOutput

do

if (uvCt >= 4) then

uvOut=1

else

uvOut=0

end if

loop

end sub

'------------------------------------------------------

' Event-Driven UVTron Monitoring routines

' uvCt is number of UVTron pulses per second

' (4 is a good flame threshold for stock UVTron)

'

sub inituv()

uvIn.ioline=8

uvIn.direction=cvInput

uvGate1.input1.link(uvIn)

uvGate1.output.link(uvPEvent.operate)

uvGate1.operate=cvtrue

uvGate2.input1.link(oopic.hz1)

uvGate2.output.link(uvTEvent.operate)

uvGate2.operate=cvtrue

uvCtx=0

uvCt=0

end sub

sub uvPEvent_code()

uvCtx=uvCtx+1

end sub

sub uvTEvent_code()

uvCt=uvCtx

uvCtx=0

end sub

Tidak ada komentar:

Posting Komentar