Step7 timers

Gromit

Member
Join Date
Jun 2006
Location
-
Posts
119
Hello,

How can we use the timer S_ODT with a variable instead of constant time.
For exmaple not typing "S5TIME#2S" for TV, but using a time, defined in the MW100 memory.
That MW100 memory could be defined by an HMI panel.

Regards
 
Hello,

How can we use the timer S_ODT with a variable instead of constant time.
For exmaple not typing "S5TIME#2S" for TV, but using a time, defined in the MW100 memory.
That MW100 memory could be defined by an HMI panel.

Regards

You can use a MW, but first read the help file for the "S5TIME" format and make sure you understand it. Time is BCD coded and have a binary coded time base.

OR
Look at this thread and the answer you got there, instead you insert a variable of type "S5TIME", if it´s a siemens HMI you are using you just tag the variable to your panel and you´re done.

http://www.plctalk.net/qanda/showthread.php?t=45817
 
MW100 = INT from the HMI, say '123'

first: convert INT to BCD, MW100 becomes, e.g. MW102 (123-BCD-coded) and use the ENO from the conversion for setting the timebase.

second: set the timebase with -(S)- instruction: example

S M102.4
S M102.5

this gives you timebase 100 ms meaning the timer will start with 123x100ms.

Use MW102 as TV (timevalue).
 
MW100 = INT from the HMI, say '123'

first: convert INT to BCD, MW100 becomes, e.g. MW102 (123-BCD-coded) and use the ENO from the conversion for setting the timebase.

second: set the timebase with -(S)- instruction: example

S M102.4
S M102.5

this gives you timebase 100 ms meaning the timer will start with 123x100ms.

Use MW102 as TV (timevalue).
Ivo,

with both those bits set, you'll get a timebase of 10s, not 100ms. The right timebases are:
  • M102.5 = 0; M102.4 = 0 - timebase 10ms
  • M102.5 = 0; M102.4 = 1 - timebase 100ms
  • M102.5 = 1; M102.4 = 0 - timebase 1s
  • M102.5 = 1; M102.4 = 1 - timebase 10s
Kind regards,
 
Ivo,

with both those bits set, you'll get a timebase of 10s, not 100ms. The right timebases are:
  • M102.5 = 0; M102.4 = 0 - timebase 10ms
  • M102.5 = 0; M102.4 = 1 - timebase 100ms
  • M102.5 = 1; M102.4 = 0 - timebase 1s
  • M102.5 = 1; M102.4 = 1 - timebase 10s
Kind regards,

Thanks Jean-Pierre,

i rechecked my notes for this code with an HMI and I made a mistake, it should indeed have been:

set M102.4
reset M102.5
 
Ivo,

with both those bits set, you'll get a timebase of 10s, not 100ms. The right timebases are:
  • M102.5 = 0; M102.4 = 0 - timebase 10ms
  • M102.5 = 0; M102.4 = 1 - timebase 100ms
  • M102.5 = 1; M102.4 = 0 - timebase 1s
  • M102.5 = 1; M102.4 = 1 - timebase 10s
Kind regards,

Sorry, but this just makes me /twitch.
Tell the guy the significance of these bits, where do they come from. Make him understand, not just copy/paste.


Open up your STL/FBD/LAD editor> Help > Help on STL > Index > Search for 'Time base'.
In that document there is also a link to the S5TIME format.

Read them both.

In the OP's application he can just:

Code:
L MW100       [I]// This is your selected time. 0-999 in BCD/hex format. On HMI-Panel make the input field Hex, not decimal.[/I]

L W#16#x000   [I]// x being the time base: 0 for 10ms, 1 for 100ms, 2 for 1s, 3 for 10s[/I]

OW           [I]// This adds your selected time with your timebase, thus creating the same structure as a S5Time[/I]

SD T40       [I]// Preset on delay timer with your selected time[/I]


The same can be achieved with LAD. You'll need an aditional temp word to hold the WOR_W result so you can use it with the S_ODT.

Like such:

S5Time.jpg
 

Similar Topics

Hi, I want to use a timer that i can read the set value for the timer from a DB (because of OP). The regular Siemens timers seem to be too stupid...
Replies
26
Views
6,888
Can I reuse the same timer in a Function Block? I have a bunch of time delays that never run concurrently. I would like to just reassign a the...
Replies
4
Views
2,316
I am setting up the structure on a project that uses 6 identical manifolds. Each manifold has I/O, HMI events, timers , recipe steps, etc. I...
Replies
4
Views
4,954
Hello guys, I have another, very weird problem with Step 7 functions. In the attachments, you can find sorces for OB1 and two functions. Both...
Replies
9
Views
3,455
Hello guys, I have one small problem Idea is: 1. After time 10 s set "Step1" 2. After 8 s, set "Step2" and reset "Step1" 3. After 5 s, set...
Replies
5
Views
2,651
Back
Top Bottom