We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Greetings,
I am wanting an interrupt to occur when I receive data.
In my code - When I receive data, I set a variable and clear RI.
Then in the main part of my code I have some printf() statements.
Am I correct that a serial interupt occurs on either RI or TI being set?
Is there a way to interrupt on ONLY a receive?
My code is getting locked up. I'm thinking it's due to my printf's and interrupts.
My printf's work - when I disable interrupts.
Am I getting into problems clearing TI in my ISR - I'm guessing my printf is not complete when the code bounces back.
How should I handle interrupting on received data and using printf to display that received data?
The ISR: void serial_int() interrupt 4 {
if(TI == 1) {
TI = 0;
}
if(RI == 1)
{
RI = 0;
serial_data = SBUF0;
need_serial_port_service = 1;
key_pressed = 1;
Thanks Sparky_
http://www.keil.com/download/list/c51.htm