LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Serial in Labview 7.1

I have been trying to get LabView to talk to my Modicon Micro PLC via Modbus serial but haven't had any success. I tried to follow the application note for talking to a touchscreen via serial modbus but can't get the comm lights to flash on the PLC at all meaning I must not be sending anything out the serial port. I know for sure that I can talk to the PLC using ProWorx over the serial port so I know that the hardware is working. I tried version 3 of VISA like the application note stated but then also upgraded to the latest version and still have had no luck. I have been also trying to use the VIs that came with the nimodbus library, downloaded from the NI website. I would like to use the PC as a master and build a control/monitoring screen for the Modicon Micro. Could anyone please help? Thanks!

I'd love to go get the DSC module for LabView that includes drivers for talking ModBus to PLCs but I can't afford the $3000 for that addon.

Jeremy


Message 1 of 11
(6,565 Views)
Hi Jeremy,

I am not sure what Application Note you're referring to. But I have succesfuly used the NI Modbus library. So, I can help you with that, if that's the route you want to try.

In any case, you will first need to find out the Modbus IO addresses you want to read/write. As part of this you will also find out the type of IO item, i.e., a holding register, a coil, etc. This will help you select the right function code in the Modbus Master query.

And yes, your PC will be the Modbus Master, and the device will be the Modbus Slave. You can start off by playing with the Modbus Master and Slave examples included in the library. For this, you can loopback two COM ports on your PC, if available.

I guess once you start trying out things, you can post your progress and any issues. And we can try to help then.

Regards,

-Khalid
Message 2 of 11
(6,554 Views)
Are you trying to talk to a Modicon TSX Micro plc from Telemecanique?? What is the part number for your device??
0 Kudos
Message 3 of 11
(6,547 Views)
Thanks for the replies.

Khalid: The application note I am reffering to is  http://zone.ni.com/devzone/conceptd.nsf/webmain/3166EB59237BB74286256F5500789D5A . In my PLC, I have included a move function to move a number, "123" into holding register 40001. Using the Modbus Serial Master Example VI as a starting point, I changed the command to "Read Holding Register", changed the modbus address to 1 (PLC address), changed the COM port to COM 1, made sure the other COM settings were correct, and then attempted to run the VI. I left the IO address at 0 because I thougth I read somewhere that you don't enter the full address (40001), you leave out the command and just enter the point address. You also need to start at zero for point one, don't you? Reading through the block diagram, that Modbus Serial Master Example VI is supposed to check for changes to the inputs, and if something has changed, write it out. After doing that, it looks like it is supposed to read the discrete inputs and then read my holding registers. I at least expected to have the COMM lights flash on the PLC, but I get nothing.

I went into MAX and looked at my device settings and can see COM 1 as NSTR1 and can see that it is functioning properly. Do I need to have the VISA server running? Is there anything else that I need to have running? What did you use these drivers for? Do you have any of the VIs that you used still?

unclebump: I am using a Modicon Micro 110 CPU 612
PLC. It's one of the older Modicons. It works great for what I need though.

Message Edited by Squiddy1 on 08-25-2006 10:03 AM

0 Kudos
Message 4 of 11
(6,531 Views)
Message 5 of 11
(6,516 Views)
You are right that with these VIs we leave out the "4" part and just use the item number, and that too decrement by one since it's zero-based. And no, you don't need to do anything special with the VISA stuff.

Do you get any errors at the MB Serial Master Query.vi?

You may want to use a Serial port monitor, like Portmon for instance, and check what's going in/out of the port.

The last time I used these VIs (Ethernet version though) was for communicating with a HMI Panel display from a Compact FieldPoint.

Regards,

-Khalid

Portmon can be downloaded from here:
http://www.sysinternals.com/utilities/portmon.html

Message Edited by Khalid on 08-25-2006 09:33 AM

0 Kudos
Message 6 of 11
(6,515 Views)
Thanks Khalid and unclebump. I will try that library, look for errors and have a look at the serial data when I can get on a computer with LV tonight. I will let you know.

Jeremy

Message Edited by Squiddy1 on 08-25-2006 10:35 AM

0 Kudos
Message 7 of 11
(6,512 Views)
Unclebump!!! That my modbus serial query VI worked! I don't know what I was doing wrong but I will have to go through the block diagram and figure it out! I'm so happy! Now I can get started building the display! Thanks soo much!

Jeremy


0 Kudos
Message 8 of 11
(6,492 Views)

Dear Squiddy,

                    MODBUS serial is to easy to understand, and uf you know the functionality of the MODBUS very well how it works, it ll be very easy for you to undersatnd it, cos it has designed so well, that you can simply start it and use it, and let me ask do you have the vi for MODBUS with you or only libraries, if you dont have one, tell me i will post it to you, and it will be just to start the vi with proper settings of MODBUS.

Thanks,

Nishant

0 Kudos
Message 9 of 11
(6,479 Views)
Nishant, thanks for the reply. I'm not sure which Modbus VI you are talking about. Using the master modbus query VI as a guide, I am building my own that will do everything I need it to. You are right, Modbus is very easy. I have done a lot of work with Modbus but never trying to interface it with a PC. I work in Water and Wastewater where I live and help to manage the SCADA system. I love this stuff!

The project I am working on where I am interfacing a Modicon Micro to Labview on the PC is for my fish tank. I want to set up a variety of sensors that will tell me tank and sump level, temperature, PH and a number of other parameters that will let me manage the tank more easily. I wanted to have a nice display to show all of these parameters. This is something that I could later put onto a touch screen and have right beside the tank. We will see!

Would this Modbus VI that you have include anything that would help me futher? Thanks!

Jeremy
0 Kudos
Message 10 of 11
(6,466 Views)