PEEK function on UART serial buffer

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Chris_MIRA
Posts: 185
Joined: Wed Jan 23, 2013 3:43 pm
Has thanked: 2 times
Been thanked: 21 times
Contact:

PEEK function on UART serial buffer

Postby Chris_MIRA » Mon May 13, 2019 10:15 am

Hi is it possible in FC8 to PEEK (look at without removing) the first byte on a UART buffer? This woud be really helpful in synchronising actions a serial data stream.
Regards,
Chris :D

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

Re: PEEK function on UART serial buffer

Postby Benj » Tue May 14, 2019 10:07 am

Hi Chris,

I'm afraid on the hardware if you read the buffer then the value is removed. A circular buffer combined with a UART RX Interrupt would allow you to read the data as and when you're ready and allow you to peek at the data.