LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Commands sent to Schneider MDrive Stepper motor over TCP get hung up on earlier commands.

Solved!
Go to solution

I am using LabVIEW to control a Schneider MDrive Stepper motor with integrated controller over a TCP connection.

 

I can write and read to and from the motors using the following VIs:

 

This is what I am using to send commands to the motor. It runs without issue.This is what I am using to send commands to the motor. It runs without issue.

This is what I am using to read information from the motor. It too seems to work without issue.This is what I am using to read information from the motor. It too seems to work without issue.

I want to use the above VIs to make another which writes to the motor and then reads from it until the given parameter reads back the setpoint. Basically, I'm assigning a value to a parameter and keeping the VI running until the motor has reached steady state for that parameter. Below is what I am using for that.

 

With this one, I'm trying to send a command and keep the VI running until I can confirm the setpoint has been met. This VI works the first time it runs.With this one, I'm trying to send a command and keep the VI running until I can confirm the setpoint has been met. This VI works the first time it runs.If I try to run the VI a 2nd time with a different value, the VI gets hung up in a loop, where it continues to see the previous setpoint.If I try to run the VI a 2nd time with a different value, the VI gets hung up in a loop, where it continues to see the previous setpoint.

As you can see above, the IV hangs in the the reading loop indefinitely after the first run. I want to say this is connected to the port used. I think the read VI is seeing information at the port from the previous process, but I am not sure how exactly to free it up. Any advice would be much appreciated.

0 Kudos
Message 1 of 6
(3,668 Views)

Is the same true if you keep an open reference to the TCP connection between Read/Write calls and only initialize/close the connection once per application execution?


GCentral
0 Kudos
Message 2 of 6
(3,654 Views)

Yes, it's still giving me the same behavior as before.

 

I have noticed that if stop I run the Write VI on its own, it seems to reset so the Write & Confirm VI runs like I expect.

0 Kudos
Message 3 of 6
(3,649 Views)

So my next question is likely something that you're already confident is not true, but just to check the simple things: are you sure the expected value is (in the example) the current acceleration, and not the current setpoint for the acceleration?

 

As a side note, should I be looking at the LMD Modbus/TCP Protocol Implementation manual?


GCentral
0 Kudos
Message 4 of 6
(3,640 Views)

Good look. Turns out what I am reading out (10000 in Write and Confirm.vi) is the actual acceleration on the motor. And that the command to write the setpoint (20000) never went through. I checked this using the software from Schneider that came with the motors.

 

And that's the correct manual you're looking at.

0 Kudos
Message 5 of 6
(3,632 Views)
Solution
Accepted by topic author gVassilaros

I figured it out. It's not my best work, but I got something going. See below.

 

Write and Confirm Working.png

 

I added the for loop around the TCP Write.vi because running it twice seems the only reliable way of getting the command out. I'm still not entirely clear why this works.

 

Timing seems to have been another factor. I noticed that the VI ran better when I ran it with Highlight Execution enabled, so I added the 10ms wait to each loop. What I think was happening was that the VI was reading outputs before the motor had time to process the write command.

0 Kudos
Message 6 of 6
(3,626 Views)