LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lectura del puerto serial e impresion de datos

Solved!
Go to solution

Buenas tardes, estoy leyendo por el puerto serial usando VISA los datos de 5 sensores, pero todos se mezclan al usar visa, no se como discriminar los datos en LabView sin tener esos confilctos con los datos.

 

Ejemplo:

Al serial llega:

10

15

89.3

-15

-98.23

 

Y al querer imprimirlos se mezclan todos y aparecen esos valores en orden randomico, alguien podria ayudarme? muchas gracias.

0 Kudos
Message 1 of 49
(4,245 Views)
I don't understand how they could be mixed if you are reading the sensors in order. Are these 5 separate com ports? You should be using dataflow to control reading order or have a single read in a for loop that generates an array. Please attach an image of your block diagram or the actual VI.
0 Kudos
Message 2 of 49
(4,228 Views)
I just noticed that you have posted numerous threads on the same subject and you are using an arduino. If that's the case, your entire problem resides with poorly written c code. There is nothing that can be done on the LabVIEW side to fix it. I would suggest sending all readings in a single string, separated with commas, and the string terminated by a line feed. You do a single read and the values get parsed with the spreadsheet string to array function.
0 Kudos
Message 3 of 49
(4,224 Views)

I'm doing it, for example if a writte a "g" in Labview the LAbview Read de GPS, but if I writte a "H" the Labview Reads Humidity , but i'm sending "g" and "H" all time and the information mix with other. I tried to Wriite " L" for Latitude, "l" for Longitude, but I've the same problem all information mix.  

 

0 Kudos
Message 4 of 49
(4,220 Views)
Sorry, I can't view your code. Can you post an image of the block diagram? You obviously have to write one command at a time.
0 Kudos
Message 5 of 49
(4,208 Views)

Don't use Bytes at Port.  It is very likely you'd get incomplete messages.

 

Do  your messages have a termination character?  If so, use that to read a sufficiently large number of bytes and the read will terminate automatically when you get it.

 

If you have confusion about what data goes with what message, then use a letter or some other code at the beginning of your response in the Arduino code.  Then you can parse that out and be sure you are getting the right piece of data you are expecting.

0 Kudos
Message 6 of 49
(4,168 Views)

No, i just have numerical data, I send a letter like "L" and arduino response is 78.09826, and I'm doing it for all data.

 

This is my LabView code:

 

Download All
0 Kudos
Message 7 of 49
(4,122 Views)

Make sure your device sends a termination character such as the new line/linefeed character.  Then just read a very large number of bytes.  The VISA read will terminate when it gets the termination character and you will know you have a complete message.  That allows you to get rid of that whole inner while loop.

0 Kudos
Message 8 of 49
(4,119 Views)

For example I can program on Arduino to send " , " at in the end of the data 78.02932, but how do I do that LabView understand it? Can you help me please?

0 Kudos
Message 9 of 49
(4,115 Views)
If you program the arduino to send 'data, data, data <LF>', then the LabVIEW code is trivial. Read a large number of bytes with termination character enabled and pass the string to the Spreadsheet String to Array function.
0 Kudos
Message 10 of 49
(4,106 Views)