Galil DMC-1700 Formatting Variables and Array Elements, Converting to User Units, VF m.n

Models: DMC-1800 DMC-1700

1 253
Download 253 pages 18.39 Kb
Page 173
Image 173
Formatting Variables and Array Elements

Formatting Variables and Array Elements

The Variable Format (VF) command is used to format variables and array elements. The VF command is specified by:

VF m.n

where m is the number of digits to the left of the decimal point (0 thru 10) and n is the number of digits to the right of the decimal point (0 thru 4).

A negative sign for m specifies hexadecimal format. The default format for VF is VF 10.4 Hex values are returned preceded by a $ and in 2’s complement.

:V1=10

Assign V1

:V1=

Return V1

0000000010.0000

Default format

:VF2.2

Change format

:V1=

Return V1

10.00

New format

:VF-2.2

Specify hex format

:V1=

Return V1

$0A.00

Hex value

:VF1

Change format

:V1=

Return V1

9

Overflow

Local Formatting of Variables

PF and VF commands are global format commands that effect the format of all relevent returned values and variables. Variables may also be formatted locally. To format locally, use the command, {Fn.m} or {$n.m} following the variable name and the ‘=’ symbol. F specifies decimal and $ specifies hexadecimal. n is the number of digits to the left of the decimal, and m is the number of digits to the right of the decimal. For example:

Examples:

:V1=10

Assign V1

:V1=

Return V1

0000000010.0000

Default Format

:V1={F4.2}

Specify local format

0010.00

New format

:V1={$4.2}

Specify hex format

$000A.00

Hex value

:V1=”ALPHA”

Assign string “ALPHA” to V1

:V1={S4}

Specify string format first 4 characters

ALPH

The local format is also used with the MG* command.

Converting to User Units

Variables and arithmetic operations make it easy to input data in desired user units such as inches or RPM.

The DMC-1700/1800 position parameters such as PR, PA and VP have units of quadrature counts. Speed parameters such as SP, JG and VS have units of counts/sec. Acceleration parameters such as AC, DC, VA and VD

have units of counts/sec2. The controller interprets time in milliseconds.

DMC-1700/1800

Chapter 7 Application Programming • 165

Page 173
Image 173
Galil DMC-1700 Formatting Variables and Array Elements, Converting to User Units, Local Formatting of Variables, VF m.n