Example, Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual
Page 120

Publication 1746-RM001A-US-P
9-4 Math and Backplane Conversion Functions
Example
>1
REM EXAMPLE PROGRAM
>40 PUSH 9E+1 : REM THE VALUE TO BE CONVERTED
>50 PUSH 0 : REM 1ST WORD OF BASIC OUTPUT BUFFER
>60 CALL 25 : REM DO F.P. TO 16-BIT BINARY CONVERSION
>
READY
>
CALL 88: BASIC
Floating-Point to SLC
Floating-Point
Purpose
This CALL may only be used with a SLC™ 5/03, 5/04 or 5/05 processor. These
are the only SLC processors that support the floating-point data type. In addition,
the module must be configured for SLC 5/02 mode (Class 4), so it cannot be used
in a remote I/O chassis with a 1747-ASB. This CALL may be used in a remote
ControlNet chassis with a 1747-ACN(R)15.
Use this CALL to convert BASIC floating-point to SLC floating-point in a
two-word format and place the converted value in the module’s output buffer. See
also CALL 89.
The module floating-point number is an 8-digit BCD floating-point number. The
range of the module floating-point number is:
±1E
-127
to ±.99999999E
+127
The SLC floating-point number is a 7-digit binary floating-point number (IEEE
Float 32-bit value). The range of the SLC floating-point number:
±1.1754944E
-38
to ±3.4028237E
+38
The module has a floating-point range larger than the floating-point range of the
SLC processor. If CALL 88 attempts to convert a number larger than
3.4028237E
+38
, the converted number is assigned a value of 3.4028237E
+38
. If
CALL 88 attempts to convert a number smaller than 1.1754944E
-38
, the
converted number is assigned a value of 1.1754944E
-38
.
SLC floating-point numbers are stored in 2 16-bit words.
IMPORTANT
Due to the fact that the SLC floating-point number is a 7-digit
floating-point number, and the module is an 8-digit
floating-point number, some round-off error may be introduced
during number conversions.