Call 62 – number to string conversion, Call 62 – number to string conversion -3, Example – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 245: Purpose, Syntax

Advertising
background image

Publication 1746-RM001A-US-P

String Functions 15-3

Example

>1

REM EXAMPLE PROGRAM

>10

STRING 200,20

>20

$(1) = “How are ”

>30

$(2) = “you?”

>40

PRINT “BEFORE ”

>50

PRINT “$(1) = ”,$(1)

>60

PRINT “$(2) = ”,$(2)

>70

PUSH 2 : REM STRING NUMBER TO BE APPENDED

>80

PUSH 1 : REM BASE STRING NUMBER

>90

CALL 61 : REM INVOKE STRING APPEND ROUTINE

>100 PRINT “AFTER:”

>110 PRINT “$(1) = ”,$(1)

>120 PRINT “$(2) = ”,$(2)

>130 END

READY

>RUN

BEFORE:

$(1) = How are

$(2) = you?

AFTER:

$(1) = How are you?

$(2) = you?

READY

>

CALL 62 – Number to
String Conversion

Purpose

Use CALL 62 to convert a number or numeric variable into a string. You must
allocate a minimum of 14 characters for the string. If the exponent of the value to
be converted is anticipated to be 100 or greater, you must allocate 15 characters.
Error checking traps string allocation of less than 14 characters only. There are no
output arguments.

Syntax

PUSH [number to convert to string]
PUSH [string number to receive the value]
CALL 62

Advertising