AKD BASIC User Guide | 3 AKDBASICLanguage
3.11.4 Example
You can create a cam to approximate any continuous function, but the Cam Wizard cannot help
you with it. The basic technique is to develop an AKD BASIC expression (or function)defining
the slave position as a function of master position and use it to generate a series of CAM.AD-
DPOINT statements at appropriate master position intervals, such as the one shown in the
next figure.
0
500
1000
1500
2000
-500
-1000
-1500
-2000
2000
4000
6000
8000
10000
12000
Master Encoder Counts
Slave Position
3.11.5 Program
'-------------- Device Params -----------------
------
Params
End Params
'-------------- Define (dim) Global Variables -
-------
const MC = 10000 'master counts in total cycle
const NPOINTS = 501 'number of points in cam
profile
const pi = 3.1415926535
const k = 0.69314718 / 100
const w = 1 / (7.5 * pi)
'-------------- Main Program ------------------
-------
Main
CAM.ACTIVATE = 0 'Turn off any active cams
CAM.MASTER = 1 'Master = virtual encoder only
CAMVM.DIR = 0 'set direction of virtual master
CAMVM.FREQ = 1000 'set virtual master speed
'Generate a cam that does exponentially-damped
sinusoidal
'motion and activate it. Please note that
since we are computing
'500 points of slave profile here several sec-
onds will elapse
'during the calculation of the cam table.
call CamCreate_2
45 Kollmorgenâ„¢ | March 30, 2012