program PIC12F675_5_LEDs_Int_007
dim tm as word
dim pattern as word
sub procedure ptn1
pattern = 1
while INTCON.GPIF = 0
GPIO = %11111111
Vdelay_ms(tm)
GPIO = %00000000
vDelay_ms(tm)
wend
while GPIO.3 = 0 Delay_ms(100)
wend
INTCON.GPIF = 0
end sub
sub procedure ptn2
pattern = 2
while INTCON.GPIF = 0
GPIO = %00101101
Vdelay_ms(tm)
GPIO = %00010010
vDelay_ms(tm)
wend
while GPIO.3 = 0 Delay_ms(100)
wend
INTCON.GPIF = 0
end sub
sub procedure ptn3
pattern = 3
while INTCON.GPIF = 0
GPIO = %00000001
Vdelay_ms(tm)
GPIO = %00000010
vDelay_ms(tm)
GPIO = %00000100
vDelay_ms(tm)
GPIO = %00010000
vDelay_ms(tm)
GPIO = %00100000
vDelay_ms(tm)
wend
while GPIO.3 = 0 Delay_ms(100)
wend
INTCON.GPIF = 0
end sub
main:
ANSEL = %00000000 CMCON = %00000111 IOC = %00001000 TRISIO = %00001000 INTCON = %00001000 tm = 250 pattern = 1
LEDLoop:
INTCON.GPIF = 0 select case pattern
case 1
ptn2
case 2
ptn3
case 3
ptn1
end select
goto LEDLoop
end.