AKD BASIC User Guide | 6 AKD BASIC Parameters, Operators, Statements
6.5.2 CAM.ADDPOINT
General Information
Type Statement
Description
CAM.ADDPOINT(Master Position, Slave Position) Adds the specified "point" to
the cam table being created.
Units Master Encoder Counts, Position User Units
Range -2^63 to 2^63-1
Default
Value
N/A
Data Type Integer
Start Ver-
sion
M_01-06-00-000
Description
CAM.ADDPOINT adds the specified “point” (master position and corresponding slave position)
to the cam table being created. This statement is only used inside a CAM.CREATE block.
You must be inside a CAM.CREATE block to use the CAM.ADDPOINT statement. The
master position for the first CAM.ADDPOINT statement in a CAM.CREATE block must
always be zero. The master position must always increase as you add points to the cam table.
There must be at least two points in your cam table.
Examples
The following example declares, creates, and activates a cam.
Main
CAM.CREATE(1, 5) ‘allocate space for cam #1, 5
points
‘start the cam create block
CAM.ADDPOINT(0, 0)
CAM.ADDPOINT(200, 65536 / 10)
CAM.ADDPOINT(400, 65536 / 8)
‘add the points
CAM.ADDPOINT(600, 65536 * 3 / 4)
CAM.ADDPOINT(800, 65536)
End ‘end the cam create block
DRV.SWENABLE = 0 ‘Disable motor while setting
position
CAM.MASTER = 2 'Cam Master = External Encoder
EXTENCODER.POSMODULO = 800 'set master counts
per cycle
PL.MODPEN = 1 'enable slave modulo
PL.MODP2 = 65536 'set slave (AKDBASIC) counts
per cycle
EXTENCODER.POSITION = 0 'set Master position
to 0
MOVE.POSCOMMAND= 0 'set slave (AKDBASIC)
position to 0
DRV.SWENABLE = 1 'enable the motor
155 Kollmorgen™ | March 30, 2012