When using CAM ON or CAM ON TRG when the cam source input is continuously moving, you will need to issue the "CAM SRC {axis} RES" to prevent the cammed axis from jumping.
Example:
REM - Turn cam on after resetting the cam source offset
CAM SRC X RES
CAM RES X
CAM ON X
-or-
CAM SRC X RES
CAM RES X
CAM ON X TRG(0,0)
The following example is a more complete CAM setup and shows the proper sequence to issue the camming commands:
REM - Since CAM's use LA's, we must set PPU to 1
PPU X1
RES X
CLEAR
DIM LA(2)
DIM LA0(9)
DIM LA1(5)
REM - Enter data for array 0
LA0(0) = 0
LA0(1) = 73
LA0(2) = 250
LA0(3) = 427
LA0(4) = 500
LA0(5) = 427
LA0(6) = 250
LA0(7) = 73
LA0(8) = 0
REM - Enter data for array 1
LA1(0) = 0
LA1(1) = 0
LA1(2) = -500
LA1(3) = -500
LA1(4) = 0
REM - Allocate two cam segments for X axis
CAM DIM X2
REM - Define CAM segment 0 for a length of 500 units
REM and use LA0 for its data
CAM SEG X(0,500,LA0)
REM - Define CAM segment 1 for a length of 1000 units
REM and use LA1 for its data
CAM SEG X(1,1000,LA1)
REM - Set pointer to the memory area for encoder 1
CAM SRC X1
REM - Turn cam on after resetting the cam source offset
CAM SRC X RES
CAM RES X
CAM ON X