Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a Particluar Byte from Serial Read

Solved!
Go to solution

Hi,

 

I am fairly new to using labview and am trying to create an application that reads and writes data to a meter via rs232. I am using the VISA serial read and write VI's to this. The problem I have is the message I read is 6bytes in length. I then need to read the second byte at the start and will be reading the other bytes received later on. What is the easiest way to do this? i.e. store the buffer and read the individual bytes as the need arises.

 

Also what is the easiest way to implement an IF statement in labview.

 

regards

Harshil

 

0 Kudos
Message 1 of 3
(3,524 Views)

How much later do you need to read them? Before or after the next byte arrives? It's certainly possible to use a shift register to save whatever you want. How you save them will depend on what you need to do with them. For example, you can save the entire response as an element in an array or each byte could be saved to separate arrays with multiple shift registers.

 

An if statement can be implemented with a case statement or Select function. That's basic stuff. You might look at the available tutorials.

Message 2 of 3
(3,519 Views)
Solution
Accepted by topic author hkhiroya

harshil,

 

You can use the string subset.vi to extract particular bytes from a multibyte string.

 

LV version of IF statement is a case statement.  See here http://digital.ni.com/public.nsf/allkb/3B3D68F6EC5F2EFB8625694C00654805

 

 

Missed it by that much!

Message Edited by Wayne.C on 04-06-2009 10:17 AM
0 Kudos
Message 3 of 3
(3,516 Views)