Examples, User units, Example – Yaskawa LEGEND-MC User Manual

Page 325: Examples: user units

Advertising
background image

315

LEGEND-MC User’s Manual

PF and VF commands are global format commands. Parameters may also be formatted locally by using
the {Fn.m} or {$n.m} specification following the variable = . For example:

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. The local format is used with the MG* command.

Examples:

User Units

Variables and arithmetic operations make it easy to input data in desired user units i.e.; inches or RPM.

For example, an operator can be prompted to input a number in revolutions. The input number is
converted into counts by multiplying it by the number of counts/revolution.

The LEGEND-MC 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/sec

2

. All input parameters must be converted into these units.

Example:

V1={F4.2}

Specifies the variable V1 to be returned in a format of 4 digits to left of

decimal and 2 to the right.

: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

#RUN

Label

IN "ENTER # OF REVOLUTIONS",N1

Prompt for revs

PR N1*2000

Convert to counts

IN "ENTER SPEED IN RPM",S1

Prompt for RPMs

SP S1*2000/60

Convert to counts/sec

IN "ENTER ACCEL IN RAD/SEC2",A1

Prompt for ACCEL

AC A1*2000/(2*3.14)

Convert to counts/sec2

BG

Begin motion

EN

End program

Advertising