Jump to content

How to setup the Modbus slave in the RealTime cFP device?


Recommended Posts

Hi,

I am currently working on a project which require to implement the Modbus Slave in the cFP 2120.

+The first thing I know is I cannot use the shared variable bind to modbus because this device does not support modbus (only cFP 18xx). This is confirmed by application engineer of NI.

+By searching some forum, I know that we can use the Modbus library inside the FP device. But I am not clear how to lunch the Slave demon VI. Actually I don't know how to use this library in the FP device. Should I add the library as a folder and then use the VIs in this library?

I tried to add the MB Ethernet Example Slave into the target, and run the MB Ethernet Example Master on the host PC, but it didn't work. Then I tried to build the RT executable file and deploy it into the FP, and it didn't work either.

+By the way, could you tell me how can I change the address of the register in the modbus I want to use ?

I highly appreciate your helps,

Best regards,

Thang Nguyen

Link to comment

QUOTE(Thang Nguyen @ Sep 17 2007, 05:04 PM)

+The first thing I know is I cannot use the shared variable bind to modbus because this device does not support modbus (only cFP 18xx). This is confirmed by application engineer of NI.

I feel fairly confident in saying that your NI engineer is mistaken, since I've done exactly this using an FP-2010. I suspect that the NI engineer thought you were asking about direct Modbus access to the modules (or using OPC) which I believe is possible with the 18xx. It is worth using the Modbus I/O server on the Fieldpoint module as it is much easier to use than the Modbus library.

You asked about a similar situation in another thread; did you ever resolve whether your shared variables were working properly, independent of the Modbus binding?

Link to comment

QUOTE(ned @ Sep 17 2007, 04:33 PM)

I feel fairly confident in saying that your NI engineer is mistaken, since I've done exactly this using an FP-2010. I suspect that the NI engineer thought you were asking about direct Modbus access to the modules (or using OPC) which I believe is possible with the 18xx. It is worth using the Modbus I/O server on the Fieldpoint module as it is much easier to use than the Modbus library.

You asked about a similar situation in another thread; did you ever resolve whether your shared variables were working properly, independent of the Modbus binding?

I did solve the problem about the shared variables which bind to the modbus. Form the PC, I can read the data through the shared variables already. But when I tried to use a Modbus Simulator to simulate the Modbus Master, I cannot read anything form the same adderss. Because in this project, I use the PI Server to read from the modbus. It's not a VI run on the host machine. I don't know what is the real problem with it, I tried some simulators already. Could you give me some recommendations?

Thank you,

Thang Nguyen

Link to comment

QUOTE(Thang Nguyen @ Sep 17 2007, 05:04 PM)

If you're asking how to change the address of the register using the Modbus I/O Server, you need to type in the number yourself after you select the address range, in the shared variable properties. This wasn't obvious to me at first but you've probably already figured it out. I also found that the IO Server allows one digit more of the address than the Modbus master I used, and to fix this I removed the second digit (starting from the left - highest order) from the address. That is, I assigned 4000001 to a shared variable, and I set the master to read from 400001.

QUOTE(Thang Nguyen @ Sep 17 2007, 05:57 PM)

I did solve the problem about the shared variables which bind to the modbus. Form the PC, I can read the data through the shared variables already. But when I tried to use a Modbus Simulator to simulate the Modbus Master, I cannot read anything form the same adderss. Because in this project, I use the PI Server to read from the modbus. It's not a VI run on the host machine. I don't know what is the real problem with it, I tried some simulators already. Could you give me some recommendations?

I'm not familiar with the PI Server, nor unfortunately can I suggest any simulators other than to suggest that if you have a second Fieldpoint module available you could make one of them a master and the other a slave. If you're using Modbus over TCP/IP, is it possible that you have a firewall or other network permissions set in a way that limits access to your Fieldpoint module? As a very basic check, try opening a Windows command window and run "telnet <fieldpoint.ip.address> 502" to see if you can connect.

Link to comment

QUOTE(ned @ Sep 18 2007, 02:19 PM)

If you're asking how to change the address of the register using the Modbus I/O Server, you need to type in the number yourself after you select the address range, in the shared variable properties. This wasn't obvious to me at first but you've probably already figured it out. I also found that the IO Server allows one digit more of the address than the Modbus master I used, and to fix this I removed the second digit (starting from the left - highest order) from the address. That is, I assigned 4000001 to a shared variable, and I set the master to read from 400001.

Could you tell me more detail about this? I am not clear about why there is the different between the address of the shared variable in modbus slave 4000001 and shared variable in master 400001.

What I have tried to do is in the target I create the Modbus Slave Server and 1 variable bind to it. In the host PC, I create the Modbus Master Server and 1 variable bind to it. All of the variable have the same address. I cannot read anything form the variable on the Modbus master.

Thanks,

Thang Nguyen

Link to comment

QUOTE(Thang Nguyen @ Sep 19 2007, 10:41 AM)

Could you tell me more detail about this? I am not clear about why there is the different between the address of the shared variable in modbus slave 4000001 and shared variable in master 400001.

What I have tried to do is in the target I create the Modbus Slave Server and 1 variable bind to it. In the host PC, I create the Modbus Master Server and 1 variable bind to it. All of the variable have the same address. I cannot read anything form the variable on the Modbus master.

Thanks,

Thang Nguyen

Different Modbus implementations may use slightly different forms for addresses; that's why in my case the master and slave addresses did not match. You may not have a similar problem if your master and slave agree on the number of digits in the address.

Other than that, I'm not sure why you're having problems. Are you certain you're specifying the remote address (for Modbus over TCP, the IP address of the remote machine) properly? Are you communicating over ethernet or a serial connection? Have you tried connecting a null-modem cable between the Fieldpoint module and your host PC, and running Modbus over the serial port?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.