ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shared variable engine modbus - Getting a stepper motor to work

Hello,

 

I am new to Labview. I need to trigger the stepper motor to start by allowing current to run through the motor. This can be done by turning bit3 on the16 bit register 007Dh. The register address has been attached below as 007Dh.png so please view that before you go any further to have a better sense of what i'm trying to accomplish. Please also note that the decimal conversion of 007Dh is 125.

 

So my question is, how do you turn on bit3 of that 16 bit address? How would you translate the holding registers from the manual

into a 5-6 digit data item that labview can understand?

(Please refer to this page for the types of data items: http://zone.ni.com/reference/en-XX/help/371618J-01/lvmve/dsc_modbus_using/)

 

 

 

0 Kudos
Message 1 of 11
(3,989 Views)

Do you know what value is currently in the register?  If not, read the register first.  Then AND that value with the number 8  (2^3) to turn on that bit, and write the value back to the register.

 

To turn it off AND it with 65527 decimal (2^16-2^8).

0 Kudos
Message 2 of 11
(3,969 Views)

I am not able to read anything at the moment. I don't think Labview is communicating with the driver at all. How do I know if my RS-485 is working properly?

0 Kudos
Message 3 of 11
(3,935 Views)

Hello Missso

 

How are you configuring your I/O server? Have you followed this guide? with this guide we can verify that we are programming properly the I/O server, then we can test the real device.

 

Are the communication settings configured properly? Configure Modbus Slave I/O Server Dialog Box.

 

Can you see the values updated in the Distributed System Manager?

 

Regards

Frank R.

0 Kudos
Message 4 of 11
(3,918 Views)

Hello Fromm8

 

Yes, I tried following the guide and when I get to step 14 and try to run the program I get a couple different errors. I have attached a document that shows the errors.

 

 

The first error makes me think there is a problem with the RS485 converter I have that links the stepper motor to the computer. But I have followed the instructions properly nad called their IT guy to verify.

 

As for the communication settings, I have been over them many times and feel pretty confident they are correct. Acreenshot is attached in the document.

 

We are definitely using "Modbus Serial", the address on the driver is set to "2", the serial port is definitely "COM6" which is the RS485 converter to the driver. Baud rate setting on the driver is also set to 9600, and the transmission mode is set to RTU.

 

I am not sure what the Distributed System Manager is...

 

I really appreciate the help!

 

 

0 Kudos
Message 5 of 11
(3,911 Views)

Hello Missso

 

The Distributed system manager is a tool very useful for testing and we can monitore the shared variables. The Distributed System Manager is used in that guide I mentioned. I want you to become familiar with the software before testing the Hardware. I recommend you to complete that guide, you are going to build the Modbus server, modbus client in LabVIEW and the Distributed System Manager is an alternative client as well (You DO NOT need real HW to complete that guide).

 

The deployment of the library completed successfully without errors?

If the problems persist you could upload an example project so we could check if there is something irregular.

 

Regards

Frank R.

0 Kudos
Message 6 of 11
(3,907 Views)

Like I said, I went through the guide and got stuck at step 14. I attached the errors I received when trying to run the program at step 14. I don't really understand what the errors mean or how to fix it. The next part of the instructions, "Viewing Shared Variables with Distributed System Manager", I was not able to get to because I get an error when I run the program. Were you able to view the document I sent?

0 Kudos
Message 7 of 11
(3,902 Views)

I am wonding how to run the program without the hardware? I unplugged everything and tried to run the program again and I get the same error as before (second error in the document sent earlier).

0 Kudos
Message 8 of 11
(3,892 Views)

Hello Missso

 

That guide was built for Modbus Ethernet. I recommended you to complete that guide to understand how it works. That guide explains you how we can build the modbus server. You can use the Modbus Simulator.lvproj as the Modbus Slave (this example comes in the LabVIEW example finder: help>>find examples>>search tab: type modbus). If you run just the server wihout the slave you are going to get the same error you are getting at this point. I get the same error if I am not running the slave application.

 

Try to test very well Modbus Ethernet, then you can connect your device and use Modbus Serial.

 

Regards

Frank R.

0 Kudos
Message 9 of 11
(3,858 Views)

Hello Frank,

 

Thank you for the help with the modbus slave simulator, everything worked just fine. However I still can't get the real device to work with labview. I am wonding if you can answer a question for me as I am not sure I can do what I want with the equipment I have. 

 

What I need to do is turn a stepping motor on and off using Labview as well as get Labview to record the speed and position of the stepping motor over time. I have an AED-AD stepping motor driver made by Oriental Motors. I have attached the user manual in case you need to see it. I am conecting the motor driver device to a computer using an RS485 converter, which oriental motors suggested I use for the purpose of using Labview to collect data. 

 

My question is, will this setup work for what I need to do, or do I need some kind of data aquisition device as well? 

 

After I solve this, I will be adding three more motors to the Labview program monitoring the same thing as well as some pressure sensors.

 

I have just finished my second year in the engineering program and have been hired as a research assistant to solve this problem so I am completely new to Labview. If there is anything else you can suggest to read or someone I can talk to to get more information about this type of control systems I would be very greatful. So far, I have been reading as much stuff as I can find about Labview on the internet but I have not come across anything that helps me figure out if my setup is appropriate for collecting data in Labview.

 

Thank you again for your help and advice! I hope you are having a great weekend!

 

Kind Regards,

Meesh

0 Kudos
Message 10 of 11
(3,822 Views)