8 cam mode – Rockwell Automation 57C422B 2 Axis Servo Module User Manual

Page 96

Advertising
background image

5-10

2-Axis Servo Module M/N 57C422B

5.8

Cam Mode

The following example illustrates the software necessary to
use the axis in the cam mode. The example is a time cam. It
illustrates how to calculate cam parameters and the values in
the cam table itself. It also shows how to start cam execution.

8992

!

8993

! Compute cam parameters

8994

!

8995

! FDBK_SCALING

= encoder counts/engineering units

8996

! CAM_CYCLE_TIME

= time (in seconds) for one complete
cam cycle

8997

! SPD

= maximum speed (in engineering units)

8998

! MAX_SPD

= maximum speed (encoder counts/cam
time interval)

8999

!

9000

IF CAM_CYCLE_TIME <1915*.00125 THEN STEP_TIME=1 \GOTO 9010

9005

STEP_TIME%=CAM_CYCLE_TIME/(1915*.00125)+.999

9010

TOTAL_PTS%=CAM_CYCLE_TIME/(STEP_TIME%*.00125)+.999

9015

IF TOTAL_PTS% > 1915 THEN TOTAL_PTS%= 1915

9020

MAX_SPD=SPD*FDBK_SCALING*STEP_TIME%*.00125

9025

RETURN

9297

!

9298

! Calculate Cam Profile Points

9299

!

9300

ADDRESS!=VARPTR!(CAM_TABLE%) \!Starting address for cam profile

9310

FOR I%=0 TO TOTAL_PTS%_1

9315

! DATA_POINT%=change in position for next time interval

9320

IOWRITE(3, DATA_POINT%, ADDRESS!)

9325

ADDRESS!=ADDRESS! +2

9330

NEXT I%

9335

RETURN

9400

!

9497

!

9498

! Start cam cycle

9499

!

9500

CAM_LOOPBACK%=0

!No loopback point.

9505

CAM_MODE%=9

\!Run continuously, word format

9510

CMD66%=080H \GOSUB 25000 \! Do cam profile

9515

RETURN

Advertising