Time/date

fagerstaplc

Member
Join Date
Jun 2007
Location
Fagersta
Posts
6
Does anyone know what kind of sfc I will use to see the time and date of the cpu.
I want to see the time and date on a TP 177A. Then I will use the time of day in my program. Does anyone know how to do this
CPU type is S7314c-2dp
With best regard and hope of a good answer //Mike
 
Hello fagerstaplc;

SFCs for the real-time Clock of a Siemens S7-300/400 PLC:


"SFC 0 SET_CLK Set System Clock




SFC1 READ_CLK Read System Clock



You enter the date and time as data type DT. As an example: for January 15th, 1995, 10:30 a.m. and 30 seconds you would enter: DT#1995-01-15-10:30:30. The time can only be entered with a precision of seconds. The day of the week is calculated by SFC 0 "SET_CLK" from the date.




You can create (or manipulate)the data type DT with FC3 "D_TOD_DT" (see time-of-day functions: FC1, FC3, FC6, FC7, FC8, FC33, FC34, FC35, FC40)."​

Hope this helps​
Daniel Chartier

 
I'm not quite sure whether you want to set the time in the CPU to the same time as the TP or whether you want to display the CPU time on the TP.

In the latter case, if you don't need ms accuracy, an easier way is to read the current time in the local TEMP OB1_DATE_AND_TIME in OB1 and then save it Byte for Byte in a series of Marker Bytes or in a DB for access by other parts of the program and for display on the TP.

Contrary to popular belief, this is not the time at which OB1 ran for the first time, but is updated every cycle.
 
Last edited:
S7 System time

Hi

Look in the picture I have attached.
Here is how I read the system time in S7-300.

No picture will attach, so I paste it in as text.

CALL SFC 1
RET_VAL:=#Temp_int
CDT :=#tid
L LB 4
BTI
T DB1.DBW 38 YEAR
L LB 5
BTI
T DB1.DBW 40 MONTH
L LB 6
BTI
T DB1.DBW 42 DAY
L LB 7
BTI
T DB1.DBW 44 HOUR
L LB 8
BTI
T DB1.DBW 46 MINUTE
L LB 9
BTI
T DB1.DBW 48 SECOND
L LB 10
BTI
T DB1.DBW 50 MSECOND_H
L LB 11
BTI
T DB1.DBW 52 MSECOND_L
 
Last edited:

Similar Topics

From the Red Lion website, after some customer enquiries in the last week or so... Rev. March 25, 2024 [18:30] Just thought it might help a...
Replies
9
Views
277
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
107
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
91
Hello, I have an automation direct d2 262 plc and C-more HMI EA9T6CL-R. I need to prepare a program, scheduled to be performed on a future date. I...
Replies
1
Views
119
Hi All, we've recently upgraded from FTView SE v10 to v12. Since the upgrade we've been having a problem where the HMI is slow to update tags in...
Replies
0
Views
87
Back
Top Bottom