How do you program the starting time of an event for the S7-1200/S7-1500 in STEP 7 (TIA Portal)?
You define the starting time of the event via the input parameters of the "ClockAlarm" function. You can disable the time units you do not need (for example, year, month, day, ...) with the parameters underneath. The block synchronizes the configured parameters with the system time. When the defined time is reached, the "ClockAlarm" function value receives the True signal until the time at the inputs corresponds to the system time.
A daily event is to be configured with the "ClockAlarm" function for 14:50 local time. Details about the parameters are described in the following table.
- Set the input parameters "enableHour" and "enableMinute" to the True signal. This enables the input parameters "hour" and "minute".
- Configure the "hour" parameter with the value 14 and the "minute" parameter with the value 50.
- Disable all the parameters not needed ("year", "month", "day", "second" and "week") by setting the False signal for the parameters underneath (that begin with "enable...").
- The function value "Ret_Val" is parameterized with the output "WakeUp" (Q0.0).
- Save and compile the block and load the program into the CPU.
The digital function value "Ret_Val" is now programmed daily to 14:50 local time. Figure 1 shows the example with the described parameters.
You can also set the parameters of the "ClockAlarm" function with DB variables and control them via a panel, for example.
The "ClockAlarm" function was created in the SCL programming language and includes German and English comments. The following table describes the block parameters.
|year||UInt||1970 to 2554|
|enableYear||Bool||"1": year enabled; "0": disabled (no monitoring)|
|month||USInt||1 to 12|
|enableMonth||Bool||1": month enabled, "0": disabled (no monitoring)|
|day||USInt||0 to 31|
|enableDay||Bool||1": day enabled, "0": disabled (no monitoring)|
|hour||USInt||0 to 23|
|enableHour||Bool||1": hour enabled, "0": disabled (no monitoring)|
|USInt||0 to 59|
|enableMinute||Bool||1": minute enabled, "0": disabled (no monitoring)|
|second||USInt||0 to 59|
|enableSecond||Bool||1": second enabled, "0": disabled (no monitoring)|
|week||USInt||1 to 7; "-1": day of the week; "1": Sunday|
|enableWeek||Bool||1": week enabled, "0": disabled (no monitoring)|
|localTime||Bool||"1": local time; "0": system time|
|ClockAlarm||Bool||Current date and time correspond to setpoint values|
The download includes the STEP 7 (TIA Portal) library with the block described above for the S7-1200 and for the S7-1500. Unpack the Zip file in a separate directory on your hard disk. Then you can open and edit the library in STEP 7 (TIA Portal).
You can only open and edit the library in STEP 7 (TIA Portal). Further information about opening libraries is available in Entry ID: 37364723.
The picture and download in this entry were created with STEP 7 (TIA Portal) V13 and V15.
- You have a technical question / problem: Ask the Technical Support
- You want to discuss in our forum and exchange experiences with other users
- You want to create CAx data for one or more products
- You would like to send us feedback on this Entry