05-14-2024 08:17 AM
Hi All
I hope this message reaches the NI community well.
I am currently writing some codes in LabVIEW 2015SP1 for an LS55 laser system and a code I am writing has to output a series of ASCII outputs, which detail if a device is connected.
The manual has a list of device connections and a 1 or 0 indicated if it is connected or disconnects respectively.
I basically want to turn a device ASCII output into a text field which says:
DEVICE Connected
name of device Yes
name of device #2 NO
can anyone advise me on this matter?
Best Wishes
Andrew
05-14-2024 08:36 AM
Hi
how is the laser connected to the computer ?
What have you done so far ?
there are several ways to implement, but let's assume you are reading from a serial port (VISA COM port) you read the response from the laser and compare if the response is 1 then a is True if it's zero then is false.
05-14-2024 09:35 AM
The term ASCII output is meaningless because your text filed is ASCII too. (ASCII just assigns certain meaning to bits in relation to communication with output devices, display symbols, letters, numbers and define nonprintable control such as linefeed, escape, etc.). I guess the output byte from your device is either 0x30 or 0x31, maybe followed by a termination character.
You need to tell us how the received string looks like. Once we know that, LabVIEW has all the tools to process it. Where does the "name of the device" come from?
05-14-2024 10:47 AM
Hi altenbach
I apologise for the delay I was in my lab
The received string looks like the following:
%AFI/f
the $is a requirement of each RS232 command, the AF is the command itself, I/f is the terminator.
05-14-2024 12:44 PM
So how does "AF" translate into "Connected: yes/no". We are missing all required information. Do you have a link the the instrument manual?
05-15-2024 03:27 AM
Hi Altenbach
Sorry for the delay in replying to you. I was in my lab.
Here the link to the manual LS 55 User's Guide (s4science.at)
The command I mentioned is on page 152
05-15-2024 08:42 AM
Can you share the code you did so far t send the command %AF ? What did the instrument responded ?
05-15-2024 08:52 AM
Hi LVNinja
I can send you the code so far, it only contains the write component, and that's it. As for the instrument, its in a lab and I am writing these codes on a PC so I cannot yet test my codes.
05-15-2024 09:28 AM
The "I/f" you mention (page 125) is not that literal sequence of characters. It is "linefeed", whereas "c/r" is "carriage return".
There are constants for those on the string palette. In backslash notation, you would write \r or \n.
Here is some info about termination characters in NI VISA: https://www.ni.com/en/support/documentation/supplemental/06/termination-characters-in-ni-visa.html
If you use VISA Configure Serial Port with the default settings, you should be good to go. Use 128 as number of bytes to read. According to manual, reply messages will not be longer than that and VISA will stop reading when encountering a termination character.
You should get back a list of comma separated values with 0 or 1s. Use Delimited String to 1D String Array to split the string at the commas and format it into a table.
05-15-2024 10:09 AM
Hi
Thank you for the reply. I cannot find this delimiter VI on my labview, is it a standard vi or one I have to install separately