Addition of S5time Values

tkbalaji

Guest
T
With Siemens S7 Package, How to add two / more S5time values?. Is there any simple method other than WORD-OR-ing of time base to do this?
 
Haven't tried it myself, perhaps you could use FC33 S5TI_TM followed up by FC1 AD_DT_TM to add the times. You may need to use a dummy date and time as well because FC1s input parameters are DATE_AND_TIME PLUS TIME. FC40 TIM_S5TIM gets your answer back to S5Time.

What I can't see at the moment is how you get your DATE_AND_TIME result from FC1 back to the TIME format you need for FC40's input, because FC35 SUB_DT_TM also has the output in DATE_AND_TIME format, but I assume that it's in there somewhere. The FCs are all in the IEC Function Blocks Folder of the Standard Library.

I can't understand why Siemens don't offer Blocks for all the conversions you need. There's really no reason not to with modern CPUs and memory sizes. You have exactly the same round the houses going from INT to REAL and back again, where you've got to return via BCD, for heaven's sake!
 
I am assumming, the 2 time values are using the same time base. You can strip the right 3 nibbles from the 2 values, convert them BCD to INT, and them, convert them back to BCD and put the left nibble(Time base) back together. Very unusual request. I prefer to use the 100ms interrupt and an integer value for the time. I don't care for the timers in BCD format. Then just add the INTs and you ready to go.
 
The IEC TIME datat type is just a 32-bit signed integer variable of milliseconds.

Use the S5TI_TIM FC33 like RMA suggested, do a double-integer addition, and then do a TIM_S5TI FC40 to convert the answer back.

Wrap all this up in your own FC and, hey presto, you have a function for adding 2 S5TIMEs.

(PS Can I start a poll for S5TIME as being the least user-friendly data type ever declared?)

Regards

Ken.
 

Similar Topics

Our plant manger/my boss wants each line to display the takt time above the line. I am trying to research the cheapest way to do this. Our plant...
Replies
3
Views
194
Hey guys, I'm on site integrating for the first day on a project where I'm programming RX3i (CPU 305) controllers and have hit a snag. At the...
Replies
2
Views
2,416
Hello All, Please I am trying to add FT live data tags to the historian. I can add the live tags successfully, but the challenge i am facing is...
Replies
3
Views
4,566
I have a problem I can't figure out. I have an internal tag that is a displayed only numerical value. I am trying to add a push button so when the...
Replies
2
Views
2,074
Good evening everyone, My first GE Project. I am using a GE VersaMax Nano(IC200UDD040-AB) using PME 9.0. The PLC has the IC200UEM001 Ethernet...
Replies
3
Views
3,662
Back
Top Bottom