Coding style...

Davek0974

Member
Join Date
Nov 2014
Location
Hertfordshire, England
Posts
145
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

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...
Replies
1
Views
257
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...
Replies
15
Views
5,295
I have a Mitsubishi FX2N-64MR-UA1 processor. The 1st analog output card is an FX2N-4DA. It requires 24VDC power. That card is obsolete. The card...
Replies
1
Views
1,562
I has a requirement, in 87-90 minutes need increase the burner to 280 degree celcius and every minute only can increase 3 degree celcius. The...
Replies
23
Views
5,288
Hi All, I am trying to use FactoryTalk studio for SCADA design. How is the scripting done? I have previously worked with Ignition SCADA, and...
Replies
5
Views
2,005
Back
Top Bottom