rdrast said:Why is this a definiton of a 'Good' program?
IMHO, a 'Good' program, is one that achieves the desired result, and is readable and maintainable.
AMEN!!!
rdrast said:Why is this a definiton of a 'Good' program?
IMHO, a 'Good' program, is one that achieves the desired result, and is readable and maintainable.
Many of us old-timers started out with control systems that operated exactly like that, with relays operating other relays. It only seems "normal" to write a PLC program the same way. Program "Jumps" were not invented until computers were invented.....that had relays operating relays operating relays
Stationmaster said:If I may weigh in.....
I have one (1) machine type (out of 60 or so) in which I use a "jump" instruction.
For the most part, I don't like them for all of the reasons listed so far.
The case in which I DO use one is a machine that TRULY has 2 distinct operating modes. The two different modes are: "normal operation", and "recharge". When in "recharge" the machine behaves totally differently from "normal" mode. The timing is different, the reasons to start and stop pumps are different, and there are extra devices and indicators to manage.
In this situation, I have basically written two different programs. I determine which mode applies, and JUMP all of the logic associated with the other mode.
I can imagine a system with several operating modes, requiring more JUMPS, BUT to perform standard, ladder operations in some tricky way with jumps, is IMHO just asking for trouble. Can a good programmer understand it? Sure. Will it work? Sure. Do I recommend it? No.
Stationmaster
Tharon said:When programming a machine that has multiple different operations, I prefer seperate subroutines for each different operation. These subroutines are activated using some Seperate selection logic.
Physical Inputs turn on different bits for each routine based on the selection logic, and bits inside the routines turn on their respective output. That way everything is seperate and easy to understand. If you want to see the ladder for Normal you click on the subroutine for normal, and same for the Recharge.
I'd rather have a slightly larger program (Which you would have) than a program that just jumps around like crazy to try and reduce the number of rungs or data tables.
Doug Hylton said:There are some people who believe that a man should only eat vegetables and that meat and the jump instruction are unclean. There are other people who love eating meat and use all the tools god has given them.
I believe its wrong to go into the house of a man who refrains from eating meat and only eats nuts and berries and then offer him a Big Mac and say “You must eat this and use jumps in your program”.
It is also wrong to go into to a mans house who eats meat and tell him what you are doing is unclean and a sin.
All things come from god including the jump instruction. All things are clean it is only what you think is unclean that is unclean.
Doug Hylton
LITTLE KNOWN FACT:jeebusmn said:Like what Einstein said, [size=-1]"Everything should be made as simple as possible, but not simpler."
[/size]