
Originally Posted by
Arciure
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.

Hello, and welcome to the forum.
HSEROUT transmits HSERIN receives. That is where I would start . . . and understand , it must occur on the RX pin as defined in the Data Sheet. Additionally The hardware USART requires the RX port to "Idle High", which is to say, PULL UP Resistor required.
Last edited by Archangel; - 3rd March 2010 at 18:22.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks