LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert ASCII output to legible English

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

0 Kudos
Message 1 of 16
(299 Views)

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. 

 

LVNinja_0-1715693794552.png

 

0 Kudos
Message 2 of 16
(283 Views)

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?

0 Kudos
Message 3 of 16
(254 Views)

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. 

0 Kudos
Message 4 of 16
(234 Views)

So how does "AF" translate into "Connected: yes/no". We are missing all required information. Do you have a link the the instrument manual?

0 Kudos
Message 5 of 16
(205 Views)

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

0 Kudos
Message 6 of 16
(160 Views)

Can you share the code you did so far t send the command %AF ? What did the instrument responded ? 

 

 

0 Kudos
Message 7 of 16
(140 Views)

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.

0 Kudos
Message 8 of 16
(135 Views)

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.

cr-lf.png

 

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.

read_ls55.png

 

 

0 Kudos
Message 9 of 16
(123 Views)

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 

0 Kudos
Message 10 of 16
(109 Views)