07-31-2018 02:04 PM
Your concatenating new string information to the end of the old. So of course you are going to get whatever information you first received since it is at the beginning of the string.
(PS: Use block diagram cleanup to get rid of overlapping wires and straighten them out.)
07-31-2018 02:19 PM
If I don't concatenate then labview doesn't read output from the external instrument.
07-31-2018 02:34 PM
What are you using for the Read Count? Does your instrument end the message with a termination character (typically a Carriage Return and/or Line Feed)?
Since you are getting an ASCII message, it is pretty safe to assume it is using a termination character. Therefore, just tell the VISA Read to read more bytes than you ever expect in a message (somewhere around 100 should do it). Then you should be getting a full message each iteration of your loop.
07-31-2018 02:40 PM - edited 07-31-2018 02:41 PM
That picture doesn't show us what the message is that you did get. Why wouldn't you be getting the entire message?
You can also get rid of the Build Array and To DDT express VI at the bottom of the picture and just wire the orange wire directly into the chart terminal.
07-31-2018 02:43 PM
I don't get a message when I run the program without concatenating. I've changed the read count to over 100 and that didn't change anything. I've checked in NI-MAX for the correct read count and used that in my program, but didn't give me anything.
07-31-2018 03:04 PM - edited 07-31-2018 03:07 PM
That doesn't make any sense. If you get nothing if you do a single read, but your proceed to concatenate multiple reads together you do get something?
What does NI-MAX say is the correct read count? And are you saying that NI-MAX can read it correctly?
And your earlier example has 154 characters in it. You should read more than 100. Try reading 1000 bytes. Are you sure you are getting a termination character?
Run you VI with a single read and 1000 bytes. Then when done, set the string indicator to save the value as default, save the VI, and attach it to your message. That way we can see exactly what your message looks like in LabVIEW.
08-01-2018 08:35 AM
I set the read bytes to 1024 and NI-Max reads it correctly. When I run a single read in my program with read bytes set to 1024 I get nothing. I've attached the VI, NI-Max output and a screen shot of my program.
08-01-2018 09:03 AM
Sending the actual data helps a lot to see what is actually going on!
Your device seems to be returning a line feed followed by a carriage return as the termination characters. It also seems to be doing it twice since you have blank lines between each set of data. Do you know why it is doing that? Can you set the termination character in the device?
Try setting the termination character in LabVIEW to be a carriage return rather than line feed. (x0D).
To deal with the extra blank lines, after doing a VISA Read, if you detect there is no data in it. (just the line feed/carriage return) discard that data and do another VISA Read..
08-01-2018 09:06 AM
Hi Augspurger,
When I run a single read in my program with read bytes set to 1024 I get nothing.
According to your NI-MAX list you should atleast receive a "\n". Do you?
Why don't you implement the very scheme you use in NI-MAX in your VI?
Well, I don't understand why you need to request the IDN twice - but when that scheme works for you, then you should follow exactly those steps!
08-01-2018 03:00 PM
I've been working on this all day. I finally got the program to read the data with concatenating, however I'm still not getting live data. I will get a number (not quite the same number as the external meter); the next write/read loop gives me NaN; then I get the same number I got the first write/read loop. The meter does change output rather continuously and I need labview to keep up.