Learning Step 7

asterof

Member
Join Date
May 2007
Location
Califonia
Posts
554
Timers are giving me a hard time

any one have an example of a S_ODT
Can not get it to accept a TV value
Tried the S5T11H_12M_18S but it will not accept that

untitled.JPG
 
Hi asterof,

The timebase for S5 timers is S5T# followed by your time (as you have already figured out).

For instance:
S5T#1S (1 second)
S5T#500MS (500 milli seconds or half a second)
S5T#10M (10 minutes)
S5T#1H2M5S (1 hour, 2 minutes and 5 seconds).

I think the limitation of these timers is around the 2 hours and 46 minutes mark if memory serves me.

You can indirectly set the timebase by assigning a datablock address as the time value:
Instead of S5T etc put DB1.DBW20

And then in DB1 make sure that address word 20 is a S5TIME data type.

Hope that helps ;-)
 
Tried the S5T11H_12M_18S but it will not accept that

Bold part is your problem.
To understand this, you need to know how the S5 time is built.

S5 time is only 1 word, 2 byte, 16 bits.
Of those 16 bits, the 2 MSB's are not used. This being bit 14 and 15.
Bit 12 and 13 together form a binary number which makes the time base.
00 = time base is 10ms
01 = time base is 100ms
10 = time base is 1s
11 = time base is 10s
The following 12 bits is expected as a BCD number.

It looks something like:

NNTT XXXX XXXX XXXX

N = not used
T = time base
XXXX = BCD number (0-9 in hex)

The BCD x Time base = S5 time.
This setup limits the timer to 9990s. (BCD 999 and time base of 10s)

As uptown said, this effectively limits the timer to 2h46m.

As some other will no doubt mention: Seeing that you're just starting with Siemens, make it a habit to use IEC timers now.
 
If you are using MW 1 to hold the time value (I personally always use even numbers for Marker Words) then you can just use a MOVE to put in the timer value you need eg.

L S5T#10S
T MW 1

Or you can MOVE the timer value in based on some condition...
Code:
A I 4.0
JNB M001
L S5T#10S
JU M002
M001: L S5T#5S
M002: T MW 1

If the input is true then we load the Marker Word with a timebase of 10 seconds, if not then we load 5 seconds.

Obviously you can do this in ladder. Just look in the MOVE folder in your program elements on the left-hand side of the function editor window (or click View - Overview if you can't see the catalogue.)

Hope that helps

PS. I think the # sign just acts as a delimiter between the S5T part of the instruction and the timebase. The # is also used when expressing values in different number bases. ie. W#16#1234 means that the number is in Hex (Base 16) W=word #=separator 16=base 16/Hex #=seperator 1234 is the number... ;-)
 
Last edited:
You take your number (0 to 999) convert it to BCD format and mask your time base into the left hand bit.

So your 4 bits would look like

(0-4) - (0-9) - (0-9) - (0-9).



why does no-one put their cursor onto the instruction and press F1, which pulls up the help.

Within the help you can find the format of all data types, no-one searches for this ??
 
I believe it's the social interaction.
The F1 isn't a very social button.
It also doesn't have google and it's many many distractions.
 
The F1 key

I find that the built in help system on most software
packages was written by engineers, and thus is somewhat cryptic.
With out good examples it is somewhat useless for noobs.
Help is best used as a reminder system once you understand
the basic concept. As I have been programing AB systems for
over thirty years, the S7 structure and confusing concept is extremely foreign to me, thus making the learning curve somewhat more difficult.
For instance nothing really explains what the # is in this S5T#1S
Is that a place holder?
 
Last edited:
asterof, since you are a beginner, I strongly recommend that you familiarize yourself with the IEC timers (SFB3, SFB4, SFB5).
The S5 timers are quirky, arcaic and limited.
 

Similar Topics

Hi all Ive now got close to 4 years experience programming PLCs, mainly using Codesys V3 and also Red Lion Crimson software. The company I work...
Replies
7
Views
3,527
I am somewhat confused on the concept of a network Can you only have one coil or output per network ? Do you think of net works as mini routines...
Replies
5
Views
2,062
Dear all, I am new in the field of the Siemens programming buddies ..but i have to take care of programming of STEP 7 300 (specially Ver5.3) for...
Replies
4
Views
13,184
I've gotten to the learning curve where I can program a call for pump to come on at set point but I'm not sure how to turn the same pump off when...
Replies
1
Views
57
I want to pick up an Allen Bradley PLC so I can practice writing programs. I have 10 years as a maintenance tech and a good understanding of...
Replies
8
Views
221
Back
Top Bottom