program bec/aprins/stins
' Declarations section
main:
dim stare1 as byte
C1ON_bit = 0
C2ON_bit = 0
PORTD.4 = 0
PORTC = 255
TRISC = 255
TRISD = 0
ANSEL = 0
ANSELH = 0
stare1 = 0
start:
IF (Button(PORTC,2,50,1)) and (stare1 = 0) then
PORTD.4=1
DELAY_ms(50)
goto asteapta1
end if
IF (Button(PORTC,2,50,1)) and (stare1 = 1) then
PORTD.4=0
DELAY_ms(50)
goto asteapta2
end if
goto start
asteapta1:
if (Button(PORTC,2,50,0)) then
stare1 = 1
DELAY_ms(50)
goto start
end if
goto asteapta1
asteapta2:
if (Button(PORTC,2,50,0)) then
stare1 = 0
DELAY_ms(50)
goto start
end if
goto asteapta2
end.
Niciun comentariu:
Trimiteți un comentariu