Input – Remote Processing CAMBASIC User Manual

Page 94

Advertising
background image

Comm ands - 61

INPUT

Statement

SYNTAX:

INPU T [#n, ][;] var [, var] . . . . .
INPU T [#n, ][;] " prompt message" ; var [, var] . . . . .
INPU T [#n,][; ] "prom pt message", var [,var ].. .. .

PURPOSE:

The INPUT statement causes the program to pause and prompt an operator for input data.

REMARK S:

The prompt message is a question mark in the first syntax. The other two syntaxes specify a
message string to be pr inted befor e the question m ark. No questio n mar k is printed if a comm a is
used in place of a semicolon after the prompt message.

When the INPU T statement is followed immediately by a semicolon (the [;] option), the carriage
return is suppressed after the last variable.

The variables may be both numer ic and string. The data you enter at the prompt m ust match the
variable type. Strings do not require the use of quotation marks. If a string is entered when a
numeric variable is required, a < Redo> error is given and all the variables must be reentered.

When multiple variables are used, separate the input data with commas. If fewer variables are
entered than specified with the INPUT statement, a '??' prompt will be given for the remainder.

The only editing you can do on an input line is the backspace. You can abort the INP UT statement
b y ex e cu ti ng < C T L - C > , w h i ch w il l a ls o st op th e pr o g ra m .

Even thou gh the ser ial ports acc ept any char acter fr om 0 to 255 , the INP UT sta tement filter s these to
the 32 to 127 A SCII set.

When the # is specified, n is the source number. For exam ple #2 is COM2. If the # is omitted, the
default is COM1.

Be careful when using this statement on boards with a watchdog timer. U nless the input is already
there (in the serial buffer) or the external device is quick, the watchdog is likely to reset. Also,
multi-tasking routines (such as ON TICK, ON INP ) are not executed while INPUT is active.

RPC-2350 NOTE: The CAM BASIC statement BIT 128,4, 0 may need to be executed before you
will receive any characters. This command enables the CTS line to the sender.

RELATED:

none

EXAMPLE:

10 INPUT "Input pH, volume";PH,VO
RUN

Input pH, volume? _

ERROR:

none

Advertising