Siemens SIMATIC S5-95F Manual page 308

Table of Contents

Advertisement

The Integral Real-Time Clock
FB10 STL (Continued)
:TBN
D
22.2
:JC
=M002
:S
=ERR
:BEU
M002 :TBN
D
22.0
:RB
=ERR
:BEC
:S
=ERR
:BE
Example:
Reading the current time and the current date
The time is stored in flag bytes FY30 to FY36, depending on an external event, simulated here by a
positive edge at input I 0.5. Flag F 13.1 indicates which mode the clock is operating in. Flag F 13.0
is the AM/PM bit in the 12-hour mode.
The clock data area is in DB200 beginning with DW0, and the status word is DW 22.
OB1 STL
:
:
:
:A
I
0.5
:AN
F
0.1
:=
F
0.0
:A
I
32.5
:=
F
0.1
:
:A
F
0.0
:JC
FB
13
NAME :READ CLOCK
WDAY :
FY
30
DAY
:
FY
31
MON
:
FY
32
YEAR :
FY
33
HOUR :
FY
34
AMPM :
F
13.0
MIN
:
FY
35
SEC
:
FY
36
MODE :
F
13.1
:BE
10-12
Explanation
HAVE SETTINGS BEEN TRANSFERRED?
IF YES, JUMP TO M002
SET ERROR BIT IF THERE ARE ERRORS
WERE THERE ERRORS WHILE ENTERING SETTINGS?
IF NO, RESET ERROR BIT
IF NO ERROR, THEN BEC
IF AN ERROR, SET ERROR BIT
Explanation
================================
READING TIME AND DATE
================================
TIME AND DATE ARE
STORED IN FY30 TO FY36 IN CASE OF A
POSITIVE EDGE AT I 32.5.
(EXTERNAL EVENT)
EDGE TRIGGER FLAG
(READING TIME AND DATE)
WEEKDAY
DAY
MONTH
YEAR
HOUR
F 13.0 = 1, AFTERNOON IN 12H-MODE
MINUTES
SECONDS
F 13.1 = 1, IN 12-HOUR MODE
S5-95F
EWA 4NEB 812 6210-02

Advertisement

Table of Contents
loading

Table of Contents