LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to run two motors synchronously with two controllers

I have two single channel controller. They are identical with baud rate 115200. Each controller was connected to a motor (same motor, lets call motor A and motor B). When I send commend to run both motors, only one motor ran (A ran). If I swap the input serail port, the working motor swaped as well (B ran).

 

Both motor can run in single motor mode. So my questions is, why two motors mode can not run both motors?

 

I tried debug mode, the commend did ran into the controller.Screenshot (18).png

0 Kudos
Message 1 of 16
(3,324 Views)

How many serial ports do you have? The default values on the VI you posted show both connected to COM1. You cannot communicate with two different devices on the same port.

 

What errors do you get? Error messages or codes can be helpful in determining why something does not work.

 

Lynn

 

 

 

Message 2 of 16
(3,312 Views)

I have two different seral ports in the test. COM 3 and COM 4. That should not be the problem.

0 Kudos
Message 3 of 16
(3,297 Views)

There is no error message pop up or with in the program when I am running.


@johnsold wrote:

How many serial ports do you have? The default values on the VI you posted show both connected to COM1. You cannot communicate with two different devices on the same port.

 

What errors do you get? Error messages or codes can be helpful in determining why something does not work.

 

Lynn

 

 

 


 

0 Kudos
Message 4 of 16
(3,287 Views)

Anyone know how to solve this? Thanls!

0 Kudos
Message 5 of 16
(3,235 Views)

Just a couple of things looking at your program.

When I have loaded it up I have got the bottom Configure Serial Port loaded correctly but not the top one. This would indicate that these are different which I would assume they are not supposed to be. Did you edit and rename the top Configure? This may be part of your problem if the port is not being configured properly. I would recommend simply replacing the top one with a copy of the bottom one.

Also:

- What is the point of the 50ms wait outside of your loop?

- You do not need to be using the local variables for changing your PID settings. You can simply run the control wires directly to the subVIs.

- I would recommend changing the VISA Refnum entrance/exit of the while loop into Shift Registers. (Right click the entry connector and select replace with Shift-Register)

 

I don't have your Init test but do both of the Ports return succesful Inits?

0 Kudos
Message 6 of 16
(3,215 Views)

@ogk.nz wrote:

Just a couple of things looking at your program.

When I have loaded it up I have got the bottom Configure Serial Port loaded correctly but not the top one. This would indicate that these are different which I would assume they are not supposed to be. Did you edit and rename the top Configure? This may be part of your problem if the port is not being configured properly. I would recommend simply replacing the top one with a copy of the bottom one.

Also:

- What is the point of the 50ms wait outside of your loop?

- You do not need to be using the local variables for changing your PID settings. You can simply run the control wires directly to the subVIs.

- I would recommend changing the VISA Refnum entrance/exit of the while loop into Shift Registers. (Right click the entry connector and select replace with Shift-Register)

 

I don't have your Init test but do both of the Ports return succesful Inits?


Ignore that 50ms. That doesn't do anthing.

PID is programmed in the controller so I have to set into the controller.

I have already added shift register and that doesn't work.

0 Kudos
Message 7 of 16
(3,190 Views)

I know that the the PID is programmed in the set location, but you can access both of the locations that it is run from without having to remove or rearrange anything, you should be able to run the wires from the controls to the subVI easily.

 

Did you replace the Configure Serial Port? Did it make a difference?

 

0 Kudos
Message 8 of 16
(3,172 Views)

@ogk.nz wrote:

I know that the the PID is programmed in the set location, but you can access both of the locations that it is run from without having to remove or rearrange anything, you should be able to run the wires from the controls to the subVI easily.

 

Did you replace the Configure Serial Port? Did it make a difference?

 


I am not sure did I understand correctly. It supposed to be two serial ports which send commends and run each motors.

0 Kudos
Message 9 of 16
(3,153 Views)

Yes, But somehow your two Configure VISA VIs are different, even looking at the names shows they are different.

 

Which of the two properly runs a motor? Replace the one that doesn't work with a copy of the one that does.

0 Kudos
Message 10 of 16
(3,117 Views)