Interrupts, Com Port and Circular buffer.
Posted: Mon Jan 03, 2022 10:40 am
Hi guys,
In FAD, I have COM port component recieving serial data at a modest 9600 baud.
An interupt is used to collect the byte and pass it to a circular buffer. ( It is ignored if its 0 or 255 ).
A) If there a sensible frequecny for the interupt? Or is there a way to interupt only when reciecing a new character in the Com buffer?
B) Circuar buffer. The main loop looks for my data's start ":" and end ";" characters, then reads out all characters inbetween. This is currently working well. (I think this method was taken from your example or from Ben. )
I changed to 'Far Memory' and Storage type is 'last x values'. The process was significantly more reliable but im not sure why.
Is this assumption correct?
If the cirular buffer was a physical stack of characters...incomming data is always added to the top of the stack. Read data is always taken from the bottom of the stack. As such everything is proccessed sequentially. However if the incoming data is greater/faster than the reading process, un-read data will get pushed out of the stack by new incoming data.
Thanks, J.
In FAD, I have COM port component recieving serial data at a modest 9600 baud.
An interupt is used to collect the byte and pass it to a circular buffer. ( It is ignored if its 0 or 255 ).
A) If there a sensible frequecny for the interupt? Or is there a way to interupt only when reciecing a new character in the Com buffer?
B) Circuar buffer. The main loop looks for my data's start ":" and end ";" characters, then reads out all characters inbetween. This is currently working well. (I think this method was taken from your example or from Ben. )
I changed to 'Far Memory' and Storage type is 'last x values'. The process was significantly more reliable but im not sure why.
Is this assumption correct?
If the cirular buffer was a physical stack of characters...incomming data is always added to the top of the stack. Read data is always taken from the bottom of the stack. As such everything is proccessed sequentially. However if the incoming data is greater/faster than the reading process, un-read data will get pushed out of the stack by new incoming data.
Thanks, J.