Control Program - Siemens SIMATIC S5-95F Manual

Table of Contents

Advertisement

The Integral Real-Time Clock
10.5 Programming the Integral Real-Time Clock in the Control Program
In the following sections, we use examples to describe how you can set and evaluate the integral
real-time clock via the control program.
Convention:
In the following examples, we assume that the parameter set for the clock has already been stored
in DB1; the clock data area occupies data words DW 0 through DW 21 in DB200, and the status
word occupies data word DW 22.
10.5.1 Reading and Setting the Clock
Example:
Setting the Clock Time and Date
Transfer of the settings for the time and date is triggered by input I 0.0. The settings are available in
flag bytes FY121 to 127; they have been received, for example, by the SINEC L1 master. Values
that you do not want to change must be preset with FF
Input 1.0 defines the clock mode (0 = 24-hour mode, 1 = 12-hour mode). Input 1.1 is the AM/PM
bit for the 12-hour mode.
The clock data area is in DB200, beginning with DW0; the status word is DW 22.
OB1 STL
:
:
:A
I
0.0
:AN
F
0.0
:S
F
20.0
:A
I
0.0
:=
F
0.0
:
:JU FB
10
NAME :SET CLOCK
WDAY :
FB 121
DAY
:
FB 122
MON
:
FB 123
YEAR :
FB 124
HOUR :
FB 125
AMPM :
I
1.1
MIN
:
FY 126
SEC
:
FY 127
EER
:
F
12.1
MODE :
I
1.0
:BE
10-10
.
H
Explanation
================================
SETTING THE TIME AND DATE
================================
FIRST TRANSFER TIME AND DATE VALUES
TO FY121 to FY127.
CLOCK SETTING TRIGGERED BY
SETTING OF F 20.0
(IS RESET IN FB 10)
WEEKDAY
DAY
MONTH
YEAR
HOUR
AMPM BIT (ONLY RELEVANT IN 12-HOUR MODE)
MINUTES
SECONDS
ERROR BIT
CLOCK MODE
S5-95F
EWA 4NEB 812 6210-02

Advertisement

Table of Contents
loading

Table of Contents