program PIC12F675_5_LEDs_Int_005
' Declarations section
main:
' Main program
dim tm as word
ANSEL = %00000000 ' Configure AN pins as digital I/O
CMCON = %00000111 ' Comparator Off
IOC = %00001000 ' Interrupt-on-change enabled on GP3(=1)
'OPTION_REG = %00000000
TRISIO = %00001000 ' GP0,1,2,4,5 is OUT
' GP3 is always IN
INTCON = %00001000 ' Enables the GPIO port change interrupt
tm = 1500 ' Wait mS
INTCON.GPIF = 0
LEDLoop:
INTCON.GPIF = 0 ' 1 = When at least one of the GP5:GP0 pins changed state
' (must be cleared in software)
while INTCON.GPIF = 0
GPIO = %00101101
Vdelay_ms(tm)
GPIO = %00010010
vDelay_ms(tm)
wend
while GPIO.3 = 0 ' 0 = Port pin is <VIL ( Push SW is ON )
Delay_ms(100)
wend
select case tm
case 1500
tm=100
goto LEDLoop
case 100
tm=30
goto LEDLoop
case 30
tm=17
goto LEDLoop
case 17
tm=1500
goto LEDLoop
end select
goto LEDLoop
end.