Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 205

Advertising
background image

Chapter
Call Routines 0–68

12

12 -15

Use CALL 24 to convert a BASIC floating-point number to an SLC 16-bit
signed integer SLC number and place result in the BASIC module output
buffer, DH-485 common interface file. This call is used with DH-485 calls
for BASIC module to SLC data conversion. See also CALL 14.

See Chapter 8 for more information.

The fractional part of the BASIC floating-point value is truncated. If the
BASIC floating-point value is less than -32768, the value placed in the
BASIC module output buffer is -32768. If the BASIC floating-point value
is greater than +32767, the value placed in the BASIC module output
buffer is +32767. You are responsible for checking the range of the
number before conversion.

Input and Output Arguments

This routine has two input and no output arguments. The first input value is
the data variable you want to convert to 16-bit integer. The second input
value is the address number (100 to 139) of the word that receives the
converted value in the BASIC module output buffer.

Syntax

PUSH

value to be converted

PUSH

word location (100–139) that receives the converted value

CALL 24

Example

>10 W = 17

>40 PUSH W : REM THE VALUE TO BE CONVERTED

>50 PUSH 120 : REM WORD 120 OF BASIC OUTPUT BUFFER GETS W.

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

CALL 24:
BASIC Floating Point to SLC
16-Bit Signed Integer

Chapter

Advertising