S5time in S7 DB's

johnmck66

Member
Join Date
Aug 2007
Location
Manchester
Posts
96
I am trying to store timer values into DB's for changeability from HMI, but for some reason I can only put in values of milliseconds from anywhere. I can set the default word in the DB to i.e. S5T#%M - but when I overwrite from anywhere it only comes up in mS.
 
Hi
I use IEC timers and the value is in m/Sec so if the HMI is requiring seconds, multipy the HMI value by 1000
 
Use the standard FC 40

Use TIME format in the HMI IO field and store the values in a DB. To use the values on S5 timers use the standard FC 40 (find it in libraries / IEC Function Blocks) to convert from TIME format til S5TIME format.

FC40 TIM_S5TI
Description
The function FC40 converts the data type format TIME to the format S5TIME. The value is rounded down during conversion. If the input parameter is greater than the S5TIME format allows (greater than TIME#02:46:30.000), the result S5TIME#999.3 is output and the binary result (BR) bit of the status word is set to "0".
 
It is one of the reasons I really hate S5 timers.

If you configure an input field of the "timer" type, then you get that you have to set the time in milliseconds. In the HMI you can offset the decimal point be 3 places to get the value in seconds.

The real problem is that the above approach means that the timebase changes according to what the user sets the value.
To display the remaining time on the HMI you should set the output field to display a decimal and push the decimal 3 places. The tag shall point to the timer itself (i.e. "Tn").

The above is the easiest way to use S5timers with a HMI. You cannot avoid displaying the time as x.yyy seconds though.

An alternative way for setting the setpoint for an S5 timer, is to decide the timebase (0=0.01s, 1=0.1s, 2=1s or 3=10s) once and for all and then handle the transfer of the timebase in code:
 
L "Timer_SP_HMI" // this is the setpoint value from the HMI
ITB // Convert to BCD
L W#16#2000 // "2" is for "seconds"
OW // Combine the two to make an S5TIME
T "Timer_SP" // This is the one that is used for the S5Timer

The HMI tag should be a regular INT, and you should limit the tag so that only values between 0-999 can be input.
If you want to use timebases of 0.01 or 0.1 seconds you simply offset the decimal point in the HMI.
 

Similar Topics

Hi All, Anyone know what a STRUCT Type S5TIME is in Intouch tagname dictionary item? example PLC Step 7, DB19, Type, STRUCT is S5TIME and...
Replies
1
Views
1,650
Hi i need help in converting Time to S5time in S71200, in s7-300 converted using T_conv Thanks in Advance Ragu
Replies
7
Views
5,291
I have a strange problem in my software. I'm using a 315-2DP PLC and picked (what I thought) a free timer to use in my code. Timer 128. I used...
Replies
14
Views
7,167
I am trying to use FC40 to go from time to S5time. I have the time going in as a DW set to type time and I have a mw set to s5time on the out. No...
Replies
5
Views
6,130
Hi, I don`t know, how can I convert S5time format. I read timer value to Scada system via OPC from S7-300 such us decimal value. I can need this...
Replies
26
Views
44,832
Back
Top Bottom