program adsf
dim counter,counter2 as longword
sub procedure Interrupt()
Inc(counter)
Inc(counter2) ' Increment value of counter on every interrupt
TMR0 = 0
INTCON = 0x20 ' Set T0IE, clear T0IF
end sub
sub procedure aa()
select case counter
CASE 50
portb.0 = 1
CASE 100
portB.0 = 0
counter = 0
end select
end sub
sub procedure button1()
if portc.0 = 1 then
counter2 = 0
aa()
end if
if counter2 = 200 then
counter2 = 0
end if
end sub
sub procedure init_main()
OPTION_REG = 0x84
TRISB = 0
PORTB = 0
TRISC = 0xFF
PORTC = 0
TMR0 = 0
INTCON = 0xA0
counter = 0
counter2 = 0
end sub
main:
init_main()
while (TRUE)
button1()
wend
end.
p2long naman po . ayaw kc gumana kpag one click button ..
gumana lng sya kpag nka hold-down ung button ..
so kapag click ung button gagana dpt gumana ung sub prog. aa() .. and mag count ung counter2 then when counter2 reached 200 count the system will automatically turn-off.
PENGE na din ng advice
salamat!!