User`s manual
http://www.adtechcn.com 66
'we have 'packaged all library functions by referring to the type on the basis of the
' function library of the control card. The following example only involves
'one motion control card.
'********************************************************
Public Result As Integer 'return value
Const MAXAXIS = 4 'max. axis number
'***********************initialize functions****************************
'This function includes the library function commonly used in the
initialization of the control card. It is the 'basis of using their functions and
must be used first in the exemplified program.
'Return value<=0, it indicates the initialization failure; Return value>0, it
indicates the successful initialization.
'*****************************************************************
Public Function Init_Card(ByVal devnum As Integer) As Integer
'when response mode is 1, responding to the serial-interface reception is enabled; when 0, disabled
If (devnum = 0) Then
For i = 1 To MAXAXIS
Result = adt8840a_set_command_pos(devnum, 0, i, 0) 'reset logic-position counter
adt8840a_set_actual_pos devnum, 0, i, 0 ' reset actual-position counter
adt8840a_set_startv devnum, 0, i, 1000 'set start velocity
adt8840a_set_speed devnum, 0, i, 2000 ' set drive velocity
adt8840a_set_acc devnum, 0, i, 625 'set acceleration
Next i
Init_Card = 1
Else
Init_Card = -1
End If
End Function
'****************************set speed module*****************************
' Judge from the parameter whether it is uniform speed or acceleration/deceleration
' Set the start velocity, drive velocity and acceleration
' Parameters: axis –axis number
' StartV - start velocity
' Speed - drive velocity
' Add - acceleration
' Return value=0: correct; return value=1: error