
adccommunitymod (AutomationDirect) asked a question.
Created Date: June 22,2007
Created By: jamesjcooper
**** 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.****
Hello all, the amount of information on this forum is rather amazing. I just started playing with PLC's about six hours ago and learned ladder logic from various posts here, thank you all for the crash course. My question is how can I have a long timer, I want to fire a timer and have it hold an output on for 30 minutes and another for an hour. My application is in a vehicle and I want to be able to leave my inverter on for a period of time after I get out to finish charging batteries, or whatever else I have plugged in. I have gotten it to work with two shorter timers controlling the same output but just need to extend the time. 999.9 Seconds only gives me 16 minutes. Can I just daisy chain timers together? Basically have four 15 minute timers which when one ends starts the next? My hardware is a DL05 with a C-more non-touch panel. Using S bits for the control between the panel and the PLC. I appreciate any help and thank you in advance. Jim Cooper
Created Date: June 22,2007
Created by: sii
Check out the TMRA instruction. It lets you go up to 9999999.9 in increments of 1/10 second. It is a two input timer as opposed to a 1 input (TMR). The following should give you what you want, X0 being the trigger to start the timer, Y0 the output you wish to stay on. The "K50 " in rung 2 gives a 5 second timer, just change the 50 to whatever time you desire.
// Rung 1
// Address 0
STRPD X0
STR C0
ANDN T0
ORSTR
OUT C0
// Rung 2
// Address 5
STR C0
STR T0
TMRA T0 K50
// Rung 3
// Address 10
STR C0
OUT Y0
// Rung 4
// Address 12
END
// Rung 5
// Address 13
NOP
Created Date: June 22,2007
Created by: Kristjan H
You may also want to use counters with special relays (SP4 = 1 second, SP3 = 1 minute) as inputs. See http://forum1.automationdirect.com/board/Forum1/HTML/002625.html
Created Date: June 22,2007
Created by: jamesjcooper
Thank you for the help, I will try it when I get home.
I just want to make sure I am reading this right, that I will use TMRA but with only one trigger? I am just trying to visualize this as ladder rungs.
Created Date: June 23,2007
Created by: jamesjcooper
Ok, I got the TMRA working, I assume the top line is the trigger and the bottom in the reset?
My only problem remaining is that every time I reload the program, or cycle power to the CPU, all the timers activate, one of which is 3 hours. Is there any way to prevent this? In four words of ladder or less? (I am at 96 words and only have the free version)
Created Date: June 23,2007
Created by: sii
Do you know how to post your ladder logic here?
Created Date: June 24,2007
Created by: jamesjcooper
Like this?
PLC 05
// Rung 1
// Address 0
STR X5
SET S16 S16
// Rung 2
// Address 3
STR S1
OR S6
STRN X0
OR S16
ANDSTR
OUT Y1
// Rung 3
// Address 9
STR S2
OR S6
STRN X0
OR S16
ANDSTR
OUT Y2
// Rung 4
// Address 15
STR S3
OR S6
STRN X0
OR S16
ANDSTR
OUT Y3
// Rung 5
// Address 21
STRN S12
STR S12
TMRA T4 K3600000
// Rung 6
// Address 26
STRN S13
STR S13
TMRA T6 K10800000
// Rung 7
// Address 31
STR S4
STRN T4
ORN T6
AND S21
ORSTR
OUT Y4
// Rung 8
// Address 37
STRN S15
TMR T3 K6000
// Rung 9
// Address 41
STR S5
STRN X0
OR X5
OR S16
ANDSTR
STRN T3
AND S20
ORSTR
OR S15
OR X4
OUT Y5
// Rung 10
// Address 52
STRN S7
STR S7
TMRA T10 K1800000
// Rung 11
// Address 57
STRN S10
STR S7
TMRA T12 K3600000
// Rung 12
// Address 62
STRN T12
ORN T10
AND S20
STR S0
STRN X0
OR X5
OR S16
ANDSTR
ORSTR
ANDN X2
OUT Y0
// Rung 13
// Address 73
STR Y1
OR Y2
OR Y3
SET S11 S11
// Rung 14
// Address 78
STRN Y1
ANDN Y2
ANDN Y3
RST S11 S11
// Rung 15
// Address 83
STR X1
LD K5
OUT V3000
// Rung 16
// Address 86
STRN X1
LD K999
OUT V3000
// Rung 17
// Address 89
STR X1
LD K5
OUT V3002
// Rung 18
// Address 92
STRN X1
LD K0
OUT V3002
// Rung 19
// Address 95
END
// Rung 20
// Address 96
NOP
#BEGIN ELEMENT_DOC
"UB ", "T8 ", " ", " "
"X0 ", "Acc Power ", " ", " "
"X1 ", "Inverter Fault ", " ", " "
"X2 ", "Inverter Low Vol ", " ", " "
"X3 ", "Inverter Ok ", " ", " "
"X4 ", "Cargo Lights Inp ", " ", " "
"X5 ", "Acc Over Sw ", " ", " "
"Y0 ", "Inverter Relay ", " ", " "
"Y1 ", "H/L Strobe Relay ", " ", " "
"Y2 ", "Dash Light Relay ", " ", " "
"Y3 ", "T/L Strobe Relay ", " ", " "
"Y4 ", "Radio Relay ", " ", " "
"Y5 ", "Cargo Lght Relay ", " ", " "
"S0 ", "Inverter On ", " ", " "
"S1 ", "H/L Strobe ", " ", " "
"S2 ", "Dash Light ", " ", " "
"S3 ", "T/L Strobe ", " ", " "
"S4 ", "Radio ", " ", " "
"S5 ", "Cargo Light ", " ", " "
"S6 ", "All Warning ", " ", " "
"S7 ", "Inverter 30 min ", " ", " "
"S10 ", "Inverter 1 Hour ", " ", " "
"S11 ", "Warning On ", " ", " "
"S12 ", "Radio 1 Hour ", " ", " "
"S13 ", "Radio 3 Hours ", " ", " "
"S15 ", "Cargo 10 Minutes ", " ", " "
"S16 ", "Acc Override ", " ", " "
"S20 ", "Timer Enable ", " ", " "
"S21 ", "Radio Tmr Enable ", " ", " "
"T3 ", "Cargo 10 Min Tmr ", " ", " "
"T4 ", "Radio 1 Hour Tmr ", " ", " "
"T6 ", "Radio 3 Hour Tmr ", " ", " "
"T10 ", "Invrt 30 Min Tmr ", " ", " "
"T12 ", "Invrt 1 Hr Tmr ", " ", " "
#END
Created Date: June 25,2007
Created by: milldrone
jamesjcooper,
I don't think it will make any difference in program size but we normally use "C " bits for internal relays and "S " bits for stages. I only say this because I don't see any stages.
On rung #5 you are using S12/ to start your timer. I cannot find any coil or bit setting logic to change it's state. When the PLC is first powered up any non retentive bits are cleared or off. So this bit would be off and your timer would start timing. Rung #6 has the same type of problems as rung #5. Rung #8 has the same type of problems as rung #5. Rung #10 has the same type of problems as rung #5. Rung #11 has the same type of problems as rung #5.
After further cogitating on this, one posiblity I didn't think about earlier would be this:. You are using this Plc as a slave or a master, and the bits ( "S ") are being changed in another plc. If this is true we also need this information.
Created Date: June 25,2007
Created by: jamesjcooper
Sorry if some things are not clear, I forgot I have the hardware in front of me. The S bits are being set by the touch panel, they are tied to momentary buttons on the screen that I would use to start the timer.
Thank you for the pointer on different memory bits, when I started this I wasn't sure what all the different memory types were, and I am still learning.
I can make some changes and have these as 'c ' bits, would that help from the timers restarting or just make the code make more sense.
I appreciate all your help.
Jim
Created Date: June 25,2007
Created by: milldrone
jamesjcooper ,
For the sake of this conversation I'm going to presume (this always gets me introuble) that the "S " address numbers will stay the same but now have a "C " prefix now. So you have a panel some where that is setting bits for you. Have you confirmed the the bits are being set? I'm going to presume at this moment that they are. Do you have any handshaking in place so the plc knows what to do if the panel is not communicating? I can't see any so I'm presuming no. I'm also presuming that you have not altered the retentive ranges in the plc. "S21 " was the highest "S " bit you used previously so I'm going to suggest you use "C22 ". Then you would turn on "C22 " "always " with the HMI. Now for the bad news. when I series "C22 " with every timers ' count rung I get 101 words. how important is the timer accuracy can 1 minute increments work? Can 15 second increments work? I might be able to work something out.
PS it looks like some of the logic in rung# 11 doesnt match up. You have your "inverter 30 min " resetting "inverter 1 hour "
Created Date: June 25,2007
Created by: milldrone
jamesjcooper,
I have rewritten your code. Exchanging the "S " bits for "C " bits and have made the word requirement (98). I think the reason your timers were counting up was that your hmi was not communicating at that time. I have also included "C22 " that you will have to configure in the HMI to always be on. As I mentioned before I'm presuming you have not modified the retentive ranges in the PLC. I'm curious about rungs 13 and 14. It seems to me that you would have access to Y1, Y2, Y3 in the HMI and you wouldn't need to set a bit (C11), and or reset it. This would give you a little more programming room if you needed more. BTW where I found some room was in your set/reset coils. If you only specify the first address slot it will still work. IE when you get the little window just type in the address once. If I were you I'd copy this into a new project so you don't loose anything.
PLC 05
// Rung 1
// Address 0
STR X5
SET C16
// Rung 2
// Address 2
STR C1
OR C6
STRN X0
OR C16
ANDSTR
OUT Y1
// Rung 3
// Address 8
STR C2
OR C6
STRN X0
OR C16
ANDSTR
OUT Y2
// Rung 4
// Address 14
STR C3
OR C6
STRN X0
OR C16
ANDSTR
OUT Y3
// Rung 5
// Address 20
STRN C12
AND C22
STR C12
TMRA T4 K3600000
// Rung 6
// Address 26
STRN C13
AND C22
STR C13
TMRA T6 K10800000
// Rung 7
// Address 32
STR C4
STRN T4
ORN T6
AND C21
ORSTR
OUT Y4
// Rung 8
// Address 38
STRN C15
AND C22
TMR T3 K6000
// Rung 9
// Address 43
STR C5
STRN X0
OR X5
OR C16
ANDSTR
STRN T3
AND C20
ORSTR
OR C15
OR X4
OUT Y5
// Rung 10
// Address 54
STRN C7
AND C22
STR C7
TMRA T10 K1800000
// Rung 11
// Address 60
STRN C10
AND C22
STR C10
TMRA T12 K3600000
// Rung 12
// Address 66
STRN T12
ORN T10
AND C20
STR C0
STRN X0
OR X5
OR C16
ANDSTR
ORSTR
ANDN X2
OUT Y0
// Rung 13
// Address 77
STR Y1
OR Y2
OR Y3
SET C11
// Rung 14
// Address 81
STRN Y1
ANDN Y2
ANDN Y3
RST C11
// Rung 15
// Address 85
STR X1
LD K5
OUT V3000
// Rung 16
// Address 88
STRN X1
LD K999
OUT V3000
// Rung 17
// Address 91
STR X1
LD K5
OUT V3002
// Rung 18
// Address 94
STRN X1
LD K0
OUT V3002
// Rung 19
// Address 97
END
// Rung 20
// Address 98
NOP
#BEGIN ELEMENT_DOC
"UB0 ", "T8 ", " ", " "
"X0 ", "Acc Power ", " ", " "
"X1 ", "Inverter Fault ", " ", " "
"X2 ", "Inverter Low Vol ", " ", " "
"X3 ", "Inverter Ok ", " ", " "
"X4 ", "Cargo Lights Inp ", " ", " "
"X5 ", "Acc Over Sw ", " ", " "
"Y0 ", "Inverter Relay ", " ", " "
"Y1 ", "H/L Strobe Relay ", " ", " "
"Y2 ", "Dash Light Relay ", " ", " "
"Y3 ", "T/L Strobe Relay ", " ", " "
"Y4 ", "Radio Relay ", " ", " "
"Y5 ", "Cargo Lght Relay ", " ", " "
"C0 ", " ", " ", "inverter on "
"C1 ", " ", " ", "h/l strobe "
"C2 ", " ", " ", "dash light "
"C3 ", " ", " ", "t/l strobe "
"C4 ", " ", " ", "radio "
"C5 ", " ", " ", "cargo light "
"C6 ", " ", " ", "all warning "
"C7 ", " ", " ", "inverter 30 min "
"C10 ", " ", " ", "inverter 1 hour "
"C11 ", " ", " ", "warning on "
"C12 ", " ", " ", "radio 1 hour "
"C13 ", " ", " ", "radio 3 hours "
"C15 ", " ", " ", "cargo 15 minutes "
"C16 ", " ", " ", "acc override "
"C20 ", " ", " ", "timer enable "
"C21 ", " ", " ", "radio timer enable "
"C22 ", " ", " ", "always on from hmi "
"S0 ", "Inverter On ", " ", " "
"S1 ", "H/L Strobe ", " ", " "
"S2 ", "Dash Light ", " ", " "
"S3 ", "T/L Strobe ", " ", " "
"S4 ", "Radio ", " ", " "
"S5 ", "Cargo Light ", " ", " "
"S6 ", "All Warning ", " ", " "
"S7 ", "Inverter 30 min ", " ", " "
"S10 ", "Inverter 1 Hour ", " ", " "
"S11 ", "Warning On ", " ", " "
"S12 ", "Radio 1 Hour ", " ", " "
"S13 ", "Radio 3 Hours ", " ", " "
"S15 ", "Cargo 10 Minutes ", " ", " "
"S16 ", "Acc Override ", " ", " "
"S20 ", "Timer Enable ", " ", " "
"S21 ", "Radio Tmr Enable ", " ", " "
"T3 ", "Cargo 10 Min Tmr ", " ", " "
"T4 ", "Radio 1 Hour Tmr ", " ", " "
"T6 ", "Radio 3 Hour Tmr ", " ", " "
"T10 ", "Invrt 30 Min Tmr ", " ", " "
"T12 ", "Invrt 1 Hr Tmr ", " ", " "
#END
Vaughn
PS My bad, if I had read your first post more carefully I would have seen you were using a Cmore.