
adccommunitymod (AutomationDirect) asked a question.
Created Date: November 01,2008
Created By: Al A
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
Hi all, 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 experince, but that was some time ago and mostly machine language on microcontrollers. I have some long-ago familiarity 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 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
Created Date: November 03,2008
Created by: Kristjan H
You could actually do it in four rungs if you used Y0 directly as an output on the first rung and Y1 on the third. There really isn't any need for rungs 2 and 4.
Personally, I like using SET and RST instructions more than self-latching rungs. I find it more readable but this requires more rungs. You should also check out the PONOFF instruction. It is helpful in toggling bits on/off.
In the Documentation Editor you are only using the Nickname column. That one is limited to 16 characters. The Description column gives you more freedom to document.
Created Date: November 07,2008
Created by: Al A
Thank you for the reply.
I will look into the instructions you mention, and maybe try working out the same program using those, just to get a feel for how that all works.
I appreciate your taking the time to respond.
Best regards,
Al
Created Date: November 22,2010
Created by: jblkiller
Dl05
Can we do the same program door opener with the PLC Dl05?
Thanks
Created Date: November 23,2010
Created by: Shimmy
I like to use "c " bits in the body of the program, then group all of the "y " bit output coils together at the end in numerical order. This helps troubleshooting (espicially in larger programs).
You may also want to add a manual mode to open or close the door while you hold down a button. This would require another input (auto/manual switch).
You could also add a cycle counter. I automatically put cycle counters in every program, though it may be unnecessary in this case.
I think you should also get in the habit of using a v-memory location for your timer preset as opposed to a K value.
You did a pretty good job in my opinion. It is a small program, so there is not a whole lot to critique.
Created Date: November 01,2008
Created by: Al A
Hi all,
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 experince, but that was some time ago and mostly machine language on microcontrollers. I have some long-ago familiarity 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 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