Jump to content

Pseudo-Parameterized Subroutine w/ Data Tables

Recommended Posts

I've seen references to an example project using data tables to create a kind of parameterized subroutine. However, I cannot find the example in the installed examples (Visilogic 9.4). Would someone be able to help me find this - or a similar example. I suspect I know how to approach this, but it's always nice to see an example.


Link to comment
Share on other sites

  • External Moderators

There are two main reasons people look into using this method - reducing code line count and implementing some level of code portability.

Reducing code line count stems from two laudable goals - reducing overall complexity and improving scan time. But ten minutes of serious review shows that this method does neither - in fact, the opposite.

The way the code is structured under this method, it loads a different set of IO, timers, what-have-you into the ladder routine, processes it, then repeats using the next IO block. True, you only need one subroutine to manage multiple identical stations, but the complexity of loading, unloading (it's all based on indirect addressing) and managing the time-slice takes all of this and turns it into an impenetrable black box to your typical maintenance man. You need to be a pretty advanced programmer just to make sense of this method - pity the poor sparky just trying to see if his input is lighting up.

With regard to scan time, some of the older PLCs, like the V280, had a scan time of up to 6 mS. Using this method 10 times on a bank of IO means each set is processed once every 60 mS. This latency can add up very, very fast.

As for portability, the ability to reuse the code in another application, it doesn't play out so well either. The idea is that you can drop the routine and data table in another program, and assign IO values in the DT, and take off. This might be achievable, but in practice, I rarely ever have machines designed so similiarly as to allow me get away with it. I end up having to restructure the table, add this, disallow that, and would have an easier and faster time doing it in plain old ladder.

Personally, I don't recommend using it.


Link to comment
Share on other sites

Thanks for the replies.

tmoulder: I agree entirely with your points. Well said. However, my application isn't a custom machine application - it's an OEM product. The PLC will be mostly, if not entirely, devoted to monitoring a CAN bus and setting, logging, and displaying parameters from one or more drives. Scan time is far less critical than in "normal" control applications. If scan time is less than 250ms, than everything will be fine. There will be limited control of the drives from the PLC and in those cases, I can reduce the scan time appropriately.

Link to comment
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.

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