
BASIC commands
PROGRAMMING MANUAL
52
R
e
vi
si
o
n
1
.0
fig. 7
/i
fig. 8
Example
' Subroutine to generate a SIN shape speed profile
' Uses: p is loop counter
' num_p is number of points stored in tables pos 0..num_p
' scale is distance travelled scale factor
profile_gen:
num_p=30
scale=2000
FOR p=0 TO num_p
TABLE(p,((-SIN(PI*2*p/num_p)/(PI*2))+p/num_p)*scale)
NEXT p
RETURN
This graph plots TABLE contents against table array position. This corre-
sponds to motor POSITION against link POSITION when called using
CAMBOX
. The
SPEED
of the motor will correspond to the derivative of the
position curve above.