show the entry list
ProTool -- Creating HMI configurations -- Creating pictures
Configuring headers of OP3 pictures in ProTool V5.2 /SP2
Programming the "Set_Bit" function by pressing a button on Windows-based devices
Picture change on the TP170A as tag function
CPU functions for S7-300 with OP7/OP17
Entering an S5TIME" variable in ProTool/Pro to provide values for a timer in the SIMATIC controller
Showing an "S5TIME" variable from a SIMATIC logic control with ProTool/Pro
Configuring the TAB order ProTool
Subsequent insertion of pictures in the configuration
Graying in the OP display of bitmap graphics
Description of the default name "PIC_xx" for a ProTool/Pro screen
Can I also program function keys in the message image?
Special characters and language-specific characters
How can you register unknown ActiveX objects on a PC and then incorporate them in ProTool/Pro?
Settings required for implementation of the ProTool function "Start Program"
Display of help texts for a certain image object on a Touch Panel
How can you start specific items in the Control Panel directly from the Runtime on an operator panel?
How do you implement the "Clean Screen" function for cleaning the touch screen on Mobile Panel 170?
How do you configure screen selection on a line or graphics operator panel via controller job 51?
How do you configure screen selection on a Windows-based operator panel via controller job 51?
How can you make a screen selection on an OP3 via the controller?
How can you make a screen selection on a Windows-based operator panel via the controller without using a controller job?
How can you make a screen selection on a Windows-based operator panel by entering a screen number?
How can the display for the danger and warning area of an analog display be made in color?
How can you optimize the response time when changing screens via the controller?
How do you monitor and control tags on panels on which the status/control object is not available?
Entering an S5TIME" variable in ProTool/Pro to provide values for a timer in the SIMATIC controller
Part number:


QUESTION:
How can I enter a variable of the "S5TIME" type so as to provide values for a timer in the SIMATIC controller?

ANSWER:
More informationen regarding the subject S5 timer and using scripts can be found in the following entries:

  • "Representing a S5TIME variable with ProTool/Pro", Entry-ID 9123496 
  • "Entering S5 timer values directly in ProTool/Pro ", Entry-ID 947095.

The "S5TIME" data type consists of a base time and a time value in the range 0 to 999 (see Entry ID 56243). In Protool /Pro you enter the values in hours, minutes, seconds and milliseconds. This input then has to be converted, so the value can be used as an "S5TIME" for a timer in the controller.

The project attached contains a script, which reads in hour, minute, second and millisecond as input parameters. The feedback value of the function is a data word of the "S5TIME" type.

You should use this script as follows.

  1. You define yourself 4 variables (e.g. "HH", "MM", "SS" and "MS").
  2. You link these variables with 4 input fields in which you can enter values for hours, minutes, seconds and milliseconds.
  3. You define a variable of the "WORD" type (e.g. "S5T"). This is the "S5TIME" value required for the timer in the controller.
  4. Now you define a button that activates the script. You transfer the variables defined to the function parameters (with the feedback value written in "S5T").

The script checks the value entered and modifies the base time accordingly. The value is limited to the maximum possible value of 9990s or 2h46m30s.

How the script works:

The value entered is first converted into milliseconds. Then it is limited to 9990s.
The system then checks what base time is to be used. This is written in Bit 12 and 13 of the result word.
The time value is then determined in the script. This value is stored in bit 0-11 of the BCD coded result word.

Source text of script:

Dim Total Time, Result
Dim Point1, Point2, Point3

Total time = Millisecond + 1000*Second + 60000*Minute + 3600000*Hour

If Total time > 9990000 Then Total time = 9990000

If Total time > 999000 Then
Result = 12288
Point1 = Fix(Total time/1000000)
Total time = Total time - Point1*1000000
Point2 = Fix(Total time/100000)
Total time = Total time - Point2*100000
Point3 = Fix(Total time/10000)
Total time = Total time - Point3*10000
ElseIf Total time > 99900 Then
Result = 8192
Point1 = Fix(Total time/100000)
Total time = Total time - Point1*100000
Point2 = Fix(Total time/10000)
Total time = Total time - Point2*10000
Point3 = Fix(Total time/1000)
Total time = Total time - Point3*1000
ElseIf Total time > 9990 Then
Result = 4096
Point1 = Fix(Total time/10000)
Total time = Total time - Point1*10000
Point2 = Fix(Total time/1000)
Total time = Total time - Point2*1000
Point3 = Fix(Total time/100)
Total time = Total time - Point3*100
Else
Result = 0
Point1 = Fix(Total time/1000)
Total time = Total time - Point1*1000
Point2 = Fix(Total time/100)
Total time = Total time - Point2*100
Point3 = Fix(Total time/10)
Total time = Total time - Point3*10
End If

Result = Result + Point1*256
Result = Result + Point2*16
Result = Result + Point3

S5Time = Result

Downloading the script:
The download includes the script described above. Copy the " pro___0l.exe" file to a separate directory and then start the file with a double click.

 pro___0l.exe ( 39 KB )  

Important:
The sample programs are selected solutions to queries about complex tasks developed by Customer Support. We must also point out that it is not possible in the current state of the technology to exclude all errors in software programs under all conditions of use. The sample programs were prepared according to the best of our knowledge. However, we cannot accept any liability beyond the standard guarantee for Class C software in accordance with our General Terms of Sale for Software Products for Automation and Drive Technology".

Keywords:
Object-oriented programming, Time conversion, Timer values


 Entry ID:9125571   Date:2002-09-04 
I regard this article....as helpfulas not helpful                                 
mySupport
My Documentation Manager 
Newsletter 
CAx-Download-Manager 
Support Request
To this entry
Print
Create PDF 
Send to a friend
QuickLinks
Compatibility tool 
Help
Online Help
Guided Tour