Technical Forum

STEP 7 / STEP 7 Lite

Function to convert DEC to S5TIME?

Thread Starter: avafab   Started: 4/20/2012 1:03 PM   Replies: 10

« Previous thread Next thread »
12» Page 1 of 2 (11 items)
  4/20/2012, 1:03 PM
Joined 9/1/2011
Last visit: 6/18/2013
Posts: 83
Rating:
Rated: Very Good [2 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hello guys, 

I need to set a timer from HMI (MP277), but i was not able to display it directly in S5TIME format so:

is there any function to convert a DEC into S5TIME? 
or alternatively is it possibile to display and set an S5TIME value directly on Siemens MP277 HMI?
Thank you
Top
  4/20/2012, 1:10 PM
Joined 4/24/2006
Last visit: 6/18/2013
Posts: 4741
Rating:
Rated: Excellent [4.12 out of 5 / rated 430 time(s)]. (430) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hello avafab,

Have a look at the following links:
how do you specify the runtime of a timer by means of an operator panel and how do you output the remaining runtime?

how can you convert a number value of the data type INT into a string in S5TIME, or into the data types BCD and REAL?

Best regards,

Wizard
Top
  4/20/2012, 1:14 PM
Joined 4/20/2007
Last visit: 6/5/2013
Posts: 315
Rating:
Rated: Outstanding [3.61 out of 5 / rated 18 time(s)]. (18) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Look at my last post in this topic. That is what I use :-)

https://www.automation.siemens.com/WW/forum/guests/PostShow.aspx?
Top
  4/20/2012, 1:25 PM
Joined 3/18/2008
Last visit: 6/5/2013
Posts: 256
Rating:
Rated: Outstanding [3.86 out of 5 / rated 44 time(s)]. (44) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Dear Avafab,
If you are using timer for fix unit say Sec or Min Or Hour.
Then You can use Hex format in your HMI.
And make word OR logic for word of that tag address with your time base.
Example If your time base tage address is MW0 & Time base is in Sec Then use use Word Or block with IN1 as MW0 & IN2 as 1000 for Sec.The output of that block will become Time value for timer.

So as soon as operator Enters time value, it will be in Dec & our Tag will consider as Hex, So no need to convert into BCD.

This will be easiest method to use timer logic for HMI.

THANKS & REGARDS,

Solution is always available for all Problems.
The thing is to Work hard On it.
I Hope this is the best solution for your problem.
Please Give Feed back if you are happy with My Answer.
Top
  4/20/2012, 1:31 PM
Joined 1/28/2009
Last visit: 6/18/2013
Posts: 2921
Rating:
Rated: Excellent [4.1 out of 5 / rated 400 time(s)]. (400) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
avafab wrote:
Hello guys, 

I need to set a timer from HMI (MP277), but i was not able to display it directly in S5TIME format so:

is there any function to convert a DEC into S5TIME? 
or alternatively is it possibile to display and set an S5TIME value directly on Siemens MP277 HMI?
Thank you


Hello,
Check this straight forward and concise solution:

      L     MW    10                    // in sec
      ITD  
      L     1000
      *D   
      T     #zhd1

      CALL  "TIM_S5TI"
       IN     :=#zhd1
       RET_VAL:=MW12


Best regards,
Hamid Hosseini

Attachment: int2s5time.zip  (45 Downloads)



=== Edited by hdhosseini @ 4/20/2012 2:03 PM [GMT ] ===
//S7 project uploaded


Human beings are members of a whole , In creation of one essence and soul
Sa'adi



Top
  4/20/2012, 2:08 PM
Joined 9/1/2011
Last visit: 6/18/2013
Posts: 83
Rating:
Rated: Very Good [2 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
I tried to use the code from hosseini inside my FB but seems that this function TIM_S5TI is not present (it says in the symbolic table).. I use STEP7 with an S7300.

any idea?
Top
  4/20/2012, 2:20 PM
Joined 1/28/2009
Last visit: 6/18/2013
Posts: 2921
Rating:
Rated: Excellent [4.1 out of 5 / rated 400 time(s)]. (400) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
avafab wrote:
I tried to use the code from hosseini inside my FB but seems that this function TIM_S5TI is not present (it says in the symbolic table).. I use STEP7 with an S7300.

any idea?


See the attachment (FC40 in IEC functions), I also provided the program in my
previous post.Rnf:lblSmileyTooltip_

Attachment: IEC_FUNCTIONS.jpg  (29 Downloads)



=== Edited by hdhosseini @ 4/20/2012 2:25 PM [GMT ] ===



Human beings are members of a whole , In creation of one essence and soul
Sa'adi



Top
Thank you for this post from:
  4/20/2012, 5:02 PM
Joined 4/15/2009
Last visit: 5/29/2013
Posts: 648
Rating:
Rated: Outstanding [3.21 out of 5 / rated 29 time(s)]. (29) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
You can try the Code

L          #Time_Value
OW     W#16#2000     // in Seconds
T          #S5_TM

Use this S5_TM in the normal Timers

OR   W#16#3000  for resolution of 10 S
        W#16#2000  for resolution of 1 S
        W#16#1000  for resolution of 100 ms
        W#16#0000  for resolution of 10 ms

The details are there in the Help of S5_TIME Format in STEP 7

Niranjan
Top
  4/24/2012, 2:39 PM
Joined 9/1/2011
Last visit: 6/18/2013
Posts: 83
Rating:
Rated: Very Good [2 out of 5 / rated 1 time(s)]. (1) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Which function I can use to do the same in ladder? thank you
can I use this into FB?
Top
  4/24/2012, 3:08 PM
Joined 4/20/2007
Last visit: 6/5/2013
Posts: 315
Rating:
Rated: Outstanding [3.61 out of 5 / rated 18 time(s)]. (18) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hi,

Please find attached the FC I always use...

Hope you will find good use for it.



Attachment: Int_to_t.zip  (39 Downloads)

Top
12» Page 1 of 2 (11 items)
Actions