Is there a way to clear the serial read buffer? | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
Is there a way to clear the serial read buffer?
July 18, 2017
2:13 am
Avatar
JJ
New Member
Members
Forum Posts: 2
Member Since:
July 18, 2017
sp_UserOfflineSmall Offline

Is there a way to clear the serial read buffer?

I am communicating via RS485 in a request-response structure.

 

When I make a request in Aduino, the other side responds.

The response always sends 28 bytes.

 

However, when 28 byte serial read is performed, one or two trash values are continuously pushed in.

 

Is there a way to clear the serial read buffer?

July 18, 2017
11:08 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

You can simple use Serial Check for Bytes.vi and read that number of bytes which will flush the bytes at the port.  Or you can just read all the bytes at the port and parse your data of interest and discard the rest.

July 19, 2017
3:25 am
Avatar
JJ
New Member
Members
Forum Posts: 2
Member Since:
July 18, 2017
sp_UserOfflineSmall Offline

Steffan said
You can simple use Serial Check for Bytes.vi and read that number of bytes which will flush the bytes at the port.  Or you can just read all the bytes at the port and parse your data of interest and discard the rest.

Thank you. 🙂

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
3
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356