11 - 392 11 - 392
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
TIME$
Function
TIME$
• Sets the time of the PLC CPU's clock.
• Reads the time of the PLC CPU's clock.
TIME$="<hour>:<minute>:<second>"
TIME$
Syntax
Hour
• • • •
Specify the character string that indicates the hour in
the range from "00" to "23."
Minute
• • • •
Specify the character string that indicates the minute
in the range from "00" to "59."
Second
• • • •
Specify the character string that indicates the second
in the range from "00" to "59."
Examples
TIME$="11:57:30"
• • • •
Sets the PLC CPU's clock to 11 o'clock, 57 minutes,
30 seconds.
A$=TIME$
• • • •
Reads the time from the PLC CPU's clock and
assigns it to A$.
Description
• The TIME$ function is used to set the time of the PLC CPU's clock and read the time of the
clock.
• Set the time using the following format:
TIME$="hour:minute:second"
1) Use colons (" : ") to separate hours, minutes, and seconds.
2) The hours are specified in 24-hour format, from 0 to 23.
3) If either of the specifications is 0 to 9, add a leading 0 to make it 00 to 09.
4) All three values for the hours, minutes, and seconds must be specified, without
omission.
• The time value is read in the same format as when the time is set.
• The TIME$ function is valid only for PLC CPUs with the clock function. The TIME$ function cannot
be executed for PLC CPUs without the clock function (i.e., A , A3H, A0J2(H)CPU).
• Store dummy data in a value used to read the date (year, month, date) as shown below before using
the DATE$ function.
If dummy data is not stored, an error occurs.
$=SPACE$(14)
$(n)=SPACE$(14)
Program Example
10 ' This program sets and reads the time
30 A$="13:23:01"
:
' Sets the time
40 TIME$=A$
:
' Writes the time
60 B$=SPACE$(8)
:
' Stores dummy data
70 B$=TIME$
:
' Reads the time
80 PRINT "The time on the clock --->";B$
:
' Checks the time that was read
90 END
RUN
The time on the clock ---> 13:23:01
OK
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...