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

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

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.
Chris :D

User avatar
Matrix Staff
Posts: 14681
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4665 times
Been thanked: 4287 times

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.