Homing with latch functions, Example 6 - a homing program, Non-volatile storage – Rockwell Automation 2098-IPD-xxx Ultra5000 C Programming using the Motion Library User Manual

Page 28: Homing with latch functions -16, Example 6 - a homing program -16, Non-volatile storage -16

Advertising
background image

Publication 2098-PM001E-EN-P — July 2002

1-16

Programming Motion Control in C

Homing with Latch
Functions

Latch functions are used to capture axis position when certain events
occur. The following example shows their use in a simple homing
routine.

Example 6 - A Homing Program

This program simulates a simple homing routine while demonstrating
the use of Latch functions.

#include <motion.h>

#define HOME_OFFSET 250

#define HOME_VEL 5000.0

#define HOME_ACC 160000.0

#define HOME_DEC 160000.0

int main(void)

{

InitMotionLibrary();

AxisEnable();

JogSetVel(HOME_VEL);

JogSetAcc(HOME_ACC);

JogSetDec(HOME_DEC);

JogForward();

LatchOnIndex(1,1,TRUE);

while (!LatchTriggered(1)) { }

JogStop();

while (JogInProgress()) { }

MoveSetVel(HOME_VEL);

MoveSetAcc(HOME_ACC);

MoveSetDec(HOME_DEC);

MoveAbsolute(LatchGetOutput(1)+HOME_OFFSET);

while (MoveInProgress()) { }

AxisDefinePos(0);

return 0;

}

Non-Volatile Storage

Global variables are handled through arrays created in Ultraware and
stored in the Ultra5000 non-volatile memory. Refer to the Ultraware
User Manual
(2098-UM001F-EN-P)
for information on creating
non-volatile arrays.

There are two types of arrays that can be created in Ultraware: those
containing long integer values and those containing floating-point
values. You may create as many arrays as you have space for in the

Advertising