How does the compiler handle getC() in the main() with ISR written.
My pic has two sensors attached to it on ONE the serial port, one runs on interrupts and other has to be polled and returns exactly X bytes of data.
I am thinking of writing ISR for interrupt based sensor, and polling the data in main for poll based sensor.
Is there a better way of doing this?
Does getC() get the character from hardware buffer incase of hardware UART?
Does the program still enter ISR if getC() is used?
Thanks
Ttelmah
Joined: 11 Mar 2010 Posts: 19546
Posted: Sat Feb 08, 2014 1:48 am
No, and yes.....
INT_RDA will pre-empt anything using getc, in the main. getc will never receive a character while the interrupt is enabled.
Just disable the interrupt, for the code section where you want 'polling' action, and then getc in the main will work.
However I have to say consider 'rethinking' your approach, and using a single interrupt writing to a circular buffer.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum