Mitsubishi QD51 Programming Manual page 562

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
TIME$
Function
• Sets the time of the PLC CPU's clock.
• Reads the time of the PLC CPU's clock.
TIME$="<hour>:<minute>:<second>"
Syntax
TIME$
Hour
Minute
Second
TIME$="11:57:30"
Examples
A$=TIME$
• The TIME$ function is used to set the time of the PLC CPU's clock and read the time of the
Description
clock.
• Set the time using the following format:
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
• 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
• Store dummy data in a value used to read the date (year, month, date) as shown below before using
Program Example
10 ' This program sets and reads the time
30 A$="13:23:01"
40 TIME$=A$
60 B$=SPACE$(8)
70 B$=TIME$
80 PRINT "The time on the clock --->";B$
90 END
RUN
The time on the clock ---> 13:23:01
OK
11 - 392
TIME$
TIME$="hour:minute:second"
omission.
be executed for PLC CPUs without the clock function (i.e., A
the DATE$ function.
If dummy data is not stored, an error occurs.
$=SPACE$(14)
$(n)=SPACE$(14)
• • • •
Specify the character string that indicates the hour in
the range from "00" to "23."
• • • •
Specify the character string that indicates the minute
in the range from "00" to "59."
• • • •
Specify the character string that indicates the second
in the range from "00" to "59."
• • • •
Sets the PLC CPU's clock to 11 o'clock, 57 minutes,
30 seconds.
• • • •
Reads the time from the PLC CPU's clock and
assigns it to A$.
:
' Sets the time
:
' Writes the time
:
' Stores dummy data
:
' Reads the time
:
' Checks the time that was read
MELSEC-Q
, A3H, A0J2(H)CPU).
11 - 392

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents