6 - 14
(4) Changing and reading clock data
(a) Changing clock data
Clock data can be changed either by GX Developer or a program.
1) Changing clock data by GX Developer
Select [Online] [Set time] to open the Set time screen and change the clock data.
2) Changing clock data by a program
Use the DATEWR instruction (instruction for writing clock data) to change the clock data.
Figure 6.12 shows a program for writing the set clock data to D0 to D6.
For details of the DATEWR instruction, refer to the following.
QCPU Programming Manual (Common Instructions)
When clock data is changed, the clock of 1/1000 second is reset to 0.
Year data settable by GX Developer is up to 2037.
Figure 6.11 Set time screen
Figure 6.12 Program example for writing clock data
Write request
0
X0
Year 1999
Month 8
Day 10
Hour 11
Minute 35
Second 24
Day of the week
Tuesday: 2
MOVP K1999 DO
MOVP K8 D1
MOVP D2
MOVP D3
MOVP D4
MOVP D5
MOVP D6
DATEWR DO
K10
K11
K35
K24
K2