Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 29

Advertising
background image

4Ć9

4.2.2

Hexadecimal Constants

A hexadecimal constant also specifies an integer value in base 16 or

hex" (hexadecimal) format. A hexadecimal number has three parts:
0NNNNNNNNH
where:
1. A leading zero (0) is required if the first digit of the hexadecimal

number is an alphabetical character (A through F) so that BASIC

can distinguish it as a number and not a variable name. A

leading zero may also be used in front of a numeric character in

the hexadecimal number just as in a normal integer constant

(0987H = 987H)

2. The eight Ns represent the 8 hexadecimal (hex) digits in the

range 0 through F.

3. The trailing character H" indicates that the number is

hexadecimal and is always required.

The following are correct hexadecimal numbers:
098FCE2H

0FFEEC1H

0BEEFC2H 400B3C2H

99987H
The following are invalid hexadecimal numbers and the reasons that

they are invalid:
FEC002H (Does not start with zero in front of the alpha hex

character F.)

9800BE Does not end with H.)

3FFFFE342H (Larger than maximum double integer.)
BASIC hexadecimal numbers must fall in the range from zero to

0FFFFFFFFH. Hexadecimal constants are stored by BASIC exactly

as they are specified, with leading zeros filling in any of the eight hex

digits not specified for a double word or 32Ćbit format. This means

the numbers must be specified as 2's complement signed numbers.
For example, BASIC will load the hex constant 0F371H as

0000F371H. It will not signĆextend the number to 0FFFFF371H. If the

number 0FFFFF37H is desired, the entire 8 hex digits must be

specified. If you specify a number outside the appropriate range

(0FFFFFFFFH), the compiler will print an error on the screen.

Advertising
This manual is related to the following products: