beautypg.com

Remote Processing CAMBASIC User Manual

Page 15

background image

Concepts - 9

NOTE:

Attempting to enter a line with more than 24 constants will cause the remainder of the line to be
terminated. CAM BASIC does this to prevent serious program malfunction. If you create a program
on a PC and try to download a line with more than 24 constants, CAM BASIC will try to send an
error m essage. Subsequent lines will become garbled as the synchronous nature of data transmission
is lost.

When numer ic constants are printed in a program listing, they are always followed by a space. The space is added by the
L I ST s ta t em e n t a n d i s n o t s to r e d i n y o ur p r og r a m .

OPERATORS
Arithme tic Operator s:
CAM BASIC is capable of m anipulating single bits within an 8– bit field, packed BC D data, 8– bit bytes, 16– bit words,
and real (floating point) num bers.

CAM BASIC assum es that all numbers con tained in a progra m and those input by the oper ator are de cimal. It can also
accept hexadecimal numbers. T he prefix of the number determines its modulus. For example,

Decimal

33797

(no prefix needed)

Hexadecimal

&8405 (& m eans hexad ecimal)

Binary

@11001001

(@ means binary)

The outpu t can be in decim al, h exadecim al or binar y form at:

Decimal

242

Hexadecimal

E2

Additional math operators are:

Operator

Operation

Exam ple

+

addition

X+ Y

subtraction

X– Y

*

multiplication

X*Y

/

division

X / Y

\

integer division

X \ Y

mod

modulo

X mod Y

Expression analysis of multiplication and division is carried out first from left to right. Then addition and subtraction are
evaluated fr om left to r ight.

NOTE:

Values for X and Y cannot exceed 32767 or be less than – 32768 when perform ing integer division.
If these values a re exce eded, overflow will occur , da ta will be er roneou s and no er ror m essage w ill
be generated.

Relational Operators

Operator

Relation

Exam ple

Tested

=

equal

X= Y

< >

not equal

X< > Y