Serial interrupt disable versus Uart

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
alanwms
Posts: 67
Joined: Tue Sep 16, 2008 2:09 pm
Location: Minnesota USA
Has thanked: 4 times
Been thanked: 17 times
Contact:

Serial interrupt disable versus Uart

Post by alanwms »

It is not clear to me how the serial interrupt really works. If the interrupt is disabled, the uart can still receive serial data. I would like to know if the interrupt flag is raised even when the interrupt is disabled.
This is a pivotal item since interrupts occurring while a macro call is in place corrupts the stack. This caused me to enable the interrupt at known places to assure that the interrupt service was performed while no macro's were in play.

So - I would like to know
1. Will an interrupt enable service a serial activity that happened previously to the serial enable?
2. Is there a better way to handle the stack - Do I presume right that the stack is corrupted at serial time?

Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Serial interrupt disable versus Uart

Post by Benj »

Hello Alan,
I would like to know if the interrupt flag is raised even when the interrupt is disabled.
Yes the flag will still be set when the interrupt is disabled but this will only happen once. As long as you enable the interrupt at least once every byte period then there is no way for you to miss a byte.

9600 baud / 10 bits = 960 bytes per second
1 / 960 bytes = 1.04ms byte period
1. Will an interrupt enable service a serial activity that happened previously to the serial enable?
Yes this should be fine for a single byte.
2. Is there a better way to handle the stack - Do I presume right that the stack is corrupted at serial time?
It depends what your interrupt service routine is doing. Try and keep as little code here as you can to try to avoid calling the same functions as are called from your main loop.

The circular buffer component in v6 is very useful for doing this type of thing. You can very quickly throw the received data into the circular buffer in the interrupt macro and then when you are ready in your main loop you can poll the buffer to see what data you have received.

Post Reply