Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

SimpleStep motor controller board

I am trying to talk to the serial port on a SimpleStep motor controller board.

 

I am using NI-VISA through a generic USB-serial cable.

 

When using TeraTerm, I can manually issue queries and get responses.

 

However, when I run my LabVIEW 6.1 VI, I will get results 1 out 10 times.

The other times there are no bytes read.

 

I have tried having the serial port terminate on CR character.

I have tried not having the serial port terminate on anything and instead read the number of bytes at the port.

 

I am at wit's end what to try next.

0 Kudos
Message 1 of 14
(6,190 Views)

Show your vi, but probably you ask too fast for bytes available.

Give the motion unit some time to respond, say 10 ms and if that is not enough make it 50 ms (with ms wait, use the watch not the tick)

 

greetings from the Netherlands
0 Kudos
Message 2 of 14
(6,188 Views)

@Albert.Geven wrote:

Show your vi, but probably you ask too fast for bytes available.

Give the motion unit some time to respond, say 10 ms and if that is not enough make it 50 ms (with ms wait, use the watch not the tick)

 


I am waiting 500 ms after the write before the read.

 

Anyway, I am attaching 3 of the 4 VIs. Cannot attach anymore.

 

Apparently, the previous programmer had to do multiple write-reads because the communication was so erratic. ARGH.

 

 

Download All
0 Kudos
Message 3 of 14
(6,186 Views)

I have resorted to using the legacy Serial Compatibility VIs.

The communication seems a bit more robust though still not consistent.

0 Kudos
Message 4 of 14
(6,181 Views)

just missing verify communication.

I hope you don't open/configure  and close the serial port for each read and write because that can have a lot of side effects.

Initialise once and then try to communicate until the program finishes.

In testing just run the cinfig once and use the tofrom stand alone.

greetings from the Netherlands
0 Kudos
Message 5 of 14
(6,178 Views)

@Albert.Geven wrote:

just missing verify communication.

I hope you don't open/configure  and close the serial port for each read and write because that can have a lot of side effects.

Initialise once and then try to communicate until the program finishes.

In testing just run the cinfig once and use the tofrom stand alone.


No, this is just a test VI to check out communication to the board.

 

The fact that it is so inconsistent is troubling.

I thought the previous programmer was being overly cautious when he had the writes-reads in a loop, but now I see that he was compensating for erratic communication, which I have not been able to solve.

0 Kudos
Message 6 of 14
(6,177 Views)

Just for fun, I would try running your code with a new system and/or up-to-date LabVIEW.  There could be an issue in how LabVIEW 6 talked with VISA or the version of VISA you have installed.


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 7 of 14
(6,174 Views)

@crossrulz wrote:

Just for fun, I would try running your code with a new system and/or up-to-date LabVIEW.  There could be an issue in how LabVIEW 6 talked with VISA or the version of VISA you have installed.


I have the newest version of NI-VISA installed.

 

It may be something with how Windows 8.1 interacts with LabVIEW.

 

Using the legacy Serial Compatibility VIs I am able to get a bit more consistency, but not 100%.

 

The only way to consistently communicate with the board is to use TeraTerm or to use their SSWin program.

The SSWin program is written either in VIsual Basic 6 or Visual C++.

Neither allows for automatic testing.

 

I should add that I am taking over this code from someone else.

And there are numerous places where the same queries are sent multiple times.

I cleaned it up so that the multiple writes+reads are removed, but apparently they served a purpose.

I am told that that the previous person had to "jere-rig" the software. Sigh.

I am thinking I have no choice but to follow in his footsteps.  😕

0 Kudos
Message 8 of 14
(6,161 Views)
The serial compatibility functions are simply wrappers around VISA calls so I would not expect any differences.

How have you configured the write termination characters in teraterm? How have you configured the inter-byte delay? In all my years, I've never had to use a hack like you describe when the terminal emulation software can run without a hitch.
0 Kudos
Message 9 of 14
(6,155 Views)

@Dennis_Knutson wrote:
The serial compatibility functions are simply wrappers around VISA calls so I would not expect any differences.

How have you configured the write termination characters in teraterm? How have you configured the inter-byte delay? In all my years, I've never had to use a hack like you describe when the terminal emulation software can run without a hitch.

TeraTerm is set up for CR on read and CR/LF on write and no inter-byte delay.

 

I have worked with serial communication in the past and just recently on a different product and have no issues either.

0 Kudos
Message 10 of 14
(6,140 Views)