serial input


Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9841
Posted: 06:47am 10 Jun 2025      

  georgestheking said  The sender send 50 bytes every 10 mS.
I use SETTICK to read the serial port every 10 ms.


That's pretty fast.  I'm not sure that MMBASIC is being given enough time to process things, if it's only allowed 10mS to do any processing, before the next 50 bytes arrive....if you see what I am getting at.

Serial is rock-solid, cos I use it all the time in my stuff too, but you have to have enough time for the data to be processed BEFORE expecting the next packet, and 10mS ain't much time at all.

Does the sender also send an end-of-packet byte as part of each packet?
That way, you can read the data from the buffer, and stop when you detect the EOP byte, process what is required, and then return to the main loop.

While that is going on, the serial input buffer will continue to buffer any data received, then you just rinse and repeat forever, or until the buffer is empty.
Edited 2025-06-10 16:48 by Grogster