Hi all,
Firstly, I realize this forum seems to focus on the DS software and what follows is more "general PLC" stuff. If this is inappropriate here, feel free to direct me to a more appropriate forum. (Thanks!)
Anyhow, I am just getting into the whole PLC thing. I am doing a project at work that involves some automation, and this seems to be the best way to go about it. I have some time that I am using to get up to speed on all of this. I have some programming experitnce, but that was some time ago and mostly machine language on microcontrollers. I have some long-ago familarity with ladder logic, but that was with very simple (and old) systems, and was implemented using real relays, timers, etc.
I will be using an AD DL06, which is a bit of overkill for the application, but not much and it will allow for future upgrades and the feature expansion that tends to happen on these sorts of projects. I have the PLC at my desk and have been fooling with it and the DS5 software for a bit. I am planning to use the stage programming approach and have been reading and studying a bit about that. In the AD manual for the DL06, there is a good tutorial on the subject. The example they use is a garage door opener (page 7-8 of volume 2 in the DL06 manual). I thought it might be a good mental exercise to try to work out a program to implement the same garage door functions using "regular" ladder logic before delving into the whole Stage programming concept. Mostly to see if I could.
I have exported the program and it is pasted below. It works as it should, which was pretty satisfying once I got that far. What I would appreciate is if any of you pros, gurus, and mavens could critique my program a bit. Maybe point out what could have been done better, easier, simpler, faster. What about my program might indicate that it was written by a beginner? Am I overlooking anything?
Comments or criticisms, please? Thanks for any insight!
-Al
*******************Program follows************************************************
PLC 06
// Rung 1
// Address 0
#BEGIN COMMENT
"Rung opens the door when the button is pushed, "
"assuming the door starts from a fully closed position."
"if the door is neither fully opened or closed, it opens"
"X3 is a photocell safety switch"
#END
STR X0
AND X2
STR X0
ANDN X2
ANDN X1
ORSTR
OR C0
ANDN X1
ANDN C1
STR X3
AND C1
ORSTR
OUT C0
// Rung 2
// Address 13
STR C0
OUT Y0
// Rung 3
// Address 15
#BEGIN COMMENT
"Rung lowers the door when the button is pushed, "
"assuming the door starts from a fully open position."
#END
STR X0
AND X1
OR C1
ANDN X2
ANDN C0
OUT C1
// Rung 4
// Address 21
#BEGIN COMMENT
"This rung keeps the light on for 15 seconds after the door opens or closes."
#END
STR C1
OUT Y1
// Rung 5
// Address 23
STRND C0
ORND C1
OR C2
ANDN T0
OUT C2
TMR T0 K150
// Rung 6
// Address 31
#BEGIN COMMENT
"rung turns on lamp when door is opening or closing, and To keeps it on for 15 seconds "
"after the door stops moving."
#END
STR C2
OR Y0
OR Y1
OUT Y7
// Rung 7
// Address 35
END
// Rung 8
// Address 36
NOP
#BEGIN ELEMENT_DOC
"UB0","x0","",""
"UB1","to","",""
"X0","Operator button","",""
"X1","Up limit sw","",""
"X2","Down limit sw","",""
"X3","Safety switch","",""
"Y0","RAISE DOOR","",""
"Y1","LOWER DOOR","",""
"Y7","LAMP","",""
"TA0","light","",""
#END