Jump to content

Newbie Looking for Guidance


Recommended Posts

Hello All,

I'm new to Unitronics and PLC programming as a whole. I have been an automation programmer for 20 years in other fields so programming is not foreign to me. I have been working with Unitronics support but they seem reluctant to offer up suggestions on how things should be programmed. Would someone be so kind as to critique the program that I have attached? A little info on the program. There are two analog sensors configured, they're 4-20 pressure sensors that range from 0-700psi. I also have a Dwyer differential pressure sensor, Door Sensor ( to see if someone opened the chassis ) Estop Sensor ( push button )

Any help would be greatly appreciated!

DisV Sandfly 20190417 NRB.zip

Link to comment
Share on other sites

  • MVP 2023

I don't have time to got through your logic in detail, but here are a few suggestions as to best programming practices:

1) Do not rename the Main Routine. Use it for Power-Ups, configurations blocks, and subroutine calls only.

2) Do not place multiple logic threads in a single ladder rung, as you have done in Rung 4 of Relay Control.

3) It is usually best to keep the logic simple and use more ladder rungs. You will not run out of rungs.

4) Rung 1 of Relay Control should probably be simplified (break it up into multiple rungs) and I think it's odd that you are using a direct contact activating an Increment function. You will be incrementing that register on every scan until the HMI button is released. Use a Positive Transition contact unless you are trying to count how many scans go by during a button press for some unfathomable reason.

That said, most of your code looks pretty good and your HMI screens are terrific.

Link to comment
Share on other sites

Thank you for your kind critique.

1) Great to know thank you I will restructure

2) I will look into a more refined way of doing this, really It's because I wanted a parallel function of being able to manually trigger the relays for testing as well as have them be triggered by the system state/scheduler

3) Ok.

4) I will try to find a way to simplify. I was guided by tech support to use the increment function as a way to test and see if the relays were actually firing. It's only for testing purposes really. I'm still trying to get the different between the different contacts and coils. We don't use this terminology in my other programming languages but they're also based off Boolean logic so somewhat similar.

Thanks I take pride in a clean UI


The main reason I reached out to the group is that our first PLC crapped out during testing the relays ( or it never worked to begin with ) I was told by support my previous version of the program may have burned the relays out because I was switching them on and off too fast. So I just wanted another set of eyes on it to be sure I didn't have any really big issues.

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