LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa read, unwanted additional characters

Solved!
Go to solution

Goodmorning labview experts, 

 

I'm trying to connect labview to a RS 232 port belonging to a lathe. I'm trying to receive and read in labview a string that the lathe should send me. Basically I'm using the visa read programm from NI Examples.

 

The lathe should send me the string START, the labview programm reads the string but befor the S of START the programm shows a strange character, a sort of capiatl i with two short perpendicular segment at the top and the bottom of the letter. Sometimes it show after the T also the paragraph sign, some other times it shows the same symbol but on a different line and sometime there's no paragraph sign.

 

I tried the two most common end character, no end character and different waiting values for the loop but the problem is still there and now I really don't know what to do.

 

Thank you in advance for your help.

 

Regards, 

Lorenzo

 

 

0 Kudos
Message 1 of 8
(3,335 Views)

The first thing I would look at is to make sure ALL of your serial settings are correct: baud rate, number of data bits, number of stop bits, handshaking lines, etc.

 

When is the lathe supposed to send you this string?  Is it constantly putting out data or is it only from a commanded response?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 8
(3,327 Views)

Hi crossrulez,

 

I thought the same thing and I triplechecked everything, if this setting are incorrect it appears an erros message or ALL the characters displayed are wrong.

 

It is supposed to send the string at a precise moment, just when the fanuc controller reads the proper command. 

 

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

First of all the attached vi should be saved to C:\Users\<You>\Documents\LabVIEW Data\Probes\

 

Now when you want to debug some UART you have a new custom probe available

!1.png

 

Or, it only takes a few seconds to create the custom probe.  Now you can find out exactly what your lathe is sending and compare that to the manual for the de4vice which would tell you how messages are formated so you can configure the correct termination character if it uses one

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 8
(3,316 Views)

Just now looked at your code.  If the instrument is truely sending the termination character, you should not use the Bytes At Port.  Instead, just wire a really large number to the Bytes To Read input of the VISA Read.  It will stop reading when the number of specified bytes are read or the termination character is found.  This will help ensure your command comes in tact.

 

You might want to change your read display to use Hex format.  You might be able to decipher something out of that.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 8
(3,314 Views)

I tried the probe but it shows exactly the same string as the string reader.

 

I also tried to see the output in hex and (\) code. The output is this:

12 53 52 54 31 0A 14 in hex

\12SRT1\n\14 in (\) code.

So at least now i'm sure that the termination character is 0xa. What i cannot explain is why there are the 12 and the 14 at the end of the messages.

0 Kudos
Message 6 of 8
(3,303 Views)
Solution
Accepted by topic author lmerlo

the term char is 0x14 (ASCii Shift Out) th 0x12 is a start of message char. (Actually a ASCii form feed)  Why they chose those is unknowable.  But a Trim Whitesace will get rid of them for you.


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
(3,294 Views)

Thank you both for your help with your help i managed to fix the problem.

 

I figured out that those  two char originated from the lathe code ( POPEN and PCLOS)  necessary to open and close the rs port for communication.

 

Regards, 

Lorenzo

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