10-13-2017 12:38 PM
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!
Solved! Go to Solution.
10-13-2017 12:49 PM
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?
10-13-2017 12:54 PM
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
10-13-2017 12:58 PM
Another guess: termination char is activated on read (and/or write), and at some point the string does contain that termination character.
Jens
10-13-2017 01:02 PM
@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
10-13-2017 01:03 PM
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)
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
ps: i'm working in 115200 bauds.
10-13-2017 01:10 PM
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
10-13-2017 01:13 PM
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
10-13-2017 01:22 PM
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
10-13-2017 01:33 PM
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