Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
21 Applied Instructions (Real Time Clock Control)
21.8 TWR / Set RTC data
561
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
21
Applied Instructions
(Real Time
Clock Control)
22
Applied Instructions
(External Device)
23
Applied Instructions
(Extension
Function)
24
Applied Instructions
(Others)
25
Applied Instructions
(Block Data
Operation)
26
Applied Instructions
(Character
String Control)
27
Applied Instructions
(Data Operation 3)
28
Applied Instructions
(Data Comparison)
29
Applied Instructions
(Data Table
Operation)
30
Applied Instructions
(External Device
Communication)
Program example
1. Setting example of clock data (time)
To set the real-time clock. In the case of 15 hours, 20 minutes, 30 seconds, Tuesday, April 25, 2001.
1) When setting the time, first set the time of several minutes ahead, and turn ON the X000 when reaching
the exact time, then the set time is written into the real-time clock, and the clock data is updated.
2) Every time the X001 is turned ON, ±30 seconds can be corrected.
3) When handling the year in four digits, please add the following program.
D8018 operates in four-digit year mode from the second scan after RUN of PLC.
a) Usually, the PLC operates in two-digit year mode. After RUN of PLC, by executing the above
instruction, and transferring K2000 (fixed value) to D8018 (year) for one operation cycle only, the
operation is changed to four-digit mode.
b) This program must be executed every time the PLC is set to RUN. By transferring K2000, only the
year display is changed to four-digit mode, and the present time is not changed.
c) In the case of four-digit mode of the year, 80 to 99 correspond to 1980 to 1999, and 00 to 79
correspond to 2000 to 2079.
Example: 80=1980, 99=1999, 00=2000, 79=2079
[Structured ladder/FBD]
[ST]
M0:=LDP(TRUE,X000);
MOV(M0,K1,D0);
MOV(M0,K4,D1);
MOV(M0,K25,D2);
MOV(M0,K15,D3);
MOV(M0,K20,D4);
MOV(M0,K30,D5);
MOV(M0,K2,D6);
TWR(M0,D0);
M8017:=X001;
M8017
X001
TWR
EN ENO
s
D0
MOV
EN
s
ENO
d
D0
K1
M0
LDP
EN
s
ENO
d
X000
M0
MOV
EN
s
ENO
d
D1
K4
MOV
EN
s
ENO
d
D2
K25
MOV
EN
s
ENO
d
D3
K15
MOV
EN
s
ENO
d
D4
K20
MOV
EN
s
ENO
d
D5
K30
MOV
EN
s
ENO
d
D6
K2
Year (lower 2 digits)
Month
Day
hour
minute
second
Day of week
Updating of current value of
built-in real-time clock
Correction of 30 seconds
±
M8002
Initial pulse
MOV
EN
s
ENO
d
D8018K2000