From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port problem

I have a problem with the serial port in labview programming. I 'am communicating with a external motor through serial port. I wrote the program such that I can communicate with the motor. But the commands excutes only if the bulb in the diagram panel is on. otherwise the program never excutes. please help me in this regard.

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

the "bulb" as you call it slows the VI execution down so you can observe the program flow

the fact that the VI only works when Highlight Execution is on means that you are not allowing enough time for read or write or both of the serial port

0 Kudos
Message 2 of 8
(3,422 Views)

So what i have to do, for this problem. How can I correct it. The problem is the motor works for the command without highlight , but it will not show the number of steps without the highlight if I give the command for that. So can you please inform me a solution. please reply

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

Put in a wait.  I find 10 to 50 ms should work.  As an example, typically for GPIB when requesting information from an instrument, I have a 50ms delay between sending the request and reading its data.


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 4 of 8
(3,408 Views)

With serial ports, a 50ms wait may not be enough. I had to put in 1/2 second for one instrument.

0 Kudos
Message 5 of 8
(3,405 Views)

@nyc_(is_out_of_here) wrote:

I had to put in 1/2 second for one instrument.


I haven't dealt with many serial instruments, but that sounds excessive to me.  Anyways, perumpadapu, you might want to experiment with the delay until you find one that works for your situation.


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 6 of 8
(3,400 Views)

Actually delays in the milliseconds is not uncommon for serial port instruments. This is not GPIB. I had originally put the delay at 250ms. The results were intermittent. I upped it to 500ms. Solid as a rock. Somewhere in between is probably optimal, but an extra 250ms wasn't going to be a showstopper.

0 Kudos
Message 7 of 8
(3,393 Views)

thank you, for your reply

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