06-25-2014 02:14 PM
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.
06-25-2014 02:30 PM
06-25-2014 03:01 PM
@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.
06-25-2014 03:45 PM
I have resorted to using the legacy Serial Compatibility VIs.
The communication seems a bit more robust though still not consistent.
06-25-2014 03:56 PM
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.
06-25-2014 04:03 PM
@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.
06-25-2014 04:27 PM
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.
06-25-2014 08:01 PM - edited 06-25-2014 08:04 PM
@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. 😕
06-25-2014 08:40 PM
06-26-2014 07:25 AM
@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.