Call 15 - 16-Bit Unsigned Integer To Basic Floating-Point; Call 24 - Basic Floating-Point To 16-Bit Signed Integer - Rockwell Automation Allen-Bradley SLC 500 BASIC Reference Manual

Hide thumbs Also See for Allen-Bradley SLC 500 BASIC:
Table of Contents

Advertisement

9-2
Math and Backplane Conversion Functions
CALL 15 – 16-Bit
Unsigned Integer to
BASIC Floating-Point
CALL 24 – BASIC
Floating-Point to 16-Bit
Signed Integer
Publication 1746-RM001A-US-P
Purpose
Use CALL 15 to convert an SLC 500 controller 16-bit unsigned integer number to
a module 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 15
POP [converted value]
Example
>1
REM EXAMPLE PROGRAM
>50 PUSH 9 : REM CONVERT 10TH WORD OF BASIC INPUT BUFFER
>60 CALL 15 : REM DO 16-BIT UNSIGNED INTEGER TO
F.P. CONVERSION
>70 POP W : REM GET CONVERTED VALUE
>80 PRINT W
>RUN
0
READY
>
Purpose
Use CALL 24 to convert a module floating–point number to a signed 16-bit
integer and place the result in the module output buffer. The first value PUSHed is
the data variable. The second value PUSHed is the address number (0 to 207) of
the word in the module output buffer.
If an attempt is made to write to word 200 of the BASIC output
IMPORTANT
buffer, an error message is displayed and the module returns to
Command mode. The bits of word 200 are defined.
The fractional part of the module floating-point value is truncated. If the module
floating-point value is less than –32768, the value placed in the module output
buffer is –32768. If the module floating-point value is greater than +32767, the
value placed in the module output buffer is +32767. The programmer is
responsible for checking the range of the number before conversion.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Allen-bradley slc 500 basic-t1746-bas1746-bas-t

Table of Contents