Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5634

Serial read with termination

$
0
0

Hello!

 

I'd like to read buffer with termination char (\r and \n)

 

My setting is 9600 / 8 / none / 1 / RTS/CTS flow control as my instrument using flow control, (RTS/CTS)

 

What I want to do is read buffer and compare with string.

 

I wrote [CB] to instrument and read buffer.

Read buffer indicate "CB" and it's byte is 4. But string "CB" is byte 2.

I want to make while loop when read buffer is "CB" but as it is not same with string "CB", I cannot finish while loop.

 

From NImax, I found that read buffer was \rCB\n. So, if I can read buffer with \r, \n, \s character, it is possible compare with "\rCB\n" string.

But I cannot figure out how to read with these termination char.

How can I do that?


Viewing all articles
Browse latest Browse all 5634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>