Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visa read more than 1 byte data

Solved!
Go to solution

Hi, When i use VISA to read more than 1 byte data, only the first array got data, but i want to separate the 40 bits data into 5 arrays. Is anybody knows how to separate the data into arrays? Thank you for the reply!!!!

Download All
0 Kudos
Message 1 of 4
(4,548 Views)

What is the format of the data?  I'm guessing it is NOT sending out ASCII data.  It is sending raw bytes.

 

So you want 40 bits.  That is 5 bytes.  So first, let's remove the Bytes At Port.  Instead, wire a 5 to the number of bytes to read.  Also make sure the termination character is turned off (it is a boolean input on the top of the Configure Serial Port).  You will now read 5 bytes at a time.  Now use the String To Byte Array to make an array of U8.  Use a Number To Byte Array inside of a FOR loop to turn your array of bytes into a 2D Array of Booleans.  You can use Index Array to separate your rows from there.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(4,522 Views)

Thank you for your advice. But now the the problem is the data in 5 arrays are not the data we want. the data in read buffer is 2 , 4, 8, 16,32. But when we run the program the 5 arrays are not 2,4,8,16,32.   Could you please give me some advice about that?  Thank you so much!

0 Kudos
Message 3 of 4
(4,511 Views)
Solution
Accepted by topic author hxhxhx

Your problem is the attempt to convert from ASCII.  As I said before, you have raw binary data.  So do not touch anything that deals with ASCII.  All you need to do is take your byte array and convert each element to a Boolean Array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(4,489 Views)