Call 25 – basic floating-point to 16-bit binary, Call 25 – basic floating-point to 16-bit binary -3, Syntax – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 119: Example, Purpose

Advertising
background image

Publication 1746-RM001A-US-P

Math and Backplane Conversion Functions 9-3

Syntax

PUSH [value to be converted]
PUSH [word number of module output buffer]
CALL 24

Example

>1

REM EXAMPLE PROGRAM

>10 W = 17

>40 PUSH W : REM THE VALUE TO BE CONVERTED

>50 PUSH 0 : REM 1ST WORD OF BASIC OUTPUT BUFFER

>60 CALL 24 : REM DO THE F.P. TO 16-BIT SIGNED CONVERSION

READY

>

CALL 25 – BASIC
Floating-Point to 16-Bit
Binary

Purpose

Use CALL 25 to convert a module floating-point value between 0 and 65535 to its
16-bit binary representation. The resulting value is then stored in the module
output buffer. The first value PUSHed is the data to be converted. The second
value PUSHed is the address number (0 to 207) of the word in the module output
buffer.

The fractional part of the module floating-point value is truncated. If the module
floating-point value is less than 0, then the value placed in the module output
buffer is 0. If the value is greater than +65535, then the value placed in the module
output buffer is +65535. The programmer is responsible for checking the range of
the number before conversion.

Syntax

PUSH [value to be converted]
PUSH [word number of module output buffer]
CALL 25

IMPORTANT

If an attempt is made to write to word 200 of the BASIC output
buffer, an error message is displayed and the module returns to
Command mode. The bits of word 200 are defined.

Advertising