Rockwell-automation 1746-BAS BASIC LANGUAGE User Manual Page 118

  • Download
  • Add to my manuals
  • Print
  • Page
    / 280
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 117
Publication 1746-RM001A-US-P
9-2 Math and Backplane Conversion Functions
CALL 15 – 16-Bit
Unsigned Integer to
BASIC Floating-Point
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
>
CALL 24 – BASIC
Floating-Point to 16-Bit
Signed Integer
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.
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.
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.
Page view 117
1 2 ... 113 114 115 116 117 118 119 120 121 122 123 ... 279 280

Comments to this Manuals

No comments