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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication possible with NI MAX, but not LabVIEW

Hello all,

Recently I've been attempting to serially communicate with a specific motor control device (Mclennan SimStep) with LabVIEW, but have come to an impasse. I'm currently using LabVIEW 2017 and the version of NI-MAX that accompanied it with NI-VISA 17.0. So far I have read the user manuals for the vendor's hardware to understand what port configuration is needed to communicate with the device as well as the syntax required when writing commands to it. I confirmed the syntax by emailing Mclennan technical support to make sure the string command was appropriate. 

 

When I use NI MAX with the appropriate serial configuration (9600 baud, 7-data bits, 1.0 stop bits, even parity, no flow control) and set the I/O settings correctly - opening a visa test panel to write the string commands is successful. The motors move as I tell them to, and everything seems reasonable.

 

When I try to replicate these same conditions in LabVIEW, however, I don't get any response from the motors. I checked a couple of other threads discussing something related, re-installed NI-VISA because I had recently upgraded the LabVIEW version on the computer I am using. There have been older versions of LabVIEW on this computer but I thought I had uninstalled them properly so that there wouldn't been any issues. I am using a usb to serial converter, but the fact that MAX could communicate successfully made me think this wouldn't have been the issue.

 

Attached is the LabVIEW Software I'm using to test communications with the motor control box. Also included are pictures and responses from both LabVIEW and NI MAX as well as the settings involved. I've also attached the manuals for the motor control box and related accessories. Note that the response of the LabVIEW Software appears to be the same as the NI MAX when the command line is written - the difference being that the motor control box actually responds to MAX.

 

I'm a bit new to LabVIEW, but my suspicion is that it might be a driver issue of some kind or that I'm just missing something in plain sight. I've been trying to reconcile the differences for awhile now but I can't seem to find anything that looks out of place. Any feedback or thoughts would be appreciated.

0 Kudos
Message 1 of 2
(2,335 Views)

1. For your command string, right-click on it and choose Visible Items->Display Style.  You will notice a little 'n' on the constant now.  Click that and choose "\ Codes".  You will now notice you are sending a literal "\r" instead of a Carriage Return.  In the \ Codes mode, delete one of the "\" characters.

 

2. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Your instrument uses a termination character.  So just tell the VISA Read to read more bytes than you ever expect back in a message and it will stop reading when that termination character is read.


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
Message 2 of 2
(2,326 Views)