Time value formats in S7 300/400

drspanda

Member
Join Date
Oct 2005
Location
Damanjodi
Posts
155
Hello Everyone,

Below is the STL code for converting display_period from HMI into S5 time format presented in an example.

I am not able to understand the below code completely..Siemens help suggests that:

You can pre-load a time value using either of the following formats:
1.W#16#txyz; Where t = the time base (that is, the time interval or resolution)and xyz = the time value in binary coded decimal format
2.S5T#aH_bM_cS_dMS; Where H = hours, M = minutes, S = seconds, and MS = milliseconds; user variables are: a, b, c, d
· The time base is selected automatically, and the value is rounded to the next lower number with that time base.

By the above help timer T1 should be loaded with 50sec...because after OW W#16#2000 ACCU1 will be having 0010_0000_0101_0000...

But this is not happening...Please help me where I am incorrect...I must be ignoring some basics but i am not able to find myself out.

L 50 //display_period
ITB //convert input to S5TIME format
SLW 4
SRW 4
OW W#16#2000
SD T 1
AN T 1
JC END2
R T 1
S #DIR_update
S #SPEED_update
S #no_object
END2: NOP 0


If any one helps me in explaining the above instructions I am very thankful.

Advance thanks.
 
Did you write this code? Or did someone give it to you? I only ask, because there are much better ways to do what you are trying to do.

Anyway, here is what's happening (I've added comments in {....}):

{Load your time period}
L 50 //display_period
{Convert to BCD; This is the Siemens time format}
ITB //convert input to S5TIME format
{Shift it left and right to clear out the left nibble. This would only be necessary if there was a chance there were bits set there.}
SLW 4
SRW 4
{Or with the time multiplier (2=1s resolution)}
OW W#16#2000
{Set T1; But, there is no logic here that starts the timer}
SD T 1
{If the timer has not timed out, jump to end}
AN T 1
JC END2
{You don't have to reset On Delay timers}
R T 1
{These variables are set}
S #DIR_update
S #SPEED_update
S #no_object
END2: NOP 0
 
I got this code from siemens site...as an example of detecting the direction of the block movement on the conveyor..

I want to confirm that the timer T1 is loaded with 50 sec. Is it correct or not??

When I see in PLCSIM by going online I am not able to see it as 50 sec. why?

Thanks for the support.
 
As S7Guy says, there is no logic to initiate the timer, after the time format you need somenthing like A M 0.0, or whatever logic you want to initiate the timer.

Also as S7Guy stated the SLW and SRW would only be needed if you didn't know what the left 4 bits were, as you start with loading 50, you know its empty so its not needed.

After the jump condition, not sure if you need to add SET, to ensure the vits your setting get set. You jump over if the RLO is set so I presume the instructions would only be done if the RLO is off, therefore the S instructions would not work??
 
What do you mean? You won't see "50s" explicitly in any case. You will see 2050 in the accumulator whether the timer is running or not. But the timer won't run until you add some logic to start it.
 

Similar Topics

I cannot add SLC500 analog input tag (I: 8.3) to EZSeries Touch Panel Editor (V 5.3). I used all the listed tag datatype but it all says "Invalid...
Replies
10
Views
258
I want to set user security level based on the value of a tag in my PLC called "ActiveUser". That tag will contain the A-P code which we use for...
Replies
6
Views
214
hello. In Intouch, I want the color of the alarm window in the header menu to change depending on the priority value of the tag. To do this, I...
Replies
0
Views
82
I have a Type C to RS485 adapter connect to my Siemens RWF55. I use modscan to scan it to get a value from the Siemens controller. In the...
Replies
4
Views
102
I'm pretty new to PLC's, so forgive me if I use the wrong terminology and whatnot. We have an issue at work where we have a flow meter that is...
Replies
10
Views
291
Back
Top Bottom