Controls Guy
Internal Dev
   
Posts: 1134
Darth Ladder
|
 |
« Reply #30 on: May 06, 2009, 11:15:40 am » |
|
Here's a non-stage version if you prefer. I like to do the power up-handler as a subroutine (SBR) at the end of the program so you can ignore it during normal review. I wanted to only set the pump bits and the alarm output once every second or so to avoid chattering the outputs, and would have done so inline, skipping it with a GOTO and LBL but the 05 doesn't support it, so that's in an SBR as well. I also added the pump permissive input you mentioned.
PLC 05
// Rung 1 // Address 0 STR X0 OUT Y0
// Rung 2 // Address 2 STR X0 AND X1 OUT Y1
// Rung 3 // Address 5 STR SP4 OUT C0
// Rung 4 // Address 7 STRPD C0 GTS K2
// Rung 5 // Address 10 END
// Rung 6 // Address 11 SBR K1
// Rung 7 // Address 13 ANLGIN K0 K0 K2 K0 V200
// Rung 8 // Address 51 STR SP1 LD K1000 OUT V210 LD K3000 OUT V211 LD K4000 OUT V212 LD K200 OUT V213
// Rung 9 // Address 60 RT
// Rung 10 // Address 61 SBR K2
// Rung 11 // Address 63 STR V200 V210 ANDN V200 V211 OUT Y2
// Rung 12 // Address 68 STR V200 V211 ANDN V200 V212 OUT Y3
// Rung 13 // Address 73 STR V200 V212 OUT Y4
// Rung 14 // Address 76 STRN V201 V213 OUT Y5
// Rung 15 // Address 79 RT
// Rung 16 // Address 80 NOP
#BEGIN ELEMENT_DOC "X0","On/Off switch","","" "X1","Pump_Permissive","","" "Y0","""System On""","","Indicator Light" "Y1","Pump On","","" "Y2","Fan speed 1","","" "Y3","Fan Speed 2","","" "Y4","Fan Speed 3","","" "Y5","Alarm Output","","" "V200","Channel 1","","Analog input" "V201","Channel 2","","Analog input" "V210","S.P. 1","","" "V211","S.P. 2","","" "V212","S.P. 3","","" "V213","S.P. 4","","Low Pressure"
#END
|
|
|
|
« Last Edit: May 06, 2009, 01:27:13 pm by Controls Guy »
|
Logged
|
I retract my earlier statement that half of all politicians are crooks. Half of all politicians are NOT crooks. There.
|
|
|
milldrone
Full Member
  
Posts: 38
I'm changing my attitude to thumbs up
|
 |
