Hello,
first of all, im new on this forum and i'm from the Netherlands (spelling issue)
since a month, im programming PIC controllers for school. im using a big, pic16f877a device which have alot of functions, including interrupts.
However those interrupts dont work for me. I wrote a code, just to interrupt when serial data is incomming.
Heres the code:
Code:
;DEFINE HSER_RCSTA 90h (no function if baud rate is defined)
;DEFINE HSER_TXSTA 20h (no function if baud rate is defined)
define HSER_BAUD 9600
DEFINE HSER_SPBRG 25
define osc 20
Include "modedefs.bas"
ON INTERRUPT GOTO INTERRUPT_HANDLER
INTCON = %11000000
PIE1.5 = 1 ' enable interrupt on usart receive
Main_Loop:
low portd.2
pause 500
hserout ["main loop hser"]
GOTO Main_Loop
END
DISABLE INTERRUPT
INTERRUPT_HANDLER:
high portd.2
hserout ["Interrupt handler hser"]
PIR1.5 = 0 'Receive int clear
pause 1000
RESUME
ENABLE INTERRUPT
When i power up the pic, interrupt is active (portd.2 is a led) and will glow up. Sending serial data to usart wont make any difference.
Anybody who can help? or write a simple RX interrupt example?
Thanks in advance.
Bookmarks