Professional Documents
Culture Documents
To have the user program access the Time of Day Clock on ControlLogix processors, do the following.
1. Create a 7 element DINT array called Wall_Clock
2. Have rung with GSV instruction.
CIP Object Class = WallclockTime
CIP Object Name= n/a
Attribute = Date|Time
Dest = CLOCK[0]
3. Real Time clock values will be stored in CLOCK[0] through CLOCK[6] as year, month, day, hours, minutes, seconds.
Wall_Clock(0) = YEAR,
Wall_Clock(1) = MONTH,
Wall_Clock(2) = DAY,
Wall_Clock(3) = HOURS,
Wall_Clock(4) = MINS,
Wall_Clock(5) = SECS,
Wall_Clock(6) = MICRO SECONDS
GSV
Get System Value
Class Name WALLCLOCKTIME
Instance Name
Attribute Name
DateTime
Dest
Wall_Clock.Year
2003
ADD
Add
Source A
Month
7
Source B
12
Dest
SUB
Subtract
Source A
Source B
Dest
Month
7
Year
2003
1
Year
2003
Misc_Dints(1) = [ 3 ( M+1 ) / 5 ]
CPT
Compute
Dest
Misc_Reals[0]
4.8
Expression (3 * (Month + 1)) / 5
SUB
Subtract
Source A Misc_Reals[0]
4.8
Source B
0.5
Dest
Misc_Reals[1]
4.3
MOV
Move
Source Misc_Reals[1]
4.3
Dest
Misc_Dints[1]
4
MISC_DINTS(2) = [ YEAR / 4 ]
DIV
Divide
Source A
Source B
Year
2003
4
SUB
Subtract
Source A Misc_Reals[2]
500.75
Source B
0.5
Dest Misc_Reals[2]
500.75
Dest
DIV
Divide
Source A
SUB
Subtract
Source A Misc_Reals[4]
20.03
Source B
0.5
MOV
Move
Source Misc_Reals[3]
500.25
Dest
Misc_Dints[2]
500
Misc_Reals[3]
500.25
Source B
Year
2003
100
Dest Misc_Reals[4]
20.03
Dest
DIV
Divide
Source A
SUB
Subtract
Source A Misc_Reals[6]
5.0075
Source B
0.5
MOV
Move
Source Misc_Reals[5]
19.53
Dest
Misc_Dints[3]
20
Misc_Reals[5]
19.53
Source B
Year
2003
400
Dest Misc_Reals[6]
5.0075
Dest
Misc_Reals[7]
4.5075
MOV
Move
Source Misc_Reals[7]
4.5075
Dest
Misc_Dints[4]
5
Day_of_Week
3
Expression (Day + (2 * Month) + Misc_Dints[1] + Year + Misc_Dints[2] - Misc_Dints[3] + Misc_Dints[4] +2) MOD 7
(End)