用vb6.0开发Pmac运动控制卡无非就是调用Pmac的动态链接库 Pmac.dll。
第一步:申明dll
Declare Function OpenPmacDevice Lib "pmac.dll" (ByVal pmac As Long) As Long
Declare Function ClosePmacDevice Lib "pmac.dll" (ByVal pmac As Long) As Long
Declare Function PmacGetResponseA Lib "pmac.dll" (ByVal pmac As Long, ByVal response$, ByVal dummy As Integer, ByVal com_string$) As Long
第二步:连接Pmac
m_bDriverOpen = 0
'connect device
'The PMAC device number is 0 for the first PMAC in your system, 1 for
'the second and so on.
m_dwDevice = 0
m_bDriverOpen = OpenPmacDevice(m_dwDevice)
……
第三步:y轴正转
Dim response As String * 2
Call PmacGetResponseA(0, response, 2, "#2j+")
第四步:断开链接
Call ClosePmacDevice(0)