« Reply #31 on: May 06, 2009, 07:11:11 pm » |
|
imemotor, and Controlsguy
I took the liberty of adding some rung comments to Controlsguy's code (I hope he doesn't mind)
Now you can see some different styles of programming Controlsguy Vs. PLCnut.
Questions?
PLC 05
// Rung 1 // Address 0 STR X0 OUT Y0
// Rung 2 // Address 2 STR X0 AND X1 OUT Y1
// Rung 3 // Address 5 #BEGIN COMMENT "This rung sends the PLC scan to the subroutine every half second" "" "The next bit of text is a quote from Controlsguy" "" "Quote:" """I wanted to only set the pump bits and the alarm output once every second or so to " "avoid chattering the outputs, and would have done so inline, skipping it with a GOTO and " "LBL but the 05 doesn't support it, so that's in an SBR as well.""" #END STR SP4 GTS K2
// Rung 4 // Address 8 END
// Rung 5 // Address 9 #BEGIN COMMENT "imemotor," "" "This is a subroutine because it's after the ""end"" statement it is scanned only one time" "" "This section that Controlsguy has written only gets scanned during the first PLC scan after " "a powerup or a PLC transition from stop to run. " "" "On larger programs this kind of programming can make the PLC much faster." "" "He has placed some values for setpoints here also like LD k1000 then do you see the " """out"" underneath? this is one of your setpoints to compare against." "" "" "" #END SBR K1
// Rung 6 // Address 11 ANLGIN K0 K0 K2 K0 V200
// Rung 7 // Address 49 #BEGIN COMMENT "The values in this rung are just a guess. You have not given us any info on your " "temperature probe & transmitter and your pressure sensor and transmitter. So that we can " "help you scale them." "" "You can also write to the PLC from the HMI to these setpoints the PLC will overwrite them " "on powerup or a stop to run transition." "" "So in you HMI if you wite a value to ""V210"" this will be your new setpoint" #END STR SP1 LD K1000 OUT V210 LD K3000 OUT V211 LD K4000 OUT V212 LD K200 OUT V213
// Rung 8 // Address 58 RT
// Rung 9 // Address 59 #BEGIN COMMENT "The next bit of text is a quote from Controlsguy" "" "Quote:" """I wanted to only set the pump bits and the alarm output once every second or so to " "avoid chattering the outputs, and would have done so inline, skipping it with a GOTO and " "LBL but the 05 doesn't support it, so that's in an SBR as well.""" #END SBR K2
// Rung 10 // Address 61 #BEGIN COMMENT "I still think you need to check your VFD manual out for info on preset speeds." "" "These are normally done in a binary matrix" "" "Fan speed 1out Fan speed 2out Fan speed 3out VFD preset speed #" "ON off off = preset 1" "off ON off = preset 2" "ON ON off = preset 3" "off off ON = preset 4" "ON off ON = preset 5" "off ON ON = preset 6" "ON ON ON = preset 7" "" #END STR V200 V210 ANDN V200 V211 OUT Y2
// Rung 11 // Address 66 STR V200 V211 ANDN V200 V212 OUT Y3
// Rung 12 // Address 71 STR V200 V212 OUT Y4
// Rung 13 // Address 74 STRN V201 V213 OUT Y5
// Rung 14 // Address 77 RT
// Rung 15 // Address 78 NOP
#BEGIN ELEMENT_DOC "X0","On/Off switch","","" "X1","Pump_Permissive","","" "Y0","""System On""","","Indicator Light" "Y1","Pump On","","" "Y2","Fan speed 1","","" "Y3","Fan Speed 2","","" "Y4","Fan Speed 3","","" "Y5","Alarm Output","","" "V200","Channel 1","","Analog input" "V201","Channel 2","","Analog input" "V210","S.P. 1","","" "V211","S.P. 2","","" "V212","S.P. 3","","" "V213","S.P. 4","","Low Pressure"
#END
|
|
|
|
|
Logged
|
Vaughn
|
|
|
Controls Guy
Internal Dev
   
Posts: 1134
Darth Ladder
|
 |
« Reply #32 on: May 06, 2009, 09:50:20 pm » |
|
Mind? Why would I mind? I got to do the fun part!  One thing though. I originally did STR SP4 GTS K2, but I think the internal clock bits are on a 50% duty cycle, so SP4 will be on for 0.5 sec, and off for 0.5 sec. I meant to do a differential but forgot. When I noticed I had posted a normal STR, I was going to go back and correct it, but then I noticed you can't do differential contacts on SP bits (what the heck?), so I changed it to: STR SP4 OUT C0 STRPD C0 GTS K2 and counted myself fortunate I got it changed real quick before Imemotor saw it! So the version you commented is slightly obsolete. Sorry about that!
|
|
|
|
|
Logged
|
I retract my earlier statement that half of all politicians are crooks. Half of all politicians are NOT crooks. There.
|
|
|
|
franji1
|
 |
