Handling Time Data - Omron SYSMAC CV500-BSC11 Operation Manual

Basic units
Table of Contents

Advertisement

Data Operations
Setting Lower-limit Value of
Subscript
Array of Character Variables A character array of up to 538 characters can be handled by using a character

5-1-4 Handling Time Data

To Check Current Time
DATE$ Function
82
Usually, the subscript of an array starts from 0. However, it can be specified to
start from 1 by using the OPTION BASE command.
Example:
OPTION BASE 1
DIM A (2,3)
Result of execution
A(1,1)
A(1,2)
A(2,1)
A(2,2)
2 x 3 = 6 array elements are allocated in memory. The declaration made by the
OPTION BASE command cannot be changed once it has been made.
variable name.
. . . . . . . . . . . . . .
DIM A$(50) 538
Here, A$(50) is the character variable array name, and 538 is the maximum
number of characters.
The BASIC Unit also supports functions that handle time data such as dates and
hours.
To check the current time, the TIME$ function is used.
10 PARACT 0
20 T$ = TIME$
30 HH$ = LEFT$ (T$, 2)
40 MM$ = MID$ (T$, 4, 2)
50 SS$ = RIGHT$ (T$, 2)
60 PRINT"Current time is ";HH$;":";MM$;":";SS$;"."
70 END
80 END PARACT
Result of execution
Current time is 23:07:26.
This function is used to check the current date.
10 PARACT 0
20 D$ = DATE$
30 YY$ = RIGHT$ (D$, 2)
40 DD$ = MID$ (D$, 4, 2)
50 MM$ = LEFT$ (D$, 2)
60 PRINT"Today is ";MM$;"–";DD$;"–";YY$;"."
70 END
80 END PARACT
Result of execution
Today is 07–26–91.
A(1,3)
A(2,3)
Defines one-dimensional character array
variable having maximum character
storage area of 538 characters
Section 5-1

Advertisement

Table of Contents
loading

Table of Contents