Coding style...

Finally got rslogix updated, unlocked and running on my new laptop and started re-learning all the stuff I've forgotten since I used it about 9 years ago!

I've attached a screenshot below as I don't know how to get nice clean ladder samples uploaded :)

Could someone let me know if the style of coding is reasonable, I like labeling ins & outs etc so i can find them easily, addresses that are not referenced elsewhere like OSR bits are left blank.

The section shown is the one discussed in my "Flip-Flop" thread.

Thanks

New Bitmap Image.jpg
 
Dave,

The "style" of your code is of course secondary to function and will develop and evolve as you practice your craft. I wouldn't worry about it. Does it make sense to you? Will it make sense to you if you look at it a year from now, at 3am and a couple in? Can your friendly local maintenance tech understand it? Does it work? These are the questions you should be asking yourself.

For my part, the way you have used descriptions, symbols, and comments looks fine to me.

On another note, your rung 4....while there is nothing technically incorrect about your rung, it will certainly change the state of O:4/01 each time B3:0/03 fires, but the way it is written hurts my brain. Think how that rung would look to a non-programmer who had never seen a flip-flop. The rung looks self-contradicting at first glance. Try pasting this in its place and see if it doesn't look better:

Code:
BST XIC B3:0/03 XIO O:4/01 NXB XIO B3:0/03 XIC O:4/01 BND OTE O:4/01

The above is actually two less instructions than your rung, because it eliminates an unnecessary BST/NXB pair.
 

Similar Topics

Hi everyone, Quick question about faceplates in WinCC Unified. I'm trying to figure out if there's a better way to handle faceplate versions in...
8
Replies
1,212
Views
I've been playing around with Arduino and the esp32 c6 with LCD display and I've come to realize that many of the AI platforms are able to draft...
35
Replies
4,663
Views
Not sure of best way to get ahold of Forum Admin but I imagine they'll see this or someone who knows can tag them. This site is already...
2
Replies
1,113
Views
Hello, I was wondering if anyone has a ControlLogix block or routine for encoding and decoding base64. I figured I would ask before diving into...
1
Replies
936
Views
Hello All, I hope we are all doing great and have a healthy and happy 2023!! I was wondering if anyone could help me decode this Motor Name...
15
Replies
9,698
Views
Top