From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Termination Character

Solved!
Go to solution

Hello,

 

I have a VI that I want to be constantly reading in numbers (that are in ASCII format) with VISA. The data coming in separates its variables with X's. I'm not sure if I'm trying to use the char termination correctly, but I had the idea that it would stop reading in (at the X in this case) and only have the number going out to the read buffer.

 

Here's the article on NI that I read about it.

http://www.ni.com/white-paper/4256/en/

 

Unfortunately I'm still getting a whole bunch of variables surrounded by X's in the read buffer when I run the VI. Any help on getting just the numbers separately would be much appreciated.

Download All
0 Kudos
Message 1 of 8
(3,743 Views)
What are you actually typecasting the X to? U8 or something else? You do not show the representation of the 0 value. Probe it or create an indicator.
Message 2 of 8
(3,724 Views)
Solution
Accepted by topic author JLHart

Hi JL,

 

coercion dots always mark dangerous conversions done automatically. You need to know why they appear and how they may influence your desired result…

 

Try this one:

check.png

("Failsafe" as long as LabVIEW doesn't support Unicode by default…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 8
(3,706 Views)

Thanks you two, all appears to be working now. I ended up using the second solution just in case (thanks for the tip), and even though X's still append the strings, when converted to a dbl numeric they seem to be lost. So I'm probably not going to bother with trying to get rid of them for now.

 

Again, thank you. Smiley Happy

Download All
0 Kudos
Message 4 of 8
(3,690 Views)

Hi JL,

 

why is there a coercion dot at VISARead input? (It doesn't hurt you here, but anyway…)

 

Why is there a coercion dot at your numeric indicator? Why do you use a DBL indicator for an integer value? Or other way around: why do you convert to an integer when you want to use DBL floats later on?

 

even though X's still append the strings

Well, even when you define "X" as termchar it is still part of the received data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(3,684 Views)

Oh I didn't realize I could avoid a lot of the unecessary conversions, or even what the red dots meant. Is this better?

 

VISAd.png

0 Kudos
Message 6 of 8
(3,641 Views)
Why even do the conversion from string to byte array, etc? Right click on the input and select Create Constant. You can enter the decimal value or change the representation to hex. Get the value value from an ASCII lookup table.
Message 7 of 8
(3,636 Views)

Alright, I connected an U8 integer directly to represent the X. Thanks for the tip!

 

 

 VISAd.png

0 Kudos
Message 8 of 8
(3,620 Views)