beautypg.com

Inputting string variables, Output of data (numeric and string) – Galil DMC-2X00 User Manual

Page 163

background image

#COMINT Interrupt

routine

JP #A,P2CH="A"

Check for A

JP #B,P2CH="B"

Check for B

JP #C,P2CH="S"

Check for S

ZS1;CI2;JP#JOGLOOP

Jump if not X,Y,S

#A;JS#NUM
speedX=val

New X speed

ZS1;CI2;JP#PRINT

Jump to Print

#B;JS#NUM
speedY=val

New Y speed

ZS1;CI2;JP#PRINT

Jump to Print

#C;ST;AMX;CI-1

Stop motion on S

MG{^8}, "THE END"

ZS;EN,1 End-Re-enable

interrupt

#NUM

Routine for entering new jog speed

MG "ENTER",P2CH{S},"AXIS SPEED"
{N}

Prompt for value

#NUMLOOP; CI-1

Check for enter

#NMLP

Routine to check input from terminal

JP #NMLP,P2CD<2

Jump to error if string

JP #ERROR,P2CD=2

Read value

val=P2NM
EN End

subroutine

#ERROR;CI-1 Error

Routine

MG "INVALID-TRY AGAIN"

Error message

JP #NMLP

EN End

Inputting String Variables

String variables with up to six characters may be input using the specifier, {Sn} where n represents the
number of string characters to be input. If n is not specified, six characters will be accepted. For
example, IN "Enter A,B or C", V{S} specifies a string variable to be input.

The DMC-2x00, stores all variables as 6 bytes of information. When a variable is specified as a
number, the value of the variable is represented as 4 bytes of integer and 2 bytes of fraction. When a
variable is specified as a string, the variable can hold up to 6 characters (each ASCII character is 1
byte). When using the IN command for string input, the first input character will be placed in the top
byte of the variable and the last character will be placed in the lowest significant byte of the fraction.
The characters can be individually separated by using bit-wise operations, see section Bit-wise
Operators.

Output of Data (Numeric and String)

Numerical and string data can be output from the controller using several methods. The message
command, MG, can output string and numerical data. Also, the controller can be commanded to return
the values of variables and arrays, as well as other information using the interrogation commands (the
interrogation commands are described in chapter 5).

DMC-2X00

Chapter 7 Application Programming

y 153