Siemens SIMATIC S5-100U System Manual page 323

Simatic s5 series cpu 100/102/103
Hide thumbs Also See for SIMATIC S5-100U:
Table of Contents

Advertisement

S5-100U
FB10 STL (continued)
:AN
F
11.2
:JC
=M002
:S
=ERR
:BEU
M002 :AN
F
11.0
:RB
=ERR
:BEC
:S
=ERR
:BE
Example:
Program for 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 DB2 beginning with DW0, and the status word is FW10.
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
EWA 4NEB 812 6120-02b
The Integral Real-Time Clock
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
12-23

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents