Call 45: retrieve time string, Call 46: retrieve time numeric – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 232

Advertising
background image

Chapter
Call Routines 0–68

12

12 -42

Use CALL 45 to retrieve the current time in a string (hh:mm:ss).

Input and Output Arguments

This routine has one input argument and no output arguments. The input
argument is the number of the string to receive the time. You must use the
STRING statement (see page 11 -37) to allocate a minimum of 8 characters
for the string.

Syntax

PUSH

number of string to receive the time

CALL 45

Example

>10 STRING 100,8

>20 PUSH 1: CALL 45: REM put time in string 1

>30 PRINT $(1)

>40 END

>READY

>RUN

15: 45: 27

Use CALL 46 to retrieve the time of day in numeric form.

Input and Output Arguments

This routine has no input arguments and three output arguments.
The output arguments are hours, minutes and seconds in that order.

Syntax

CALL 46

POP

hour

POP

minute

POP

second

Example

>10 REM TIME IN VARIABLES EXAMPLE

>20 CALL 46 : REM GET WALL CLOCK TIME

>30 POP H,M,S

>40 PRINT “CURRENT TIME IS”, H,M,S

>50 END

>RUN

CURRENT TIME IS 13 44 54

READY

>

CALL 45: Retrieve Time
String

CALL 46: Retrieve Time
Numeric

Advertising