Best programming practices

Never download some final changes 5 minutes before you have to leave...

Unless you want to miss your plane ... again.

That example makes sense when you should use multiple one shots, but what about this:


---| |-----| |-----[ons]----------------------( )

If done with full knowledge of the consequences it can be powerful. But you usually end up with something ugly to troubleshoot or an approximation of what you were actually trying to achieve.

Don't fix wiring problems in the program without changing the circuit.
Name actuators by their effect rather than their position. Brake on - not cylinder retracted
 
In a PLC that has a major fault on divide by zero, always have a NEQ before a divide that uses a variable as the divisor.

Indirect addressing. If you MUST use it. Make sure to LIM check the pointer at each rung it's used. Never know when someone might punch in a number your not expecting online. Or use it on a HMI by mistake and crash your program.

NO MONSTER RUNGS!!! If you can't read the whole thing on your screen, break it apart. A future you will appreciate it.

Documentation Documentation Documentation Documentation!!
 
In a PLC that has a major fault on divide by zero, always have a NEQ before a divide that uses a variable as the divisor.

Indirect addressing. If you MUST use it. Make sure to LIM check the pointer at each rung it's used. Never know when someone might punch in a number your not expecting online. Or use it on a HMI by mistake and crash your program.

NO MONSTER RUNGS!!! If you can't read the whole thing on your screen, break it apart. A future you will appreciate it.

Documentation Documentation Documentation Documentation!!

Even better don't use PLCs that can't properly trap errors. (y)
 
Instead of sequencers... :sick: :D

Build in drum controllers have usually limited step count and can only drive couple outputs.
Also modification is on some PLC possible only when offline and download need stoppping PLC. For me these are reason to do own block.
 
one example:



--| |---|---------|\|------- ons---------( )
--| |---|
--| |---|

versus

--| |--ons-|---------|\|------- ---------( )
--| |--ons-|
--| |--ons-|




These bits of code have very differrent functions. The first rung triggers when any of the first of three XICs turn ON with the XIO OFF, or when any of the three XIC are on and the XIO turns OFF. The second triggers only when the XIO is off, but triggers every time one of the XICs turns ON, even if the other XIC were already on. This shows why multiple contacts should be used before a one shot.
 
These bits of code have very differrent functions. The first rung triggers when any of the first of three XICs turn ON with the XIO OFF, or when any of the three XIC are on and the XIO turns OFF. The second triggers only when the XIO is off, but triggers every time one of the XICs turns ON, even if the other XIC were already on. This shows why multiple contacts should be used before a one shot.


I should have added: Never! use the first example
 
I should have added: Never! use the first example

I'd like to know why.

Suppose I had 3 pumps that I wanted to trigger an alarm if they faulted, but I didn't want the alarm triggered if the system was out of service. What would be a better or more clear way to code it?
 
Not Mentioned Yet but important IMHO. Always Use Oneshots on Momentary HMI Buttons. At least on critical buttons such as reset, stop pump, etc. I have had to fix many programs with wierd problems where a stuck HMI key was the culprit.
 
No, he told me this when we were working with a Compact Logix. He said it's just good programming practice, not that it won't work. He said unless there's NO CHANCE that one can be true when the other comes true, don't use parallel instructions before a one shot.
 
Even better don't use PLCs that can't properly trap errors. (y)

My plc doesn't fault, but still turns a little icon yellow in the bottom of the status bar that I click on.

Annoys me like the voice mail icon on my phone.

Lamest reason for checking for zero and out of index, but hey, it's a reason.
 
I believe this is a problem in the SLC processors only. They have some additional restrictions on using one-shots.

restrictions? Nope, the instruction too powerful.

Well the only restriction I can think of is that the slc wouldn't set the EN bit on prescan but the PLC 5's would.
 
I'd like to know why.

Suppose I had 3 pumps that I wanted to trigger an alarm if they faulted, but I didn't want the alarm triggered if the system was out of service. What would be a better or more clear way to code it?

All I got right now. I would fire you if you programmed that w/o a really good rung comment.

scratch that.

I'd still fire your ***.
 
like I've always said. "Yup, it is working exactly as programmed".

Sorry for being harsh, but until I come up w/ something worse, than proof.....

This strange guy put ons on rungs w/ 0 leading contacts. some sort of hmi oneshot thingy.

He's in second place for lack of comment only.

Kind of ingenious in a way if you happen to go to pizza hut w/ him.

I don't put the hot flakes on my **** to this day because of his stories.
 

Similar Topics

I've been doing PLC programming for about 15 years now but all of my experience has been with Allen-Bradley PLC's. A few months ago I started a...
Replies
5
Views
3,180
Hi All - I have a system that I am setting up with about 50 axes of motion. There are 10 stations total where 9 of them are exactly the same. I...
Replies
0
Views
1,383
If I have a program that requires 10 different PID loops should I 10 different period tasks (using RSLogix5000)?
Replies
4
Views
2,347
I am looking for Ladder programming Best Practices and Tips. My Background is mostly AB and AD some Omron. Just looking for things to use in...
Replies
28
Views
15,395
and go! I'll start. Always comment the Boolean instruction for their TRUE state. For example. It is much easier to read a normally closed contact...
Replies
65
Views
21,569
Back
Top Bottom