« Reply #33 on: May 06, 2009, 10:35:02 pm » |
|
PD coil with C0 parm would work. What's good about having a differential function as a coil (in addition to contact) is that it is power-flow based, so you could have any combinational logic driving the PD.
If only there was a ONESHOT contact like the old TISOFT had in TI Series 500, then you wouldn't even need to burn a CR.
(cloud of logic)---] powerflow oneshot contact [------(GTS) (or MATH or whatever)
|
|
|
|
|
Logged
|
|
|
|
Controls Guy
Internal Dev
   
Posts: 1134
Darth Ladder
|
 |
« Reply #34 on: May 06, 2009, 10:44:13 pm » |
|
PD coil with C0 parm would work. Equivalent to what I did. Two rungs with four ops either way. What's good about having a differential function as a coil (in addition to contact) is that it is power-flow based, so you could have any combinational logic driving the PD. The differential coils don't enable that. Since you guys have the nice STRPD's and STRND's, you can still do the combinatorial logic with a regular out coil, then apply the PD or ND to the contacts of THAT coil. Plus this allows BOTH PD and ND, without having to commit to one or the other. Now that I think about it, I guess the unique advantage of OUTPD and OUTND occurs when you use them with a NC contact. If you do: [logic] OUTPD C0 STRN C0 [something enabled] you get the stuff enabled every scan EXCEPT the first scan [logic] is true, which is hard to do with OUT/STRPD. If that's the only contact on the second rung, you could do OUT/STRPD/NOT, but not if you want to use it in more complex logic. So OUTPD does distinguish itself! Plus (though I can't imagine why you would ever do this) you can do [logic] OUTPD C0 STRND C0 [stuff enabled] and get only the second scan! Talk about arcana. If only there was a ONESHOT contact like the old TISOFT had in TI Series 500, then you wouldn't even need to burn a CR. (cloud of logic)---] powerflow oneshot contact [------(GTS) (or MATH or whatever)
I know, those were great! I was having a discussion about that very topic with somebody a few months ago.
|
|
|
|
« Last Edit: May 07, 2009, 09:35:52 am by Controls Guy »
|
Logged
|
I retract my earlier statement that half of all politicians are crooks. Half of all politicians are NOT crooks. There.
|
|
|
|
b_carlton
|
 |
« Reply #35 on: May 07, 2009, 09:52:08 am » |
|
Just remember the limitation of STRPD and STRND when working with a bit location which is affected by the ladder logic (C or Y for example). The instructions only function as expected AFTER the last OUT, SET, RST or whatever in that scan. The instructions do not wrap around to work BEFORE these rungs on the next scan.
|
|
|
|
|
Logged
|
An output is a PLC's way of getting its inputs to change.
|
|
|
Controls Guy
Internal Dev
   
Posts: 1134
Darth Ladder
|
 |
« Reply #36 on: May 07, 2009, 10:06:46 am » |
|
Are you serious? I'm working on an AD PLC today and I'll have to check that out.
|
|
|
|
|
Logged
|
I retract my earlier statement that half of all politicians are crooks. Half of all politicians are NOT crooks. There.
|
|
|
imemotor
Newbie

Posts: 6
|
 |
« Reply #37 on: May 07, 2009, 10:21:01 am » |
|
Gentlemen,
Thanks for your help, you have given me a great jump start to programming. Actually the only problem I am having now is to get the PLC to acknowledge my analog sensors. Seems like it should be easy but I can’t get it to work. Analog card F0-04AD-1 Temperature transmitter TTD25N-20-0300F-H Pressure Transmitter PTD25-20-0100H My PLC is D0-05AR
I have figured out that the + - sensor leads don’t just plug into the analog card + - channel slots, apparently you need a separate 30V DC power source. My PLC is AC with no DC power supply, so I have a separate DC power source running through the analog sensors back to the channel inputs on the analog card but is still doesn’t work.
I’m thinking maybe my sensors need to run through a step down resistor?
IMEMOTOR
|
|
|
|
|
Logged
|
|
|
|
|
|
Controls Guy
Internal Dev
   
Posts: 1134
Darth Ladder
|
 |
« Reply #39 on: May 07, 2009, 10:40:31 am » |
|
Gentlemen,
Thanks for your help, you have given me a great jump start to programming. Actually the only problem I am having now is to get the PLC to acknowledge my analog sensors. Seems like it should be easy but I can’t get it to work. Analog card F0-04AD-1 Temperature transmitter TTD25N-20-0300F-H Pressure Transmitter PTD25-20-0100H My PLC is D0-05AR
I have figured out that the + - sensor leads don’t just plug into the analog card + - channel slots, apparently you need a separate 30V DC power source. My PLC is AC with no DC power supply, so I have a separate DC power source running through the analog sensors back to the channel inputs on the analog card but is still doesn’t work.
I’m thinking maybe my sensors need to run through a step down resistor?
IMEMOTOR
Refer to http://web1.automationdirect.com/static/specs/f004ad1.pdf for wiring. The "+" shown in that diagram at the transmitter is Pin 1 on your temp transmitter (brown if using AD cable) and the "-" is Pin 2 (white). The pressure transducer is probably similar. So DC+ to transmitter brown, transmitter white to PLC CH1+, CH1- to DC -, and also ground the DC-.
|
|
|
|
|
Logged
|
I retract my earlier statement that half of all politicians are crooks. Half of all politicians are NOT crooks. There.
|
|
|
|