Hi,
I've been testing out the USART on my 16F76 by writing a simple echo server. I started off with:
DEFINE OSC 4
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 2400
DEFINE HSER_ CLROERR 1
serial var byte
main:
HSerin [serial]
Hserout [serial]
GoTo main
This worked absolutely fine. I then tried to add interrupts to the program:
DEFINE OSC 4
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_BAUD 2400
DEFINE HSER_ CLROERR 1
init:
PIE1.5=1 'Enable USART RX interrupts
INTCON.6=1
INTCON.7=1
on interrupt goto handler
main:
'Main loop, does absolutely nothing for the moment
GoTo main
DIsable
handler:
HSerin [serial]
Hserout [serial]
resume
enable
This ought to behave in exactly the same way, except that it doesn't work at all. Have I forgotten to set a needed register to enable interrupts or something ...?
Ben
Bookmarks