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 4 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
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: 301
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
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: 33

Currently Online:
2 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

John: 18

RTSLVU: 15

Dan6077: 11

Member Stats:

Guest Posters: 0

Members: 80

Moderators: 0

Admins: 3

Forum Stats:

Groups: 1

Forums: 2

Topics: 58

Posts: 289

Newest Members: Marielop, engladcub, AbbaLearilky, LeiylaWes, pavlik76Sed

Administrators: geadmin: 5, filipealtoe: 35, Steffan: 89