Step 7 adjustable timers, please help

whirlair

Member
Join Date
Dec 2007
Location
mn
Posts
64
This is my first program with Step 7 (300 series PLC) and I have to say it is extremely frusterating. And the fact that the company we bought the software package from took 2 weeks to get it to me and now I have had a few days to program my equipment (which now will not ship with a functional program and I have to actually try it on start up :mad: ).

Anyways, I have a couple outputs I need to cycle on and off with adjustable on and off times. Frankly I have found this to be a real pain in the *** to do as the old S5 timers only seem to take S5T data type for the timer value, and the IEC timers take a DINT of data type TIME which is in milliseconds; so then you cant do any math to the value. I can't have the user entering 5 minutes in milliseconds, but I can't multiply the TIME value by 10 either.

Could some one please help me on how to do handle timers properly in S7? I'm doing my best to throw out all AB thinking at this point, but I am really having difficulty with all these needlessly different data types.

A brief explanation of how to use DBs would be helpful too as I feel I should have this data which comes from the HMI in a DB. So far I have mostly just used the M address which I now find out is the wrong way to do things (Used these because my previous siemens experience is with the s7-200s I suppose). I don't understand if I need to call the DB to get the data out of it, or is there a way to just reference it. I'm clueless on DB's as the symbol table and M address seemed way easier.

Thanks in advance, hopefully someone can decipher this lol.
 
Last edited:
Here's a quick example using a DB to store the times in minutes (which the HMI could modify), and some code which converts the minutes to millisecs for the time format for the IEC timers.

time001.JPG


time002.JPG
 
There is a lot of confusion with S7 timers. And probably as many solutions as there are people.

This is what I do:

In the S7 PLC I use IEC timers.
If I have to make comparisons or math with the TIME values, I switch to STL, as this allows you to do these things (with DINT compare/math) without protests from the typechecking.

In the HMI, I use the scaling in the Tags that point to the PLC addresses. In this way I scale for example: PLC=1000, HMI Tag=10. And then I shift in each i/o display field the decimal one position. The result is that my users sees and can set the TIME values as seconds with one decimal precision. The above example would give HMI I/O field=1.0.
 
You could switch the type checking off, then you can use the S5 timer words as integers or words, and Time variables as ordinary double integers. Don't ask me where the setting is, I cannot check since I don't own a copy of Step 7 any more.
S5 time format is in a 16 bit word setup with the lowest significant 12 bits as 3 BCD characters, giving you a value from 0 to 999. The 4 most significant bits handle the scaling. This is either 10ms, 100ms, 1s or 10s multiplier for the BCD characters.
If you are using a Siemens HMI, these will generally allow you to write directly to S5 timer words, and all the scaling will be handled automatically. For non Siemens HMIs, (I have done this in Citect) you can scale the word you are writing to into BCD allowing 3 characters only. Before passing this to the S7 timer, you use an OR word command to setup the correct time base.
 
How do you scale in the HMI? Do I just change the "Shift Decimal Point" option on the input field?

Sorry to ask these kinds of questions but the equipment had to ship and I have no way to try anything anymore lol. Thanks for all the help.
 
Sorry, I assumed you use Protool or WinCC Flexible.

In Flex you open the properties of the tag in question.
Then you will find a section called Linear Scaling.
Basically you specify the scaling ranges in the PLC and HMI.
For example PLC=0..1000 HMI=0..10

In Protool there is a tab called Conversion for the same functionality.

It is as simple as that. The HMI will take of the rest.
 
whirlair said:
If the "IN" is true, but the "EN" is false, does the timer reset?

No, it only resets when "IN" is false.
If "IN" is true and "EN" is false the timer will continue to work, you just won't see the current value increase and the output won't come on if the set value has been reached.
 
Last edited:

Similar Topics

I am having a step7 v5.4 program where the blocks are encrypted and locked. And the manufacturer is stopped the support. Is there any ways to...
Replies
2
Views
176
Good Morning, Hoping someone with some Siemens experience can give me a hand with this one. Customer has a S7-200 cpu, which has a 6GK7...
Replies
0
Views
248
HI! HOW COULD I OBTAIN THE NAMES OF THE STEPS OF A ROUTINE IN SFC LANGUAGE IN STUDIO5000? Or is there a system variable that gives me those...
Replies
0
Views
339
I'm just trying to figure out the right method of adding a DO card to an existing rack. It's not the *next* open slot, but I have to move the AO...
Replies
5
Views
547
Hi Siemens Experts, I am hoping someone can shed some light on my issue. I have uploaded the code from a S7-300 (317-2PN/DP) using Step 7...
Replies
9
Views
673
Back
Top Bottom