Thanks for any help on this--I am new to PICs but cut my teeth some on stamp things....
I am having trouble getting a simple interrupt routine to run on an 18F4220. (I have some boards that we made earlier that I would like to reuse)
I started by using a sippet of code from Chuck Hellebuyck (Nuts and Volts June 2006) and a PIC 16F877
Circuit Stuff (on Protoboard)
LED on Pin PORTB.1
Switch on RB0
ISP for programming
My Version of his code
LED1 Var PortB.1
On Interrupt goto myint
OPTION_REG = %00111111
INTCON = %10010000
loop:
High LED1
Pause 100
Low LED1
Pause 100
Goto loop
DISABLE
myint:
Low LED1
Pause 500
INTCON.1=0
Resume
Enable
This runs fine on the 16F877 , When I swap in the 18F4220 and change the code to :
LED1 Var PortB.1
On Interrupt goto myint
INTCON2 = %00111111 '<---------change here
INTCON = %10010000
loop:
High LED1
Pause 100
Low LED1
Pause 100
Goto loop
DISABLE
myint:
Low LED1
Pause 500
INTCON.1=0
Resume
Enable
I never get the interrupt routine to run.
Any Ideas?
Bookmarks