Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial read with termination

Solved!
Go to solution

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?

0 Kudos
Message 1 of 2
(2,424 Views)
Solution
Accepted by topic author blacktea

Why not use the remove white space to get rid of hese characters and compare with the simple ones?

greetings from the Netherlands
0 Kudos
Message 2 of 2
(2,399 Views)