Jump to content

Recommended Posts

Hi,

 

I'm writing an application involving 1 master and 9 slave controllers - all Unitronics.

 

The master PLC is a V1210. One of the slaves is also a V1210. The remaining 8 slaves are V130s.

 

All i'm trying to do is sequentially read 1 coil from each of the slave PLCs. I know that this should be ridiculously easy...

 

...However, I'm finding that the "Function in Progress" bit gets stuck on after the master only attempting to read from 2 of the slaves.

 

I've tried using timers of 100ms - probably excessive - after each Modbus Read Coils function block.

 

Also, just to mention, I don't have all 9 slave controllers with me for testing - I've got 2. Is Modbus good at handling when it can't get thru to a particular node and just moving on to attempt the next one?

 

 

 

Any help much appreciated,

James

 

 

Share this post


Link to post
Share on other sites

It is absolutely possible to sequence communications to any number of devices.

 

How are you sequencing between each read command? Would it be possible to post your code?

 

Also, what is the status message of each of the Modbus read/write commands?

  • Upvote 1

Share this post


Link to post
Share on other sites

Hi Alexander,

 

Thanks for the quick response. :)

 

I'm using a memory bit for the read request to each PLC. I'm using a direct contact of this memory bit in series with the inverted contact of Modbus Function in Progress. I'm setting the MB for the next device to be read and resetting the MB for the device requested for read in the current Ladder rung.

 

The Modbus status code alternates between 4 and 5 for a device that's not connected during the test. This is where Function in Progress also gets stuck on.

 

 

 

- James

Share this post


Link to post
Share on other sites

Use modbus aperiodic in toolbox (set the command and when done reset the command) and by Protocols modbus master chose working mode aperiodic.

 

If you already have a sollution i would like to no it too

Share this post


Link to post
Share on other sites

The problem may not be the sequence but the fact that a reliable connection can not be made. If you cannot communicate then the unit will constantly be re-trying communications which will have it appear as if the function in progress is locked on. This is because the unit will be sending Modbus read/write requests as fast as possible which trigger the function in progress bit.

 

I would recommend trying to communicate with only a single device to ensure that communications can be established and the wiring is correct.

 

If you still experience issues please post your code in the forum or send your project to support@unitronics.com for further troubleshooting assistance.

  • Upvote 1

Share this post


Link to post
Share on other sites

Hi Alexander,

 

Thanks again for your assistance.

 

Yes, when i looked up the corresponding meanings of Modbus status codes 4 and 5, i saw that it was an issue of not being able to connect to the target slave controller.

 

Further to what you're saying, the Modbus RC operation is successful for the 2 controllers that are actually connected in this test setup.

 

What i need though is for the master controller to keep looping through reading the coils on each of the slave controllers after a say 5-second interval. It's important for the master controller to be able to skip over communicating with an unreachable slave on each iteration and just carry on. Any thoughts on how to achieve this?

 

Many thanks again,

James

Share this post


Link to post
Share on other sites

It is not advisable to run any sequence off of a set timer. In the case that one of the devices loses communications it will attempt to reconnect based upon the settings in the Modbus configuration block. For example if the retries is set to 3, the unit will attempt to connect once, then if that fails it will try 3 additional times for a total of 4 attempts. The timeout will also delay the second block from communicating. If the timeout is set to 100ms then it will delay for a total of 400ms if the unit is not connected. Over multiple slave units this could exceed the starting sequence and prevent any slave that is sequenced later to fail.

 

As you mentioned we recommend setting a coil that will power each step. The set contact (linked to the set coil) in addition with an inverted contact to the function in progress can trigger the Modbus function. After being triggered it can reset that step and set the next step. This will allow the PLC to process as fast as possible without the use of timers.

 

The only other way to attempt to reduce the interval is to decrease the timeout and the number of retries.

  • Upvote 1

Share this post


Link to post
Share on other sites

Hi Alexander,

 

I tried to upload the program here, but the file size is too large - even when zipped.

 

I initially wrote the logic for this sequence without timers, but then added them in because the routine wasn't working. I've now removed the timers. I found that what was actually causing the routine to get stuck on attempting to connect to an unavailable slave was an always-on contact that kept starting the process again. The sequence started to work when i fixed the issue with that contact.

 

Thanks again for all your help. :)

 

- James

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
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...