Math and backplane conversion functions, Chapter 9, Chapter – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual
Page 117: Purpose, Syntax, Example

1
Publication 1746-RM001A-US-P
Chapter
9
Math and Backplane Conversion Functions
This chapter describes and illustrates commands that convert numbers between
integer and BASIC floating-point. This chapter also describes and illustrates
commands that transfer data from the BASIC or BASIC-T module output buffer
to the processor input image or transfers data from the output image to the module
input buffer. These commands can be used within the BASIC program or from the
command line. Table 9.1 lists the corresponding mnemonics.
CALL 14 – 16-Bit Signed
Integer to BASIC
Floating-Point
Purpose
Use CALL 14 to convert an SLC 500 controller 16-bit signed integer number to a
BASIC floating-point number. The input argument is the address number (0 to
207) of the word in the module input buffer to be converted. The output argument
is the converted value.
Syntax
PUSH [word number of module input buffer]
CALL 14
POP [converted value]
Example
>1
REM EXAMPLE PROGRAM
>20 PUSH 0 : REM CONVERT 1ST WORD OF BASIC INPUT BUFFER
>30 CALL 14 : REM DO 16-BIT SIGNED TO F.P. CONVERSION
>40 POP W : REM GET CONVERTED VALUE
>50 PRINT W
>RUN
0
READY
>
Table 9.1 Chapter Reference Guide
If you need (to)
Use this mnemonic Page
Convert 16-bit signed integer to BASIC floating-point.
CALL 14
Convert 16-bit unsigned integer to BASIC floating-point.
CALL 15
Convert BASIC floating-point to 16-bit signed integer.
CALL 24
Convert BASIC floating-point to 16-bit binary.
CALL 25
Convert BASIC floating-point to SLC floating-point
CALL 88
Convert SLC floating-point to BASIC floating-point
CALL 89