Call 62: number to string conversion – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 251

Advertising
background image

Chapter
Call Routines 0–68

12

12 -61

Use this routine to convert a number or numeric variable into a string.
You must use the STRING statement (see page 11 -37) to allocate a
minimum of 14 characters for the string. If the exponent of the value you
want to convert is 100 or greater, you must allocate 15 characters.
Error checking traps string allocation of less than 14 characters only.

Input and Output Arguments

This routine has two input arguments and no output arguments. The first
input argument is the value you want to convert. The second input
argument is the number of the string to receive the value.

Syntax

PUSH

value to be converted

PUSH

number of string to receive the value

CALL 62

Example

>10 STRING 100,14

>20 INPUT “ENTER A NUMBER TO CONVERT TO A STRING”,N

>30 PUSH N

>40 PUSH 1: REM CONVERT NUMBER TO STRING1

>50 CALL 62: REM DO THE CONVERSION

>60 PRINT $(1)

>70 END

CALL 62: Number to String
Conversion

Advertising