LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read multiple values on VISA READ?

Capture1.PNG

 

I have multiple values on VISA READ. I want to display them seperately on the front panel of LABVIEW . How should I do that?

 

Right now am getting all values together in a single tab 

 

For example - I have 4 values on VISA READ. I want to get each values seperately on the front panel.

 

0 Kudos
Message 1 of 13
(7,539 Views)

1. What is sending you the data?

2. What is the format of the data?

      Is the device sending multiple data points in a single message?

      Is the data formatted in ASCII (ie you can understand the data when opened in Text Pad)?

      If ASCII format, does the message end with a particular character?


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 13
(7,527 Views)

I am sending the data using ARDUINO UNO..

Am sending two continuous Numerical values

0 Kudos
Message 3 of 13
(7,525 Views)

What are you using to separate the values in the message?  Space?  Tab?


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 13
(7,516 Views)

this is part of the arduino code-

 

 Serial.println(distance);

 Serial.println(distance2);

 

How to seperate these values , so that it can displayed seperately in front panel?

0 Kudos
Message 5 of 13
(7,513 Views)

@iam_rupam wrote:

this is part of the arduino code-

 

 Serial.println(distance);

 Serial.println(distance2);

 

How to seperate these values , so that it can displayed seperately in front panel?


As you currently have it, you need a second VISA Read inside of the same loop.  But then you have no guarantees about which distance measurement you are reading.  You might want to consider using a single println command.  Something like "println(distance + "\t" + distance2)" should work.  Then a single message has both values separated by a tab.  Then you have a few options on the LabVIEW side: Spreadsheet String To Array followed by an Index Array, Scan From String with a format string of "%f\t%f".


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
Message 6 of 13
(7,500 Views)

Hi!

I was trying to do something really alike. I am reading pressure signals from an Arduino Mega and setting a serial connection to read them in Lab view. I want to star reading 4 values and was doing something like you said: with the serial print and the Scan From String with a format string of "%f\t%f" but it is not working... don't know why...

I have already try with the Spreadsheet String To Array followed by an Index Array and nothing is read.

If you could tell me why you would do me a great favor...

Thanks in advance

0 Kudos
Message 7 of 13
(7,242 Views)

Here is my Arduino code...

 

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
char Buffer[100];
int sensor0 = 0;
int sensor1 = 0;
int sensor2 = 0;
int sensor3 = 0;

void loop() {
// put your main code here, to run repeatedly:

sensor0=analogRead(0);
sensor1=analogRead(1);
sensor2=analogRead(2);
sensor3=4325;
sprintf(Buffer,"%04i\t %04i\t%04i\t%04i",sensor0,sensor1,sensor2,sensor3);
Serial.println (Buffer);
delay(1000);
}

 

Message 8 of 13
(7,239 Views)

I already solved it! NO prob! 

thank you anyway!

0 Kudos
Message 9 of 13
(7,229 Views)

@carlosTU wrote:

I already solved it! NO prob! 

thank you anyway!


You should really state what you did to fix your issue so others can learn as well.

 

But looking at the VI you posted, you should get rid of that Bytes At Port and just use a constant for the number of bytes to read.  The VISA Read will stop when the termination character (the Line Feed) is read.  So set the bytes to read to something like 50.


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
Message 10 of 13
(7,220 Views)