Page 1 of 1

Interrupt on 2 UART

Posted: Mon Jan 11, 2010 2:02 pm
by Mathy
Hi everybody :)

I have a 18F6527 and I use the two UART. I would like to use the two uart in interrupt mode.
With only one, it works very well ( I juste have to add "set_bit(intcon, PEIE);" at the top of my program ).

I made some modification on the FCD file to add the second interrupt but if I use the two of them in my program, neither works :(

I attached my FCD file if somebody can have a look.

Thank you for your help !

Re: Interrupt on 2 UART

Posted: Tue Jan 12, 2010 11:14 am
by Benj
Hello

Your modified FCD looks ok to me. Something you could try is to manually perform a character read from both UART components before enabling the interrupt. This should clear any potential errors on the bus and hopefully allow the interrupts to start working.

Let me know how you get on.

Re: Interrupt on 2 UART

Posted: Mon Jan 18, 2010 4:59 pm
by Mathy
Hi Benj,

I already performed a character read from both UART without any sucess.

If I delete those character read and if I add this code at the top of the program.....it works !

Code: Select all

st_bit(intcon, PEIE);
st_bit(rcsta, SPEN);
st_bit(rcsta, CREN);
st_bit(rcsta2, SPEN);
st_bit(rcsta2, CREN);
8)