LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dsc modbus - Serial communication input/holding registers

Hello,

 

I am trying to create a labview application to act as a Modbus master and control multiple stepper motors. I have the DSC module in labview and am using a serial communication with an RS-485 converter. I have followed this guide: http://www.ni.com/white-paper/13911/en/  However, the driver I am using does not support coils, it only uses input and holding registers and I have not found a guide or tutorial that shows me how to create a labview application that can read and write to a specific address. For now all I want to do is turn the motor on and off using labview. I have used a modbus simulator to communicate with the driver and can do everything I want to do through the simulator. I can not get labview to do anything for me. I would be very happy if someone could direct me to a tutorial that can help me understand labview dsc module for reading and writing to addresses using modbus. 

 

Meesh

0 Kudos
Message 1 of 10
(3,707 Views)

I am wondering how to set the address I want to write to on the shared variable and how to send a number to that address.

 

Right now I am going to the Create Bound Variable option and choosing the 400001-465535 for writing to int16 unsigned address, I am "adding a range" and then I am specifying 400126 which I am assuming is setting the addres to 126 (I really want address 125 so I have accounted for the +1). After creating this bound variable, I am dragging it to the Block diagram, changing the access mode to write, and adding the constant "16384" which is the number that should turn the motor to the "ON" state in base ten. 

 

Am I on the right track here? Does LabVIEW use base ten numbers? Or should I be making the constant in binary or hexadecimal form? 

 

Thank you for your help,

 

Meesh

0 Kudos
Message 3 of 10
(3,618 Views)

Having DSC Modbus IO Server will expose all the registers through Shared Variable Engine.

 

You can also read/write the shared variable exposed by IO server using the Shared Variable API's. Use the distributed system manager to explore and view and debug the communication.

 

Check the shared variable example programs comes with LabVIEW

0 Kudos
Message 4 of 10
(3,605 Views)

What does this error mean?? Error -1967353911 occurred at Shared Variable

 

The communication port is correct. I had this program running just fine yesterday, I made no changes and now it won't work today. Any troubleshooting advice for me?

0 Kudos
Message 5 of 10
(3,541 Views)

Ok, so this is really strange. I solved my problem in a round about sort of way. I'm using a modbus simulator (mdbus) to help me communicate with the driver/stepper motor so I know which address to use. But after I use the simulator I get a communication port error when I try to use Labview. It's like the port is locked in with the simulator and I can't end the connection and let Labview use the same communication port. I can't find anyway to fix the problem except going to this NI site: http://www.ni.com/download/labview-run-time-engine-6.1/746/en/  downloading this software and using the "repair" function. Then I can do a system restart and cycle the power on the driver/motor and then Labview with work again through the correct port. But if I need to use the simulator again then I have to go through this whole process again. Does anyone know what the heck is going on? Or if there is a better way to clear the communication port?? 

0 Kudos
Message 6 of 10
(3,537 Views)

Is there no way to clear the port in mdbus? Can you select a different port in mdbus and see if that clears it?

David H.
National Instruments
0 Kudos
Message 7 of 10
(3,498 Views)

I am in a similar situation.  When mine locks up there is nothing I can do but come back tomorrow.  This has happened several days in a row.  One of the modbus devices I am communicating to (Watlow SD heater controllers) will go on vacation.  Then next morning they are all back to work.  I start a run and at some point after a couple of hours one freezes up.  Then next day fine.  This has happened several days in a row.  

0 Kudos
Message 8 of 10
(3,337 Views)

Are you also receiving same Error -1967353911 or are you reffering to some other issue?

Are you using LabVIEW DSC? If yes, which version? 

Is there anything else that is trying same modbus ports?

 

Providing more details can help us give you better troubleshooting steps.

0 Kudos
Message 9 of 10
(3,311 Views)

If you open distributed systems manager and navigate to your modbus I/O server there should be a flag for communication errors. That might give some hint as to whats happening.

 

Also rather than repairing the whole runtime system, you might go to the I/O server in DSM, right click, and select stop process.

 

While you're in there, make sure you only have 1 I/O server. I've seen before where people (ahem, totally not me) make two I/O servers using the same resource and they conflict.

 

Lastly, if all you want to do is toggle a bit, you might just use the modbus Library. Its included in 2014 for DSC and RT, here (https://decibel.ni.com/content/docs/DOC-30140) for 2012+, and here (http://www.ni.com/example/29756/en/) for legacy applications. This can also help with debugging, since it returns more direct errors.

0 Kudos
Message 10 of 10
(3,302 Views)