S7 Integer to IEC TIME

cjd1965

Lifetime Supporting Member
Join Date
Apr 2007
Location
UK
Posts
1,659
Hi

How do i convert an integer to IEC time?

I am still doing my first Step 7 project.

I am trying to write a block to scale an integer (0 - 9999) from an HMI input into a timer preset for an IEC TON timer.

I have a multi instance FB of around 100 timers and am trying to use temp variables inside the FB for the calculation for the timer preset.

I realise the timer preset is milliseconds so am trying to multiply the 9999 by 1000 in DINT to get seconds.

If i use MD1 as the output of the Mult DI and the input of the SFB4 it works fine.

I wish to use a #temp variable instead and cannot make it work. If i select DINT the MULT works fine but the TON rejects it and vice versa for a time data type.

By the way i am using ladder not STL, i understand STL is not so fussy on type checking but my customer prefers ladder where possible
 
If you still want to I can show you how to do it in Step 7. Why don't you just do it in the HMI side (WinCC Flex). Check Linear Scaling tab of Tag properties or possible script options etc.


Nick
 
Thanks Nick I will try the linear thing in Flex. Still getting to grips with it so learning curve is a bit steep
 
The move instruction is what you need to transfer variables of the same length from one data type to another, e.g.

view13.JPG
 
Thanks guys, I think i will go with Nicks suggestion. Useful to see STL but i gotta use ladder when ever possible as a customer requirement
(there guys dont like STL for fault finding although 99% will hopefully be HMI fault messages anyway)

Cheers
 
Why not use the the time as milliseconds just like the IEC timers require it ?
What I do is to use IEC timers, and then use the scaling functions in WinCC Flexible to get the values in something more "humane" than milliseconds.

The 0-9999 sounds like either you have limit constraints.

If you need limits, then you can assign min and max limits to the tags in WinCC Flexible.
 
Hi Jesper, That is exactly what i am doing. My original isue was to convert the DINT to TIME but i have found out that i dont need to.
Now I am using the WinCC Flex linear setting as mentioned by Nick B above.
You are correct i have to limit the inputs but as usual my cutomer cannot decide yet but they know 999 seconds was not quite long enough so i went for 9999 as a max for the linearity and will set the limits on site

Cheers
 
So you set the scaling like this:
PLC 9999000
HMI 9999
?

For my purposes I like to have tenths of seconds, so I scale like this:
PLC 1000
HMI 10
And then I shift the decimal 1 position in the input/output field properties to get x.x seconds.
 
yes. I am unsure if i need resolution less than 1 second but i will remember the trick of the decimal place

Thanks
 
What if you wan't to linear scale a tag that is used in recepies? On it's own it works fine(standalone input/output tag) the scaling get's done. But if I try to scale it via a recepie, when I write the values to the PLC it doesn't get scaled it's the same as it was inputed. Any suggestions?

Regars
Ales
 
Hi
Maybe you just gotta multiply by 1000 in the plc. Exampe, HMI setting is 1 second, 1*1000 is 1000mS in the PLC

Cheers
 
I'm not scaling for a timer. Besides if I had to multiply it by a 1000 it would be the same as scaling in Winccflex wouldn it?
I've done the scaling in the program itself with math instrucitions. Was a little more work but it works now.
PS:
I aslo got an answer on the Siemens forum that scaling doesn't work through recepies.. What else is new :p
 
Yes the recipe data is kept in original form. If you want both recipe and PLC side scaled I suggest script in Flex on change of value. The your PLC is doing useless reoccurring calcs.


Nick
 

Similar Topics

Hi. I'm using a Modbus ProSoft where I basically map data to a big INT array. Example, where GX_I_63HPU is a REAL, MNETC.DATA.WriteData[200] an...
Replies
21
Views
429
Good morning all, I'm integerating a device with a Rockwell PLC with V34 Studio 5000. The device reports error codes using a single integer to...
Replies
19
Views
1,289
Ex If I Read from Integer file N7:0 N7:0 is an 8 point input card , input 0 and 2 are on , rest off When I look at : N7:0 -7 6 5 4 3 2 1 0 I...
Replies
5
Views
745
The analog array has 16 individual bits and each bit is an alarm. SCADA is having issues getting the BIT bool value. However they can get the...
Replies
9
Views
1,021
I set up a Mitisubishi test system on the bench. Q03UDSPU Q173DCPU MR-J3-40B HF-KP43 HMI is a LS XP50 TTA/KP43 I am trying to use a signed...
Replies
1
Views
394
Back
Top Bottom