LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strings too long

Solved!
Go to solution

hi guys,

I'm having a problem with some strings, I'm sending larges pieces of code via string control, and in some point (I think near 180 characters) the code finish and only send a piece... 

I dont know if there's a limit in the string or if is in the VISA Serial communication or what... but either way I want to know if this limit exists and if I can change it, or else I'll have to manipulate in some way the string to send it by lines or something.

 

Sorry for bad english, I hope that someone could understand me!

0 Kudos
Message 1 of 30
(4,403 Views)

lord_nox wrote:

I'm having a problem with some strings, I'm sending larges pieces of code via string control, and in some point (I think near 180 characters) the code finish and only send a piece... 

 


Hi nox,

I don't understand what you mean by sending pieces of code. Can you post the code you are trying to run, include a typical string that may be involved, and information on any instruments being used?

0 Kudos
Message 2 of 30
(4,394 Views)

without more info on the nature of the problem and screen shots foe the code, I can only offer a guess.

 

Do you by any chance have a very short timeout defined for the serial port?

 

With a slow baud rate and short timeout ...

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 30
(4,386 Views)

Another guess: termination char is activated on read (and/or write), and at some point the string does contain that termination character.

 

Jens

Kudos are welcome...
Message 4 of 30
(4,379 Views)

@jg69 wrote:

Another guess: termination char is activated on read (and/or write), and at some point the string does contain that termination character.

 

Jens


I like that guess!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 30
(4,374 Views)

I don't want to share the diagram because its very extensive, so I'll show you the pieces of diagram and a brief explanation of this pieces (I'm sorry for not being clear)

First of all, this is for my school project, it involves sending g-codes to a cnc machine via serial communication to an arduino... for this I'm using VISA to communicate (inspired by this http://embeddedlaboratory.blogspot.cl/2016/08/serial-communication-using-labview.html)

 

image.png

The thing is that, if I send a very large G-Code, the code cuts in some point... I don't think that theres a limit in the string control (by the way, i don't send any weird character or something), but my suspects are that the VISA block has the problem

 

image.png

ps: i'm working in 115200 bauds.

 

 

 

0 Kudos
Message 6 of 30
(4,372 Views)

Start up NI IO Trace and watch what is actually be sent.

 

The serial port does have a buffer that you can configure the size but first get confirmation from NI IO Trace to confirm what you think is happening actually is happening.

 

Quoting myself

 

"The first step in solving a problem is clearly defining what the problem is."

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 30
(4,362 Views)

As suspected, you activated the term char for read and set it to \n = LINEFEED. If your arduino has similar settings, then that might be the problem (depending on your arduino code), because I strongly suspect, that g-codes at some point will include some linefeeds.

 

Does "VISA Write" throw any errors when sending a string? How do you detect that you have a problem at all?

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 8 of 30
(4,358 Views)

For example I send this (without the parenthesis)

 

G91 (to set relative movement)

G1 X5 (to move the X axis 5mm)

G1 X5

... (n times)

G1 X5

G28 (return home point)

 

The thing is that in some point (28 lines or near 200 characters) the thing stops, like if it stops receiving the code.

 

I'm watching NI IO TRACE and once i've connected the serial port it throws a bunch of entrys and i don't understand nothing

0 Kudos
Message 9 of 30
(4,351 Views)

look for a VISA write in IO trace. It should show you what is being transmitted.

 

Detail...

 

I do not recall off-hand if IO Trace will truncate long messages. That should show up as an options somewhere in IO Trace.

 

But it will tell you what get pushed out of the wire.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 30
(4,336 Views)