
'''/*****************************************************************
'
' Moudle Name  :   nmc_lib20.h
' Abstract     :   GaoChuan Motion 2.0 user header
' Modification History :
' Note :			1.结构体定义中所有的‘dummyxxx’的成员都是保留参数，请不要修改他们
'					2.无特别说明，所有API返回RTN_CMD_SUCCESS（即0值）表示执行成功，其他则表示错误代码
'					3.所有的API参数中，无特别说明，axisHandle表示操作轴的句柄，devHandle表示目标控制器的句柄，crdHandle表示目标坐标系组句柄
'''/*****************************************************************
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Runtime.InteropServices

Imports HAND = System.UInt16
Imports GC.CS.Motion

Namespace GC.Frame.Motion.Privt
	Public Class CNMCLib20
		Public Const DLL_PATH As String = "nmc_lib20.dll"


		'----------------------------------------------------------
		'  常量宏定义                                                 
		'----------------------------------------------------------
		'	指令返回值定义
		Public Const RTN_CMD_SUCCESS As Int32 = 0
		' 数据正确
		Public Const RTN_CMD_TIMEOUT As Int32 = -1
		' 通讯超时
		Public Const RTN_VEC_FHASE_ERROR As Int32 = -8
		' 矢量数据桢时序不支持
		Public Const RTN_VEC_FIFO_FULL As Int32 = -9
		' 缓冲区满
		Public Const RTN_CMD_UNSUPPORT As Int32 = -10
		' 指令不支持
		Public Const RTN_CMD_PARA_ERROR As Int32 = -11
		' 参数错，范围超出
		Public Const RTN_CMD_EXE_ERROR As Int32 = -12
        ' 执行失败

        ' 坐标系状态字位定义 
        Public Const BIT_CORD_BUSY As Int32 = &H1
        ' bit 0 , 运动:1 ，静止 0,立即运动下运动停止，完成 
        Public Const BIT_CORD_MVERR As Int32 = &H2
        ' bit 1 , 上次运动出错，或当前运动指令无法启动，需要软件复位    
        Public Const BIT_CORD_EMPTY As Int32 = &H4
        ' bit 2 , 缓冲区空　       
        Public Const BIT_CORD_FULL As Int32 = &H8
        ' bit 3 , 缓冲区满　       
        Public Const BIT_CORD_NODATASTOP As Int32 = &H10
        ' bit 4 , 缓冲区空异常停止
        Public Const BIT_CORD_SDRAM_HWERR As Int32 = &H20
        ' bit 5, 插补缓冲区SDRAM硬件错误 

        ' 轴状态字位定义 
        Public Const BIT_AXIS_BUSY As Int32 = &H1
		' bit 0  , 运动:1 ，静止 0 
		Public Const BIT_AXIS_POSREC As Int32 = &H2
		' bit 1 , 伺服位置到达，步进模式时位置到达，伺服模式时实际位置到达误差限 
		Public Const BIT_AXIS_MVERR As Int32 = &H4
		' bit 2 , 上次运动出错，或当前无法启动运动，需要软件复位 
		Public Const BIT_AXIS_SVON As Int32 = &H8
		' bit 3  , 伺服允许        
		Public Const BIT_AXIS_CRD As Int32 = &H10
		' bit 4 , 坐标系模式      
		Public Const BIT_AXIS_STEP As Int32 = &H20
		' bit 5  , 步进/伺服       
		Public Const BIT_AXIS_LMTP As Int32 = &H40
		' bit 6  , 正向限位        
		Public Const BIT_AXIS_LMTN As Int32 = &H80
		' bit 7  , 负面限位        
		Public Const BIT_AXIS_SOFTPOSLMT As Int32 = &H100
		' bit 8  , 正向软限位触发  
		Public Const BIT_AXIS_SOFTNEGLMT As Int32 = &H200
		' bit 9  , 负向软限位触发  
		Public Const BIT_AXIS_ALM As Int32 = &H400
		' bit 10  , 伺服报警，需要软件复位 
		Public Const BIT_AXIS_POSERR As Int32 = &H800
		' bit 11  , 位置超限，需要软件复位 
		Public Const BIT_AXIS_ESTP As Int32 = &H1000
		' bit 12 , 急停，需要软件复位 
		Public Const BIT_AXIS_HWERR As Int32 = &H2000
		' bit 13 , 急停，需要软件复位 
		Public Const BIT_AXIS_CAPTSET As Int32 = &H4000
		' bit 14  , 捕获触发        
		' 回零状态字位定义 
		Public Const BIT_AXHOME_BUSY As Int32 = &H1
		' bit 0  , 忙    
		Public Const BIT_AXHOME_OK As Int32 = &H2
		' bit 1  , 成功  
		Public Const BIT_AXHOME_FAIL As Int32 = &H4
		' bit 2  , 失败  
		Public Const BIT_AXHOME_ERR_MV As Int32 = &H8
		' bit 3  , 错误：运动参数出错导致不动 
		Public Const BIT_AXHOME_ERR_SWT As Int32 = &H10
		' bit 4  , 错误：搜寻过程中开关没触发 
		' 各轴的规划模式
        Public Const MT_NONE_PRF_MODE As Int32 = -1
		' 无效
		Public Const MT_PTP_PRF_MODE As Int32 = 0
		' 梯形规划
		Public Const MT_JOG_PRF_MODE As Int32 = 1
		' 连续速度模式
		Public Const MT_PT_PRF_MODE As Int32 = 2
		' PT模式
		Public Const MT_CRD_PRF_MODE As Int32 = 3
		' 龙门跟随模式
		Public Const MT_GANTRY_MODE As Int32 =(4)      
		' PT模式       
		Public Const MT_PT_PRF_MODE As Int32 =(5)
		' 多轴直线插补				
		Public Const MT_MULTI_LINE_MODE As Int32 =(6)	
		' 电子齿轮模式			
		Public Const MT_GEAR_PRF_MODE As Int32 =(7)	
		' Follow跟随模式			
		Public Const MT_FOLLOW_PRF_MODE As Int32 =(8)				




		' 坐标系
		' 通用输出宏类型
		Public Const BUF_OUT_GROUP_DA As Int32 = 0
		' 模拟量输出
		Public Const BUF_OUT_GROUP_PWM As Int32 = 1
		' PWM输出
		' 编码器模式：定义信号源，信号类型，取反，,编码器分频等 
		' Bit7:0 分频系数，数值为0~255。对应分频数值 1~256
		' Bit9:8 信号号源选择
		'   00：外部信号输入
		'   01: 轴脉冲输入
		'   10：自动产生信号（正脉冲）
		'   11：自动产生信号（负脉冲）
		' Bit11:10 信号类型（外部）
		'  00：AB相，90度差
		'  01：脉冲+方向
		'  10：正脉冲+负脉冲
		'  11：保留
		' Bit12 输入A、B交换（外部） 0：不交换，1：交换
		' Bit13 输入A取反（外部） 0：不取反，1：取反
		' Bit14 输入B取反（外部） 0：不取反，1：取反
		' Bti15 编码器饱和，0：最大最小值翻转，1：不翻转

		' 专用IO定义，alm : home : limit+ , limit-
		Public Const BIT_AXMTIO_LMTN As Int32 = &H1
		' bit 0  ,负向限位  
		Public Const BIT_AXMTIO_LMTP As Int32 = &H2
		' bit 1  ,正向限位 
		Public Const BIT_AXMTIO_HOME As Int32 = &H4
		' bit 2  ,原点 
		Public Const BIT_AXMTIO_ALARM As Int32 = &H8
		' bit 3  ,驱动报警
		' 通讯设置
		Public Enum TSearchMode
			USB = 0
			Ethernet
			RS485
		End Enum

		' 回零类型定义                                                 
		' 回零模式    单原点	   单限位	  单Z相	   原点+Z相 原点+ -Z相	限位+ -Z相
		Public Enum THomeMode
			HM_MODE1 = 0
			HM_MODE2
			HM_MODE3
			HM_MODE4
			HM_MODE5
			HM_MODE6
		End Enum

		' 其他
		Public Const ACC_MAX As Int32 = 9999

		'----------------------------------------------------------
		'  结构体定义                                                 
		'----------------------------------------------------------
		''' <summary>
		''' 设备信息结构
		''' </summary>
		Public Structure TDevInfo
			Public address As UShort
			' 在上位机系统中的设备序号,
			<MarshalAs(UnmanagedType.ByValArray, SizeConst := 16)> _
			Public idStr As Byte()
			' 识别字符串  
			<MarshalAs(UnmanagedType.ByValArray, SizeConst := 64)> _
			Public description As Byte()
			' 描述符
			Public ID As UShort
			' 板上的ID
			Public Sub New(add As UShort, id__1 As UShort, des As Byte())
				address = add
                idStr = New Byte() {15}
                description = New Byte() {63}
                ID = id__1
            End Sub
        End Structure

        ''' <summary>
        ''' 当前运动控制器固件的版本等信息
        ''' </summary>
        Public Structure TMtLibVersion
            ' 版本
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)>
            Public ver As Byte()
            ' 更新时间
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> _
            Public [date] As Byte()
            ''' <summary>
            ''' 轴数量
            ''' </summary>
            Public axisNum As Byte
            ''' <summary>
            ''' 编码器数量
            ''' </summary>
            Public encNum As Byte
            ''' <summary>
            ''' DI数量
            ''' </summary>
            Public diNum As Byte
            ''' <summary>
            ''' DO数量
            ''' </summary>
            Public doNum As Byte
            ''' <summary>
            ''' DA数量
            ''' </summary>
            Public daNum As Byte
            ''' <summary>
            ''' AD数量
            ''' </summary>
            Public adNum As Byte
            '保留
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public _date As Byte()
        End Structure

        ''' <summary>
        ''' 单轴运动参数结构
        ''' </summary>
        Public Structure TPtpPara
            Public acc As Double
            Public dec As Double
            Public startVel As Double
            Public endVel As Double
            Public smoothCoef As Short
            Public dummy1 As Short
            Public dummy2 As Short
            Public dummy3 As Short
        End Structure

        ' 单轴JOG运动参数结构
        Public Structure TJogPara
            Public acc As Double
            Public dec As Double
            Public smoothCoef As Double
        End Structure

        ''' <summary>
        ''' 坐标系配置
        ''' </summary>
        Public Structure TCrdConfig
            Public axCnts As Short
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public reserved As Short()
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public pAxis As Short()
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public port As Short()

            Public Sub New(ByVal init As Boolean)
                axCnts = 0
                reserved = New Short(2) {}
                pAxis = New Short(3) {}
                port = New Short(3) {}
            End Sub
        End Structure

        ''' <summary>
        ''' 坐标系运动参数
        ''' </summary>
        Public Structure TCrdPara
            Public orgFlag As Short
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public reserved As Short()
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public offset As Int32()
            Public synAccMax As Double
            Public synVelMax As Double

            Public Sub New(ByVal init As Boolean)
                orgFlag = 0
                reserved = New Short(2) {}
                offset = New Integer(3) {}
                synAccMax = 0
                synVelMax = 0
            End Sub
        End Structure

        ''' <summary>
        ''' 坐标系运动扩展参数
        ''' </summary>
        Public Structure TExtCrdPara
            Public startVel As Double
            Public T As Double
            Public smoothDec As Double
            Public abruptDec As Double
            Public lookAheadSwitch As Short
            Public eventTime As Short
            Public dummy2 As Short
            Public dummy3 As Short

            Private Class CSharpImpl
                <Obsolete("Please refactor calling code to use normal Visual Basic assignment")>
                Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
                    target = value
                    Return value
                End Function
            End Class
        End Structure

        ''' <summary>
        '''  回零参数设置
        ''' </summary>
        Public Structure THomeSetting
            Public mode As Short
            ' 模式，HM_MODE1 ~ HM_MODE6 （必须）
            Public dir As Short
            ' 搜寻零点方向（必须）, 0:负向，1：正向，其它值无意义
            Public offset As Int32
            ' 原点偏移（必须）
            Public scan1stVel As Double
            ' 基本搜寻速度（必须）
            Public scan2ndVel As Double
            ' 低速（两次搜寻时需要）
            ' 当usePreSetPtpPara=0时，回零运动的减加速度默认等于acc,起跳速度、终点速度、平滑系数默认为0
            Public acc As Double
            ' 加速度
            Public reScanEn As Byte
            ' 是否两次搜寻零点（可选，不用时设为0）
            Public homeEdge As Byte
            ' 原点，触发沿（默认下降沿）
            Public lmtEdge As Byte
            ' 限位，触发沿（默认下降沿）
            Public zEdge As Byte
            ' 限位，触发沿（默认下降沿）
            Public iniRetPos As Int32
            ' 起始反向运动距离（可选，不用时设为0）
            Public retSwOffset As Int32
            ' 反向运动时离开开关距离（可选，不用时设为0）
            Public safeLen As Int32
            ' 安全距离，回零时最远搜寻距离（可选，不用时设为0，不限制距离）
            Public usePreSetPtpPara As Byte
            ' 为1表示用户需要在启动回零前，自己设置回零运动（点到点）的参数
            Public reserved0 As Byte
            ' 保留
            Public reserved1 As Byte
            ' 保留
            Public reserved2 As Byte
            ' 保留
            Private Class CSharpImpl
                <Obsolete("Please refactor calling code to use normal Visual Basic assignment")>
                Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
                    target = value
                    Return value
                End Function
            End Class
        End Structure

        ' 坐标系运动扩展参数
        Public Structure TAxisStsPack
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public prfPos As Int32() '规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public encPos As Int32() '实际位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public prfVel As Single() '规划速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public motionIO As Int32()
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public sts As Short()
            Public gpo As Int32
            Public gpi As Int32

            Public Sub New(ByVal bInit As Boolean)
                prfPos = New Integer(3) {}
                encPos = New Integer(3) {}
                prfVel = New Single(3) {}
                motionIO = New Integer(3) {}
                sts = New Short(3) {}
                gpo = 0
                gpi = 0
            End Sub
        End Structure

        ' 轴运动安全参数
        Public Structure TSafePara
            Public estpDec As Double
            Public maxVel As Double
            Public maxAcc As Double

            Private Class CSharpImpl
                <Obsolete("Please refactor calling code to use normal Visual Basic assignment")>
                Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
                    target = value
                    Return value
                End Function
            End Class
        End Structure

        Public Structure TPackedCrdSts3
            Public crdSts As Int16
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public axSts As Int16()
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public prfPos As Int32()
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public axisPos As Int32()
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public encPos As Int32()
            Public userSeg As Int32
            Public prfVel As Double
            Public gpDi As Int32
            Public gpDo As Int32
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public motDi As Int16()
            Public reserved As Int16
            Public crdFreeSpace As Int32
            Public reserved2 As Int32

            Public Sub New(ByVal init As Boolean)
                crdSts = 0
                axSts = New Int16(2) {}
                prfPos = New Int32(2) {}
                axisPos = New Int32(2) {}
                encPos = New Int32(2) {}
                userSeg = 0
                prfVel = 0
                gpDi = 0
                gpDo = 0
                motDi = New Int16(2) {}
                reserved = 0
                crdFreeSpace = 0
                reserved2 = 0
            End Sub

            Private Class CSharpImpl
                <Obsolete("Please refactor calling code to use normal Visual Basic assignment")>
                Shared Function __Assign(Of T)(ByRef target As T, value As T) As T
                    target = value
                    Return value
                End Function
            End Class
        End Structure

        '----------------------------------------------------------
        '  函数声明
        '----------------------------------------------------------
        'function
        '----------------------------------------------------------
        '	1.控制器的打开和基本操作
        '----------------------------------------------------------

        ' 板卡搜寻
        ' mode:通讯模式
        ' pDevNo:返回设备的数目
        'pInfoList:返回设备信息
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevSearch(mode As TSearchMode, ByRef pDevNo As UInt16, <MarshalAs(UnmanagedType.LPArray, SizeConst:=4 * 84)> pInfoList As Byte()) As Int16
        End Function

        ' 板卡打开（根据序号）
        ' devNo: 设备序号，取值范围[0,n]； pDevHandle: 返回设备操作句柄
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevOpen(devNo As Int16, ByRef pDevHandle As UInt16) As Int16
        End Function

        ' 板卡复位
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevReset(devHandle As HAND) As Int16
        End Function

        ' 板卡打开（根据名称）
        ' idStr: 板卡ID字符串, 可通过指令写入。pDevHandle: 返回设备操作句柄
        ' 注：ID号用户可写入，掉电不丢失，可用于区分板卡。出厂板卡号ID号为0
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevOpenByID(idStr As String, ByRef pDevHandle As UInt16) As Int16
        End Function

        ' 板卡打开（根据IP地址）
        '注：ID号用户可写入，掉电不丢失，可用于区分板卡。出厂板卡号ID号为CARD1
        'pIPv4Array :板卡IP地址,四个字节,例如：unsinged char ipv4[4] = {192,168,1,110End Structure
        ' pDevHandle :返回设备操作句柄
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevOpenByIP(pIPv4Array As String, ByRef pDevHandle As UInt16) As Int16
        End Function

        ' 板卡关闭
        ' pDevHandle : 设备句柄指针
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevClose(ByRef pDevHandle As UInt16) As Int16
        End Function

        ' 打开单轴
        ' devHandle : 设备句柄
        ' itemNo：轴号，取值范围[0,n]
        ' pCrdHandle：坐标系组句柄
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtOpen(devHandle As HAND, itemNo As Int16, ByRef pAxisHandle As UInt16) As Int16
        End Function

        ' 关闭单轴
        ' devHandle : 设备句柄指针
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtClose(ByRef pAxisHandle As UInt16) As Int16
        End Function

        ' 打开坐标系组
        ' pCrdHandle：返回坐标系组句柄
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdOpenEx(devHandle As HAND, itemNo As Int16, ByRef pCrdHandle As UInt16) As Int16
        End Function

        ' 关闭坐标系组
        ' pCrdHandle：坐标系组句柄

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdClose(ByRef pCrdHandle As UInt16) As Int16
        End Function

        ' 加载配置文件

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LoadConfigFromFile(ByVal devHandle As HAND,
        <MarshalAs(UnmanagedType.LPArray, SizeConst:=128)> ByVal pFilePath As Byte()) As Int16
        End Function

        ' 保存基本的配置信息,将这些信息保存到系统参数区,控制器重启或者NMC_DevReset后,系统将使用这些参数
        ' 保存的参数包括报警、限位、脉冲方式、编码器方式、安全参数、滤波参数
        ' enable:1表示保存当前配置,并使能自动加载参数功能,0：表示关闭自动加载参数功能

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SaveMotionConfig(devHandle As HAND, enable As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	2.控制器的基本配置(单轴)
        '----------------------------------------------------------
        ' 硬件限位配置
        ' posLmtEnable: 正向限位触发允许设置,1为允许,0为禁止
        ' negLmtEnable: 负向限位触发允许设置,1为允许,0为禁止
        ' posLmtSns: 正向限位触发电平,1为高电平触发,0为低电平触发
        ' negLmtSns: 正向限位触发电平,1为高电平触发,0为低电平触发

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetLmtCfg(axisHandle As HAND, posLmtEnable As Int16, negLmtEnable As Int16, posLmtSns As Int16, negLmtSns As Int16) As Int16
        End Function

        ' 读取限位开关输入是否停止运动
        ' posEn：正向限位触发允许设置，1为允许，0为禁止
        ' negEn: 负向限位触发允许设置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetLmtOnOff(axisHandle As HAND, ByRef posSwt As Int16, ByRef negSwt As Int16) As Int16
        End Function

        ' 读取限位开关触发电平
        ' posSwt：正向限位触发电平设置，1为高电平触发，0为低电平触发
        ' negSwt: 负向限位触发电平设置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetLmtSns(axisHandle As HAND, ByRef posSwt As Int16, ByRef negSwt As Int16) As Int16
        End Function

        ' 伺服报警配置
        ' alarmEnable: 伺服报警触发允许设置,1为允许,0为禁止
        ' alarmSns:     伺服报警触发电平,1为高电平触发,0为低电平触发
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetAlarmCfg(axisHandle As HAND, alarmEnable As Int16, alarmSns As Int16) As Int16
        End Function

        ' 读取伺服报警开关是否停止运动
        ' swt：伺服报警开关输入允许设置，1为允许，0为禁止。（默认为高电平触发）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetAlarmOnOff(axisHandle As HAND, ByRef swt As Int16) As Int16
        End Function

        ' 读取伺服报警开关电平
        ' swt：伺服报警触发电平设置，1为高电平触发，0为低电平触发
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetAlarmSns(axisHandle As HAND, ByRef swt As Int16) As Int16
        End Function

        ' 设置软件限位是否停止运动
        ' enable：软件限位触发允许设置，1为允许，0为禁止
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSwLmtOnOff(axisHandle As HAND, swt As Int16) As Int16
        End Function

        ' 读取软件限位是否停止运动
        ' enable：软件限位触发允许设置，1为允许，0为禁止
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetSwLmtOnOff(axisHandle As HAND, ByRef swt As Int16) As Int16
        End Function

        ' 设置软件限位数值
        ' posLmt：正向软件限位设置值
        ' negLmt：负向软件限位设置值。单位为脉冲数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSwLmtValue(axisHandle As HAND, posLmt As Int32, negLmt As Int32) As Int16
        End Function

        ' 读取软件限位数值
        ' posLmt：正向软件限位设置值
        ' negLmt：负向软件限位设置值。单位为脉冲数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetSwLmtValue(axisHandle As HAND, ByRef posLmt As Int32, ByRef negLmt As Int32) As Int16
        End Function

        ' 设置轴安全参数
        ' TSafePara：包含急停减速度、最大允许速度、最大允许加速度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetSafePara(axisHandle As HAND, ByRef refPara As TSafePara) As Int16
        End Function

        ' 读取轴安全参数
        ' TSafePara：包含急停减速度、最大允许速度、最大允许加速度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetSafePara(axisHandle As HAND, ByRef pPara As TSafePara) As Int16
        End Function

        ' 设置脉冲输出模式
        ' en, 1：输出允许，0：输出禁止
        ' mode 0：脉冲方向 1：正负脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetStepMode(axisHandle As HAND, en As Int16, mode As Int16) As Int16
        End Function

        ' 读取脉冲输出模式
        ' en, 1：输出允许，0：输出禁止
        ' mode 0：脉冲方向 1：正负脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetStepMode(axisHandle As HAND, ByRef en As Int16, ByRef mode As Int16) As Int16
        End Function

        ' 读取轴速度滤波参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetAxisVelFilter(axisHandle As HAND, ByRef pFilterCoef As Int16) As Int16
        End Function

        ' 设置轴速度滤波参数
        ' 注：filterCoef系数在0~5之间，值越大，速度越平滑
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetAxisVelFilter(axisHandle As HAND, filterCoef As Int16) As Int16
        End Function

        ' 设置脉冲输出滤波
        ' coe系数： 范围0~65535,0不滤波,数值越大滤波效果越明显。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetStepFilter(axisHandle As HAND, coe As UInt16) As Int16
        End Function

        ' 读取脉冲输出滤波
        ' pCoe系数： 范围0~65535,0不滤波,数值越大滤波效果越明显。默认值为0
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetStepFilter(axisHandle As HAND, ByRef pCoe As UInt16) As Int16
        End Function

        ' 设置编码器模式
        ' encId: 编码器ID,取值范围[0,n]
        ' encMode:编码器模式，参考宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetEncMode(devHandle As HAND, encId As Int16, encMode As Int16) As Int16
        End Function

        ' 读取编码器模式
        ' encId: 编码器ID,取值范围[0,n]
        ' encMode:返回编码器模式，参考宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetEncMode(devHandle As HAND, encId As Int16, ByRef encMode As Int16) As Int16
        End Function

        ' 设置允许的位置误差，当位置误差超过设定值时，电机停止运动，提示位置误差超限
        ' posErr为0表示不检查
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetPosErrLmt(axisHandle As HAND, posErr As Int32) As Int16
        End Function

        ' 读取允许的位置误差，当位置误差超过设定值时，电机停止运动，提示位置误差超限
        ' posErr为0表示不检查
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPosErrLmt(axisHandle As HAND, ByRef pPosErr As Int32) As Int16
        End Function

        '----------------------------------------------------------
        '	3.控制器的状态检测
        '----------------------------------------------------------
        ' 读当前轴状态
        ' pStsWord: 返回轴状态字。参考位定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetSts(axisHandle As HAND, ByRef pStsWord As Int16) As Int16
        End Function

        ' 清除轴错误状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtClrError(axisHandle As HAND) As Int16
        End Function

        ' 清除轴错误状态,按位清除
        ' stsMask:对应位为1表明需要清除对应位的错误状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtClrStsByBits(axisHandle As HAND, stsMask As Int16) As Int16
        End Function

        ' 读规划位置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPrfPos(axisHandle As HAND, ByRef pos As Int32) As Int16
        End Function

        ' 读当前轴规划速度
        ' pVel: 返回速度，单位是 脉冲/ms
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPrfVel(axisHandle As HAND, ByRef pVel As [Double]) As Int16
        End Function

        ' 读机械位置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetAxisPos(axisHandle As HAND, ByRef pos As Int32) As Int16
        End Function

        ' 读当前规划位置（发送到执行器的位置）
        ' pos : 返回位置，单位是 脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetCmdPos(axisHandle As HAND, ByRef pos As Int32) As Int16
        End Function

        ' 读编码器位置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetEncPos(axisHandle As HAND, ByRef pos As Int32) As Int16
        End Function

        ' 读编码器速度
        ' devHandle : 控制器句柄；encId: 编码器ID,取值范围[0,n]
        ' vel:返回编码器速度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetEncVel(devHandle As HAND, encId As Int16, ByRef vel As Double) As Int16
        End Function

        ' 读取打包轴状态（12轴）
        Public Structure TAxisStsPack12Ex
            Public reserved2 As Long
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtSts As Int16()          ' 单轴状态，位定义参考NMC_MtGetSts
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtMio As Int16()          ' 单轴专用IO,位定义参考NMC_MtGetMotionIO
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtMioLog As Int16()       ' 单轴专用IO:逻辑电平,位定义参考NMC_MtGetMotionIOLogical
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtPrfPos As Int32()       ' 单轴规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtEncPos As Int32()       ' 单轴实际位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtPrfVel As Single()       ' 单轴规划速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdSts As Int16()         ' 坐标系状态
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdPrfVel As Single()      ' 坐标系运动速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdUserSeg As Int32()      ' 坐标系运行的缓冲区段号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdFreeSpace As Int32()    ' 坐标系缓冲区剩余空间
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdUsedSpace As Int32()    ' 坐标系缓冲区使用空间
            Public gpi As Int32                ' 通用输入
            Public gpo As Int32                ' 通用输出
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdLeftLen As Int32()      ' 坐标系缓冲区剩余段长，单位:脉冲
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdAllCmdCnt As Int32()   ' 坐标系缓冲区总共压入的指令数目
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)>
            Public extDi As Int32()           ' 扩展模块输入，2号站~8号站
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)>
            Public extDo As Int32()           ' 扩展模块输出，2号站~8号站
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)>
            Public reserved As Int32()       ' 预留
            Public Sub New(ByVal init As Boolean)
                reserved2 = 0
                mtSts = New Short(12) {}
                mtMio = New Short(12) {}
                mtMioLog = New Short(12) {}
                mtPrfPos = New Integer(12) {}
                mtEncPos = New Integer(12) {}
                mtPrfVel = New Single(12) {}
                crdSts = New Short(2) {}
                crdPrfVel = New Single(2) {}
                crdUserSeg = New Integer(2) {}
                crdFreeSpace = New Integer(2) {}
                crdUsedSpace = New Integer(2) {}
                gpi = 0
                gpo = 0
                crdLeftLen = New Integer(2) {}
                crdAllCmdCnt = New Integer(2) {}
                extDi = New Integer(6) {}
                extDo = New Integer(6) {}
                reserved = New Integer(16) {}
            End Sub

        End Structure
        ' 打包读取12个轴的状态
        ' axisFirstHandle : 第一个轴句柄
        ' pPackSts: 打包的状态数据,参考结构体定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetStsPack12Ex(axisFirstHandle As HAND, ByRef pPackSts As TAxisStsPack12Ex) As Int16
        End Function

        '----------------------------------------------------------
        '	4.点位和JOG运动
        '----------------------------------------------------------

        ' 设置单轴规划模式
        ' mode：单轴运动模式
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetPrfMode(axisHandle As HAND, mode As Int16) As Int16
        End Function

        ' 获取轴规划模式
        ' pMode：返回轴运动模式
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPrfMode(axisHandle As HAND, ByRef pMode As Int16) As Int16
        End Function

        ' 设置多个参数, 并更新。
        ' pAxPara：参数，参考结构定义。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetPtpPara(axisHandle As HAND, ByRef refAxPara As TPtpPara) As Int16
        End Function

        ' 获取Ptp参数
        ' pAxPara：参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPtpPara(axisHandle As HAND, ByRef pAxPara As TPtpPara) As Int16
        End Function

        ' 设置目标运动位置
        ' pos: 目标位置，单位是 脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetPtpTgtPos(axisHandle As HAND, pos As Int32) As Int16
        End Function

        ' 获取目标运动位置
        ' pos: 目标位置，单位是 脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPtpTgtPos(axisHandle As HAND, ByRef pPos As Int32) As Int16
        End Function

        ' 设置目标运动速度
        ' vel: 目标速度（最大速度），单位是 脉冲/ms
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetVel(axisHandle As HAND, vel As Double) As Int16
        End Function

        ' 获取目标运动速度
        ' vel: 目标速度（最大速度），单位是 脉冲/ms
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetVel(axisHandle As HAND, ByRef pVel As [Double]) As Int16
        End Function

        ' 设置Jog运动参数
        ' pAxPara：参数，参考结构定义。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetJogPara(axisHandle As HAND, ByRef refAxPara As TJogPara) As Int16
        End Function

        ' 获取Jog参数
        ' pAxPara：参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetJogPara(axisHandle As HAND, ByRef pAxPara As TJogPara) As Int16
        End Function

        ' 参数更新
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtUpdate(axisHandle As HAND) As Int16
        End Function

        ' 多轴同时启动
        ' axisHandle:任意轴
        ' axisMask：按bit对应相应轴号,bit为1表示启动,bit为0表示不启动
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtUpdateMulti(axisHandle As HAND, axisMask As Int32) As Int16
        End Function

        ' 单轴运动停止
        ' 注：运动会按设定的减速度停止。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtStop(axisHandle As HAND) As Int16
        End Function

        ' 单轴急停
        ' 注：运动会按设定的急停加速度停止。如果没有设置，则会立即停止。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtEstp(axisHandle As HAND) As Int16
        End Function

        ' 单轴急停，不会置起急停标志位
        ' 注：运动会按设定的急停加速度停止。如果没有设置,则会立即停止。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtAbruptStop(axisHandle As HAND) As Int16
        End Function

        ' 多轴同时停止
        ' axisHandle:任意轴
        ' axisMask：按bit对应相应轴号,bit为1表示启动,bit为0表示不启动
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtStopMulti(axisHandle As HAND, axisMask As Int32) As Int16
        End Function

        ' 单轴点位运动,包含NMC_MtSetPrfMode,NMC_MtSetPtpPara,NMC_MtSetVel,NMC_MtSetPtpTgtPos,NMC_MtUpdate
        ' acc:加速度,dec：减速度,startVel:起跳速度,endVel:终止速度,smoothCoef:平滑系数
        ' maxVel：最大速度
        ' tgtPos:目标位置,单位：脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtMovePtpAbs(axisHandle As HAND, acc As Double, dec As Double, startVel As Double, endVel As Double, maxVel As Double, smoothCoef As Int16, tgtPos As Int32) As Int16
        End Function

        ' 单轴点位运动,相对运动
        ' acc:加速度,dec：减速度,startVel:起跳速度,endVel:终止速度,smoothCoef:平滑系数
        ' maxVel：最大速度
        ' relPos:相对当前位置的移动量,单位：脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtMovePtpRel(axisHandle As HAND, acc As Double, dec As Double, startVel As Double, endVel As Double, maxVel As Double, smoothCoef As Int16, relPos As Int32) As Int16
        End Function

        Public Structure TMovePtpPack8
            Public axisMask As Int16            ' 轴掩码，对应bit为1表示该轴参与运动
            Public clrStsFlag As Int16      ' 是否运动前先清除轴状态，0：不清除，1：清除
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public reserved As Int16()     ' 保留
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public acc As Double()         ' 加速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public dec As Double()             ' 减加速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public startVel As Double()        ' 起跳速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public endVel As Double()          ' 终止速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public maxVel As Double()          ' 最大速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public smoothCoef As Int16()       ' 平滑系数
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public tgtPos As Int32()           ' 位置，单位:脉冲
        End Structure
        ' 单轴点位运动打包(绝对运动)
        ' axisFirstHandle:数组的第一个轴句柄
        ' pPackData:打包参数
        ' 注意：1.如果某轴存在无法运动的错误状态，则所有轴不会启动运动
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtMovePtpAbsPack8(axisFirstHandle As HAND, ByRef pPackData As TMovePtpPack8) As Int16
        End Function

        ' 单轴点位运动打包(相对运动)
        ' axisFirstHandle:数组的第一个轴句柄
        ' pPackData:打包参数
        ' 注意：1.如果某轴存在无法运动的错误状态，则所有轴不会启动运动
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtMovePtpRelPack8(axisFirstHandle As HAND, ByRef pPackData As TMovePtpPack8) As Int16
        End Function

        ' 单轴连续速度运动
        ' acc:加速度,dec：减速度,smoothCoef:平滑系数
        ' maxVel：最大速度
        ' clrStsFlag:是否运动前先清除轴状态，0：不清除，1：清除
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtMoveJog(axisHandle As HAND, acc As Double, dec As Double, maxVel As Double, smoothCoef As Int16, clrStsFlag As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	5.回零运动
        '----------------------------------------------------------
        ' 设置回零参数
        ' pHomePara: 回零参数结构，参考结构定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetHomePara(axisHandle As HAND, ByRef refHomePara As THomeSetting) As Int16
        End Function

        ' 读取回零参数
        ' pHomePara: 回零参数结构，参考结构定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetHomePara(axisHandle As HAND, ByRef pHomePara As THomeSetting) As Int16
        End Function

        ' 读回零状态
        ' pStsWord: 返回状态字。参数宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetHomeSts(axisHandle As HAND, ByRef pStsWord As Int16) As Int16
        End Function

        ' 启动回零
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtHome(axisHandle As HAND) As Int16
        End Function

        ' 尝试性回零（测试回零误差,不清位置）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtTryHome(axisHandle As HAND) As Int16
        End Function

        ' 终止回零
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtHomeStop(axisHandle As HAND) As Int16
        End Function

        ' 读新回零位置和历史回零位置的差值
        ' cmdPos: 位置偏差
        ' 注：回零成功时才有意义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetHomeError(axisHandle As HAND, ByRef cmdPos As Int32) As Int16
        End Function

        '----------------------------------------------------------
        '	6.坐标系的运动
        '----------------------------------------------------------

        '----------------------------------------------------------
        '	6.1 坐标系的初始化
        '----------------------------------------------------------
        ' 建立插补坐标系系统
        ' config:坐标系配置，参考结构体定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdConfig(crdHandle As HAND, ByRef refConfig As TCrdConfig) As Int16
        End Function

        ' 读取插补坐标系系统配置信息
        ' config:返回坐标系配置，参考结构体定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetConfig(crdHandle As HAND, ByRef pConfig As TCrdConfig) As Int16
        End Function

        ' 删除坐标系
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdDelete(crdHandle As HAND) As Int16
        End Function

        ' 设置坐标系参数
        ' crdPara:坐标系参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetPara(crdHandle As HAND, ByRef refCrdPara As TCrdPara) As Int16
        End Function

        ' 获取坐标系参数
        ' crdPara:坐标系参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetPara(crdHandle As HAND, ByRef pCrdPara As TCrdPara) As Int16
        End Function

        '缓冲区运动安全参数
        Public Structure TCrdSafePara
            Public estpDec As Double     ' 急停加速度
            Public maxVel As Double      ' 最大速度
            Public maxAcc As Double      ' 最大加速度
        End Structure
        ' 设置轴缓冲区运动安全参数
        ' pPara：包含急停减速度、最大允许速度、最大允许加速度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetSafePara(crdHandle As HAND, ByRef pPara As TCrdSafePara) As Int16
        End Function

        ' 设置坐标系扩展参数
        ' extCrdPara:坐标系扩展参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetExtPara(crdHandle As HAND, ByRef refExtCrdPara As TExtCrdPara) As Int16
        End Function

        ' 读取坐标系扩展参数
        ' extCrdPara:坐标系扩展参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetExtPara(crdHandle As HAND, ByRef pExtCrdPara As TExtCrdPara) As Int16
        End Function

        ' 坐标系运动：圆弧插补配置
        Public Const MAX_ERR_TABLE_SECTION As Int32 = 2
        Public Structure TArcSecSetting
            Public minSectionLen As Double              ' 分解的最小段长,默认1脉冲,范围[1,10000]
            Public maxArcDiff As Double                 ' 最大的圆弧有效性误差,单位：脉冲

            ' 圆弧插补误差配置表
            ' 注意：MTN通过限制圆弧插补速度,从而保证插补误差。r全部为0,则表示关闭这个功能
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=MAX_ERR_TABLE_SECTION)>
            Public r As Double()  ' 半径
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=MAX_ERR_TABLE_SECTION + 1)>
            Public err As Double()   ' 半径对应的插补误差,半径 [0,r0],对应err0;半径[r0,r1],对应err1;半径[r1,+max],对应err2
        End Structure
        ' 设置圆弧插补参数（高级指令）
        ' pSetting : 设置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetArcSecPara(crdHandle As HAND, ByRef pSetting As TArcSecSetting) As Int16
        End Function

        ' 读圆弧插补参数（高级指令）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetArcSecPara(crdHandle As HAND, ByRef pSetting As TArcSecSetting) As Int16
        End Function

        '设置向心加速度限制
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetLookAheadCentriAcc(crdHandle As HAND, isUsingSetAcc As Int16, centriAcc As Double) As Int16
        End Function

        ' 设置4维插补下，A轴的最大容忍转弯速度，若大于该速度，则需要进行降速处理
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetFourthAxisTolTurnVel(crdHandle As HAND, tolVel As Double) As Int16
        End Function

        '----------------------------------------------------------
        '	6.2 直线插补和平面圆弧插补
        '----------------------------------------------------------
        '直线插补
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' crdAxMask:参与的轴,按位表示
        ' pTgPosArray：目标位置数组,长度为3
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdLineXYZEx(crdHandle As HAND, segNo As Int32, crdAxMask As Int16, pTgPos As Int32(), endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' 四轴直线插补
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' crdAxMask:参与的轴,按位表示
        ' endVel,vel,synAcc:终点速度，最大速度，插补加速度
        ' pTgPosArray：目标位置数组
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdLineXYZA(crdHandle As HAND, segNo As Int32, crdAxMask As Int16, pTgPosArray As Int32(), endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' XY平面圆弧插补：终点位置、圆心、方向
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pCenterPosArray:圆心坐标（二维数组,分别表示XY轴相对于起点的圆心位置）,注意：圆心坐标为相对于起点的相对位置
        ' pTgPosArray：目标位置（二维数组,分别表示XY轴的目标位置）
        ' circleDir:圆弧方向,0表示顺时针方向,1表示逆时针方向
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdArcCenterEx(crdHandle As HAND, segNo As Int32, pTgPosArray As Int32(), pCenterPosArray As Int32(), circleDir As Int16, endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' YZ平面圆弧插补：终点位置、圆心、方向
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pCenterPosArray:圆心坐标（二维数组,分别表示ZX轴相对于起点的圆心位置）,注意：圆心坐标为相对于起点的相对位置
        ' pTgPosArray：目标位置（二维数组,分别表示YZ轴的目标位置）
        ' circleDir:圆弧方向,0表示顺时针方向,1表示逆时针方向
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdArcCenterYZEx(crdHandle As HAND, segNo As Int32, pTgPosArray As Int32(), pCenterPosArray As Int32(), circleDir As Int16, endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' ZX平面圆弧插补：终点位置、圆心、方向
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pCenterPosArray:圆心坐标（二维数组,分别表示ZX轴相对于起点的圆心位置）,注意：圆心坐标为相对于起点的相对位置
        ' pTgPosArray：目标位置（二维数组,分别表示ZX轴的目标位置）
        ' circleDir:圆弧方向,0表示顺时针方向,1表示逆时针方向
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdArcCenterZXEx(crdHandle As HAND, segNo As Int32, pTgPosArray As Int32(), pCenterPosArray As Int32(), circleDir As Int16, endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' XY平面圆弧插补：终点位置、半径、方向
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' radius:圆弧半径,大于0表示劣弧,小于0表示优弧
        ' pTgPosArray：目标位置数组（二维数组,分别表示XY的位置）
        ' circleDir:圆弧方向,0表示顺时针方向,1表示逆时针方向
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdArcRadiusEx(crdHandle As HAND, segNo As Int32, pTgPosArray As Int32(), radius As Double, circleDir As Int16, endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' YZ平面圆弧插补：终点位置、半径、方向
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' radius:圆弧半径,大于0表示劣弧,小于0表示优弧
        ' pTgPosArray：目标位置数组（二维数组,分别表示YZ的位置）
        ' circleDir:圆弧方向,0表示顺时针方向,1表示逆时针方向
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdArcRadiusYZEx(crdHandle As HAND, segNo As Int32, pTgPosArray As Int32(), radius As Double, circleDir As Int16, endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' ZX平面圆弧插补：终点位置、半径、方向
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' radius:圆弧半径,大于0表示劣弧,小于0表示优弧
        ' pTgPosArray：目标位置数组（二维数组,分别表示ZX的位置）
        ' circleDir:圆弧方向,0表示顺时针方向,1表示逆时针方向
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdArcRadiusZXEx(crdHandle As HAND, segNo As Int32, pTgPosArray As Int32(), radius As Double, circleDir As Int16, endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' XY平面圆弧插补：起点（当前点）、中点、终点
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pMidPosArray:中间位置点坐标（二维数组,分别表示中间点的XY轴的位置）
        ' pTgPosArray：终点位置坐标（二维数组,分别表示终点的XY轴的位置）
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdArcPPPEx(crdHandle As HAND, segNo As Int32, pMidPosArray As Int32(), pTgPosArray As Int32(), endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' 椭圆插补，默认不参与速度前瞻，起始和终止速度为0（注意！椭圆为整圆）
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pCenterPos：椭圆圆心点位置（二维数组,分别表示中点的XY轴的位置）。注意！起点位置到圆心位置为长轴的
        ' abRatio:表示椭圆AB轴的长度比例值 值范围：[0.05,1]
        ' ellipseDir:椭圆绘画方向,0表示顺时针方向,1表示逆时针方向
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdEllipse(crdHandle As HAND, segNo As Int32, abRatio As Double, pCenterPos As Int32(), ellipseDir As Int16, vel As Double, synAcc As Double) As Int16
        End Function

        '----------------------------------------------------------
        '	6.3 多维(8)插补指令
        '----------------------------------------------------------
        ' 多轴直线插补（最多支持8轴）
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' crdAxmask:坐标系中参与的轴,按位表示
        ' extAxMask:其他参与轴,按位表示,不能包括坐标系中
        ' pTgPosArray：目标位置数组,长度为所有参与运动的轴的数量,
        '              索引小的是坐标系内的轴的坐标（按crdAxMask位排列）。索引大的是其它联动轴的坐标（按extAxMask位排列）
        ' lookaheadDis:是否使用前瞻(仅仅适用与坐标系中的轴的运动),0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdLineXYZD8(crdHandle As HAND, segNo As Int32, crdAxMask As Int16, extAxMask As Int16, pTgPosArray As Int32(), endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' 8轴插补打包单元结构体
        Public Structure TCrdLineXYZD8Unit
            Public segNo As Int32         ' 用户自定义段号
            Public crdAxMask As Int16
            Public extAxMask As Int16
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public tgPos As Int32()     ' 目标位置
            Public vel As Single         ' 最大速度
            Public endVel As Single      ' 终点速度
            Public acc As Single            ' 插补加速度
            Public lookaheadDis As Int16    ' 是否使用前瞻
            Public reserved As Int16        ' 保留
        End Structure

        ' 打包的多轴直线插补
        ' count:打包指令数,取值范围[1,18]
        ' pCmdArray:指令列表
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdLineXYZD8Pack(crdHandle As HAND, count As Int16, ByRef pCmdArray As TCrdLineXYZD8Unit) As Int16
        End Function

        '----------------------------------------------------------
        '	6.4 螺旋线插补
        '----------------------------------------------------------

        ' 螺旋线插补
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pTgPosArray：目标位置（三维数组,分别表示终点的XYZ轴的位置）
        ' pCenterPosArray:圆心位置（二维数组,分别表示XY轴相对于起点的圆心位置）,注意：圆心坐标为相对于起点的相对位置
        ' rounds: Z方向圈数
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdHelixCenterEx(crdHandle As HAND, segNo As Int32, pTgPosArray As Int32(), pCenterPosArray As Int32(), circleDir As Int16, rounds As Double, endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	6.5 空间圆弧插补
        '----------------------------------------------------------
        ' 3D圆弧插补
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pMidPos：中点位置（三维数组,分别表示中点的XYZ轴的位置）
        ' pTgPos:终点位置（三维数组,分别表示终点的XYZ轴的位置）
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdArc3DEx(crdHandle As HAND, segNo As Int32, pMidPos As Int32(), pTgPos As Int32(), endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        ' 3D圆弧插补(整圆)
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pMidPos：中点位置（三维数组,分别表示中点的XYZ轴的位置）
        ' pTgPos:终点位置（三维数组,分别表示终点的XYZ轴的位置）
        ' lookaheadDis:是否使用前瞻,0：使用前瞻,则控制器自动计算终点速度,1：禁用前瞻,使用设定的终点速度（endVel）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdCircle3DEx(crdHandle As HAND, segNo As Int32, pMidPos As Int32(), pTgPos As Int32(), endVel As Double, vel As Double, synAcc As Double, lookaheadDis As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	6.6 缓存区的操作(IO、延时、单轴跟随等)
        '----------------------------------------------------------
        ' 缓冲区DO（按位输出）
        ' segNo:段号
        ' gourp:Do组别
        ' opBits：操作位
        ' value：输出值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufDo(crdHandle As HAND, segNo As Int32, group As Int16, opBits As Int32, value As Int32) As Int16
        End Function

        ' 缓冲区DO（掩码输出）
        ' segNo:段号
        ' gourp:Do组别,见宏定义
        ' doMask：位掩码
        ' doValue：输出值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufDoEx(crdHandle As HAND, segNo As Int32, group As Int16, doMask As Int32, value As Int32) As Int16
        End Function

        ' 缓冲区输出
        ' segNo:段号
        ' gourp:组别
        ' opBits：通道
        ' value：输出值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufOut(crdHandle As HAND, segNo As Int32, group As Int16, ch As Int16, value As Int32) As Int16
        End Function

        ' 缓冲区DI等待
        ' index:通道号
        ' diValue：等待值
        ' waitLastTime：超时
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufWaitDI(crdHandle As HAND, segNo As Int32, index As Int16, diValue As Int16, waitLastTime As Int32) As Int16
        End Function

        ' 缓冲区设置急停DI
        ' axis:轴号,取值范围[0,n)
        ' gpiIndex:通用输入序号
        ' sense:触发电平
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufSetEstopDI(crdHandle As HAND, segNo As Int32, axis As Int16, gpiIndex As Int16, sense As Int16) As Int16
        End Function

        ' 缓冲区延时
        ' segNo:段号
        ' scale:延时单位
        ' count：延时时长
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufDelay(crdHandle As HAND, segNo As Int32, scale As Int16, count As Int32) As Int16
        End Function

        ' 缓冲区单轴移动(带参数)
        ' segNo:段号
        ' axisMask:参与的轴
        ' pTgPos：目标位置
        ' vel:速度
        ' acc:加速度
        ' blockEn:是否为阻塞模式
        ' synEn：是否为同步模式,如果synEn和blockEn同时为1,则同步优先
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufAxMoveEx(crdHandle As HAND, segNo As Int32, axisMask As Int16, pTgPos As Int32(), vel As Double, acc As Double, blockEn As Int16, synEn As Int16) As Int16
        End Function

        ' 缓冲区单轴移动(相对位移移动)
        ' segNo:段号
        ' axisMask:参与的轴
        ' pRelPos：相对移动位置
        ' blockEn:是否为阻塞模式
        ' synEn：是否为同步模式,如果synEn和blockEn同时为1,则同步优先
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufAxMoveRel(crdHandle As HAND, segNo As Int32, axisMask As Int16, pRelPos As Int32(), blockEn As Int16, synEn As Int16) As Int16
        End Function

        ' 缓冲区单轴移动参数设置
        ' segNo:段号
        ' axis：轴号，[0,n]
        ' vel:运动速度
        ' acc:运动加速度
        ' smoothCoef:平滑系数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufSetPtpMovePara(crdHandle As HAND, segNo As Int32, axis As Int16, vel As Double, acc As Double, soomthCoef As Int16) As Int16
        End Function

        ' 设置跟随运动前的运动补偿量
        ' axis:轴号  0~N
        'relDistance：相对补偿位移量
        'vel：补偿速度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufBeforeAxSyncMove(crdHandle As HAND, segNo As Int32, axis As Int16, relDistance As Int32, vel As Double) As Int16
        End Function

        ' 功能:缓冲区等待电机运动到位
        ' segNo:段号
        ' axisMask:需要等待到位的轴掩码（按位对应轴号,不能超出控制器的最大轴数）
        ' overTime:等待到位超时的时间，单位：ms
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufWaitEncInPosition(crdHandle As HAND, segNo As Int32, axisMask As Int32, overTime As Int32) As Int16
        End Function

        ' 功能:缓冲区等待特定位置，满足条件才执行下一条指令
        ' segNo:段号
        ' axisNo:需要等待到位的轴号
        ' condition:到位条件，0：小于等于设定位置  1：大于等于设定位置
        ' pos:设定位置
        ' posSrc:等待规划还是编码器，0：编码器 1：内部规划
        ' overTime:等待到位超时的时间，单位：ms
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufWaitPos(crdHandle As HAND, segNo As Int32, axisNo As Int16, condition As Int16, pos As Int32, posSrc As Int16, overTime As Int32) As Int16
        End Function

        '----------------------------------------------------------
        '	6.7 插补打包指令介绍
        '----------------------------------------------------------
        ' 缓冲区数据打包
        Public Const BUF_LINE As Int32 = 0 '缓冲区直线插补
        Public Const BUF_DO As Int32 = 1 '缓冲区DO输出
        Public Const BUF_OUT As Int32 = 2 '缓冲区OUT输出
        Public Const BUF_DELAY As Int32 = 3 '缓冲区延时
        Public Const BUF_AXMOVE As Int32 = 4 '缓冲区单轴运动
        Public Const BUF_DOEX As Int32 = 5 '缓冲区DO输出（根据掩码输出）
        Public Const BUF_ARC_R As Int32 = 6 '平面圆弧插补：终点位置、半径、方向
        Public Const BUF_ARC_C As Int32 = 7 '平面圆弧插补：终点位置、圆心、方向
        Public Const BUF_LASER_SETPOWER As Int32 = 8   ' 激光：设置能量
        Public Const BUF_LASER_ONOFF As Int32 = 9   ' 激光：缓冲区开关光
        Public Const BUF_LASER_SETFOLLOW As Int32 = 10  ' 激光：设置跟随
        Public Const BUF_LASER_SETPARAM As Int32 = 11  ' 激光：设置参数
        Public Const BUF_LINEXYZA As Int32 = 12  ' 缓冲区四轴直线插补
        Public Const BUF_SHIO_GATEPULSE As Int32 = 13  ' 缓冲区输出Gate脉冲
        Public Const BUF_DOBITPULSE As Int32 = 14  ' DoBitPulse功能
        Public Const BUF_XYZD8 As Int32 = 15  ' LineXYZD8,数据结构体为：TCrdLineXYZD8Unit
        Public Const BUF_SHIOMINFRQ As Int32 = 16  ' 设置或清除SHIO最小频率
        Public Const BUF_SHIOSETPARAM As Int32 = 17   ' 设置SHIO参数
        Public Const BUF_SHIOGATEONOFF As Int32 = 18   ' 设置Gate开关
        Public Const BUF_WAITENCINPOS As Int32 = 19   ' 等待电机到位
        Public Const BUF_WAITDI As Int32 = 20   ' 等待DI

        Public Structure TCrdBufLine
            Public segNo As Int32        ' 用户自定义段号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public tgPos As Int32()     ' 目标位置
            Public endVel As Double     ' 终点速度
            Public vel As Double        ' 最大速度
            Public synAcc As Double     ' 插补加速度
            Public mask As Int16       ' crdAxMask,参与的插补轴,按位表示
            Public lookaheadDis As Int16 '是否使用前瞻
            Public reserved As Int32     ' 保留
        End Structure

        Public Structure TCrdBufLineXYZA
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public tgPos As Int32()     ' 目标位置
            Public endVel As Double     ' 终点速度
            Public vel As Double       ' 最大速度
            Public synAcc As Double     ' 插补加速度
            Public segNo As Int32        ' 用户自定义段号
            Public mask As Int16        ' crdAxMask,参与的插补轴,按位表示
            Public lookaheadDis As Int16 '是否使用前瞻
        End Structure

        Public Structure TCrdBufOut
            Public segNo As Int32     ' 用户自定义段号
            Public group As Int16    ' Out输出类型 
            Public ch As Int16       ' 通道号,取值范围[0,n]
            Public outValue As Int32    ' 输出
        End Structure

        Public Structure TCrdBufDO
            Public segNo As Int32     ' 用户自定义段号
            Public group As Int16    ' 缓冲区输出DO组 
            Public ch As Int16       ' 位序号,取值范围[0,31]
            Public value As Int32     ' 输出值,取值范围[0,1]
        End Structure

        Public Structure TCrdBufDelay
            Public segNo As Int32     ' 用户自定义段号
            Public scale As Int32     ' 延时单位,0表示单位为毫秒,1表示单位为秒
            Public count As Int32     ' 延时时长
        End Structure

        Public Structure TCrdBufDOEx
            Public segNo As Int32     ' 用户自定义段号
            Public group As Int32    ' 缓冲区输出DO组
            Public doMask As Int32    ' 输出操作位,bit位为1表示要输出
            Public value As Int32     ' 输出值,bit位指示输出值
        End Structure

        Public Structure TCrdBufAxMove
            Public segNo As Int32         ' 用户自定义段号
            Public axis As Int16           ' 单轴移动的轴号 [0,n],非坐标系内轴	
            Public soomthCoef As Int16   ' smoothCoef:平滑系数
            Public blockEn As Int16      ' 是否为阻塞模式 0 不阻塞 ,1 阻塞
            Public synEn As Int16        ' 是否为同步模式 0 异步 ,1 同步
            Public tgPos As Int32      ' 目标位置
            Public vel As Double         ' 运动速度
            Public acc As Double         ' 运动加速度
        End Structure

        Public Structure TCrdBufArcR
            Public segNo As Int32         ' 用户自定义段号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public tgPos As Int32()        ' 目标位置
            Public circleDir As Int16    ' 是否为同步模式 0 异步 ,1 同步
            Public lookaheadDis As Byte  ' 是否使用前瞻
            Public panelIndex As Byte    ' 圆弧插补平面：0：XY平面，1：YZ平面，其他：ZX平面
            Public radius As Double      ' 半径
            Public endVel As Double      ' 终点速度
            Public vel As Double         ' 运动速度
            Public acc As Double         ' 运动加速度
        End Structure

        Public Structure TCrdBufArcC
            Public segNo As Int32         ' 用户自定义段号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public tgPos As Int32()        ' 目标位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public centerPos As Int32()    ' 目标位置
            Public circleDir As Int16    ' 是否为同步模式 0 异步 ,1 同步
            Public lookaheadDis As Byte ' 是否使用前瞻
            Public panelIndex As Byte  ' 圆弧插补平面：0：XY平面，1：YZ平面，其他：ZX平面
            Public endVel As Double      ' 终点速度
            Public vel As Double         ' 运动速度
            Public acc As Double         ' 运动加速度
        End Structure

        Public Structure TCrdBufLaserSetParam

            Public segNo As Int32        ' 用户自定义段号
            Public onDelay As Int32     ' 开光延时
            Public offDelay As Int32     ' 关光延时
            Public minValue As Int32    ' 最小输出值
            Public maxValue As Int32    ' 最大输出值
            Public standbyPower As Int32    ' 待机能量
            Public ch As Int16         ' 激光控制通道
            Public reserved As Int16       ' 保留
        End Structure

        Public Structure TCrdBufLaserSetFollow

            Public segNo As Int32        ' 用户自定义段号
            Public followType As Int16     ' 跟随类型
            Public ch As Int16          ' 激光通道号
            Public overRide As Double      ' 跟随倍率
        End Structure

        Public Structure TCrdBufLaserOnOff
            Public segNo As Int32        ' 用户自定义段号
            Public onOff As Int16      ' 开关,0：关光,1：开光
            Public ch As Int16          ' 激光通道号
        End Structure

        Public Structure TCrdBufLaserSetPower

            Public segNo As Int32        ' 用户自定义段号
            Public ch As Int16         ' 激光通道号
            Public reserved As Int16        ' 保留
            Public power As Double      ' 能量
        End Structure

        Public Structure TCrdBufSHIOGatePulse
            Public segNo As Int32        ' 用户自定义段号
            Public outCount As Int32        ' 输出个数
            Public gateTime As Double  ' gate输出的脉宽，单位：微秒
            Public gateFrq As Double        ' gate输出的频率，单位：HZ
            Public ch As Int16          ' ch:通道
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public reserved As Int16()  ' 保留
        End Structure


        Public Structure TCrdBufDoBitPulse
            Public segNo As Int32           ' 用户自定义段号
            Public highLevelTime As Int32   ' 高电平宽度，单位:us
            Public lowLevelTime As Int32    ' 低电平宽度，单位:us
            Public outCount As Int32        ' 输出脉冲个数
            Public initialLevel As Int32    ' 0：先输出低电平，1：先输出高电平
            Public ch As Int16          ' ch:通道
            Public enable As Int16     ' 1:使能,0:关闭
            Public doType As Int16     ' DO类型,默认CRD_BUFF_DO_GPDO1
            Public doIndex As Int16        ' DO序号，取值范围[0,n]
        End Structure

        Public Structure TCrdBufSHIOMinFrq
            Public segNo As Int32           ' 用户自定义段号
            Public minFrq As Int32        ' 最小频率，仅当enable=1时有效
            Public ch As Int16          ' 通道
            Public setOrClr As Int16        ' 1:设置,0:清除
        End Structure

        Public Structure TCrdBufSHIOSetParam
            Public segNo As Int32            ' 用户自定义段号
            Public ch As Int16          ' 通道
            Public reserved As Int16    ' 保留
            Public delay As Double       ' 延时开关光时间
            Public gateTime As Double    ' gate打开时间，单位:秒
            Public gateDistance As Double ' 固定模式下的位置间隔，单位pulse
        End Structure

        Public Structure TCrdBufSHIOGateOnOff
            Public segNo As Int32           ' 用户自定义段号
            Public ch As Int16          ' 通道
            Public onOff As Int16       ' 1:打开，0：关闭
        End Structure

        Public Structure TCrdBufWaitEncInPosition
            Public segNo As Int32           ' 用户自定义段号
            Public axisMask As Int32        ' 轴掩码
            Public overTime As Int32        ' 等待超时时间，单位：毫秒
        End Structure

        Public Structure TCrdBufWaitDI
            Public segNo As Int32           ' 用户自定义段号
            Public index As Int16       ' 通道号,取值范围[0,127],前64通道代表通用DI，后64通道代表扩展IO
            Public level As Int16       ' 等待值
            Public waitLastTime As Int32  '超时,单位：毫秒
        End Structure


        ' 打包插补数据
        ' pBufData 插补数据结构存储数组
        ' dataLen 数据长度
        ' 压入数据时，先压入指令字，然后再压入指令字对应的工作数据，总的数据长度不超过1000个字节
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufDataPack(crdHandle As HAND, ByRef pBufData As String, dataLen As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	6.8 坐标系的状态检测
        '----------------------------------------------------------
        ' 读取坐标系状态
        ' pStsWord：返回状态字，参考宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetSts(crdHandle As HAND, ByRef pStsWord As Int16) As Int16
        End Function

        ' 读取规划位置XYZ
        ' cnts: 读取个数，1~N
        ' pos：返回坐标数组
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetPrfPos(crdHandle As HAND, cnts As Int16, ByRef pos As Int32) As Int16
        End Function

        ' 读取机械位置
        ' cnts: 读取个数，1~N
        ' pos：返回坐标数组。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetAxisPos(crdHandle As HAND, cnts As Int16, ByRef pPos As Int32) As Int16
        End Function

        ' 获取坐标系合成速度
        ' pVel：坐标系合成速度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetVel(crdHandle As HAND, ByRef pVel As [Double]) As Int16
        End Function

        ' 读取编码器位置
        ' cnts: 读取个数，1~N
        ' pos：返回坐标数组。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetEncPos(crdHandle As HAND, cnts As Int16, ByRef pPos As Int32) As Int16
        End Function

        Public Structure TPackedCrdSts4
            Public crdSts As Int16          ' 坐标系状态
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public axSts As Int16()        ' 坐标系里各轴状态
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public prfPos As Int32()       ' 用户坐标系下的规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public axisPos As Int32()      ' 机械坐标系下的规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public encPos As Int32()        ' 编码器位置
            Public userSeg As Int32         ' 运行的缓冲区段号
            Public prfVel As Double         ' 运动速度
            Public gpDi As Int32            ' 通用输入0~31
            Public gpDo As Int32             ' 通用输出0~31
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public motDi As Int16        ' 限位、原点、报警。请参考专用IO位定义( 搜索 BIT_AXMTIO_LMTN )
            Public reserved As Int16        ' 保留
            Public crdFreeSpace As Int32      ' 缓冲区剩余空间
            Public crdUsedSpace As Int32
        End Structure
        ' 坐标系运动模式下,打包读取控制器状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetStsPack4(crdHandle As HAND, ByRef pPackSts As TPackedCrdSts4) As Int16
        End Function

        ' 读取指令缓冲区空闲长度
        ' pRes：返回空闲的长度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufGetFree(crdHandle As HAND, ByRef pRes As Int32) As Int16
        End Function

        ' 读取指令缓冲区已用长度
        ' pLen: 长度。缓冲区中还未执行的指令个数。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufGetUsed(crdHandle As HAND, ByRef pLen As Int32) As Int16
        End Function

        ' 读段号
        ' pSegNo：返回的当前段号
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetUserSegNo(crdHandle As HAND, ByRef pSegNo As Int32) As Int16
        End Function

        '	读取总共压了多少条指令
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetBufAllCmdCnt(crdHandle As HAND, ByRef pCnt As Int32) As Int16
        End Function

        ' 坐标系状态字位定义:内部扩展 
        Public Const BIT_CORD_POSREC As Int32 = &H40              ' bit 6 , 伺服位置到达,步进模式时位置到达,伺服模式时实际位置到达误差限    
        Public Const BIT_CORD_AUXAXIS_BUSY As Int32 = &H80        ' bit 7 , 坐标系运动中的关联轴启动前处于运动状态错误
        Public Const BIT_CORD_AUXAXIS_ERR As Int32 = &H100        ' bit 8 , 插补辅助轴错误             
        Public Const BIT_CORD_AXIS_ERR As Int32 = &H200           ' bit 9 , 插补轴存在报警错误（如限位、驱动报警）   
        Public Const BIT_CORD_SDRAM_CALC_ERR As Int32 = &H400     ' bit 10 , SDRAM缓冲区计算错误  
        Public Const BIT_CORD_SCARA_CALC_ERR As Int32 = &H800     ' bit 11 , SCARA计算数据错误
        ' 读取内部坐标系状态
        ' pStsWord：返回状态字,定义64bits(二维的long数组),便于后续扩展状态位
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetInnerSts(crdHandle As HAND, ByRef pStsWord As Int32) As Int16
        End Function

        ' 获取插补缓冲区中尚未完成的总位移量
        ' pLen: 长度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetBufLeftLength(crdHandle As HAND, ByRef pLen As Double) As Int16
        End Function

        '----------------------------------------------------------
        '	6.9 其他指令
        '----------------------------------------------------------
        ' 坐标系缓冲运动启动  
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdStartMtn(crdHandle As HAND) As Int16
        End Function

        ' 立即平滑停止运动
        ' 注：立即停止运动。并不清空指令缓冲区。需要再次启动才能继续运行缓冲区指令。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdStopMtn(crdHandle As HAND) As Int16
        End Function

        ' 清坐标系运动错误状态，同时清除所包含轴的错误状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdClrError(crdHandle As HAND) As Int16
        End Function

        ' 指令缓冲区清空
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufClr(crdHandle As HAND) As Int16
        End Function

        ' 结束缓冲区运动（等待运动完后才结束区运动，并置空闲标志）
        ' 注：缓冲区运动结束并不立即停止运动。把指令缓冲区全部执行完后，结束缓冲区运动状态。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdEndMtn(crdHandle As HAND) As Int16
        End Function

        ' 设置坐标系速度倍率
        ' overRide：坐标系速度倍率
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetOverRide(crdHandle As HAND, overRide As Double) As Int16
        End Function

        ' 获取坐标系速度倍率
        ' overRide：坐标系速度倍率
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetOverRide(crdHandle As HAND, ByRef overRide As Double) As Int16
        End Function

        ' 设置轴缓冲区运动偏移
        ' count:设置偏移的轴数
        ' pOffsetArray：缓冲区运动偏移,long数组
        ' 注：会同时修改坐标系内相关轴的运动偏移！
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetOffset(crdHandle As HAND, count As Int16, ByRef pOffsetArray As Int32) As Int16
        End Function

        ' 急停
        ' 并不清空指令缓冲区
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdEstopMtn(crdHandle As HAND) As Int16
        End Function

        ' 返回缓冲区运动的断点
        ' vel:返回时使用的速度
        ' acc:返回时使用的加速度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGotoBreak(crdHandle As HAND, acc As Double, vel As Double) As Int16
        End Function

        ' 设置坐标系剩余位移量，用于控制激光能量跟随后的关闭波形输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetLeftLenForLaserWaveOff(crdHandle As HAND, length As Double) As Int16
        End Function


        ' 开始计算缓冲区执行时间
        ' 注意:1.如果需要计算执行时间，需要使用上位机前瞻
        '     2.开始后，所有的缓冲区指令，都不会压入控制器
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdStartExeTimeCalc() As Int16
        End Function

        ' 读取缓冲区指令的执行时间，并停止计算，单位:ms
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetExeTime(ByRef pTime As Double) As Int16
        End Function

        ' 设置是否计算所有线段长度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetBufLengthFlag(crdHandle As HAND, flag As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	7.IO资源访问
        '----------------------------------------------------------
        ' 设置通用输出(按通道,支持超过32位),带默认group
        ' value: 设置通用数字量输出。1, 输出高电平,0,输出低电平
        ' groupID:DO组,取值范围[0,n],具体需要看控制器是否存在多组数字量输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDOGroup(devHandle As HAND, value As Int32, groupID As Int16) As Int16
        End Function

        ' 按位设置通用输出
        ' bitIndex:取值范围[0,n],位序号
        ' value: 设置通用数字量输出。1, 输出高电平，0，输出低电平
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDOBit(devHandle As HAND, bitIndex As Int16, value As Int16) As Int16
        End Function

        ' 读取通用输出(按通道,支持超过32位),带默认group
        ' pDoValue: 设置通用数字量输出。1, 高电平,0,低电平
        ' groupID:DO组,取值范围[0,n],,0: 本地DO31~DO0, 1: 本地DO63~DO32,其他指扩展IO模块
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDOGroup(devHandle As HAND, ByRef pDoValue As Int32, groupID As Int16) As Int16
        End Function

        ' 读通用输入(按通道,支持超过32位) ,带默认group
        ' pInValue: 通用数字量输入值。1, 高电平,0,低电平
        ' groupID:DI组,取值范围[0,n],0: 本地DI31~DI0, 1: 本地DI63~DI32,其他指扩展IO模块
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDIGroup(devHandle As HAND, ByRef pInValue As Int32, groupID As Int16) As Int16
        End Function

        ' 按位读通用输入 
        ' 读通用输入(按通道,支持超过32位) 
        ' bitIndex:取值范围[0,n],位序号
        ' bitValue: 通用数字量输入值。1, 高电平，0，低电平
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDIBit(devHandle As HAND, bitIndex As Int16, ByRef bitValue As Int16) As Int16
        End Function

        ' 读运动控制专用IO
        ' inValue : 返回专用IO的状态，原点，限位，报警。参考位定义。对应位为0为低电平，1为高电平。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetMotionIO(axisHandle As HAND, ByRef inValue As Int32) As Int16
        End Function

        ' 读运动控制专用IO,逻辑电平
        ' pIoValue : 返回专用IO的状态,原点,限位,报警。参考位定义。对应位为0为低电平,1为高电平。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetMotionIOLogical(axisHandle As HAND, ByRef pIoValue As Int32) As Int16
        End Function

        ' 按位设置通用输入信号取反
        ' bitIndex:取值范围[0,n],位序号,前64位为本地的通用输入,大于64为扩展Di
        ' revs:是否取反,1：取反,0：不取反
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDIBitRevs(devHandle As HAND, bitIndex As Int16, revs As Int16) As Int16
        End Function

        ' 按位读取通用输入信号取反
        ' bitIndex:取值范围[0,n],位序号,前64位为本地的通用输入,大于64为扩展Di
        ' pRevs:是否取反,1：取反,0：不取反
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDIBitRevs(devHandle As HAND, bitIndex As Int16, ByRef pRevs As Int16) As Int16
        End Function

        ' 按位设置通用输出信号取反
        ' bitIndex:取值范围[0,n],位序号,前64位为本地的通用输出,大于64为扩展Do
        ' revs:是否取反,1：取反,0：不取反
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDOBitRevs(devHandle As HAND, bitIndex As Int16, revs As Int16) As Int16
        End Function

        ' 按位读取通用输出信号取反
        ' bitIndex:取值范围[0,n],位序号,前64位为本地的通用输出,大于64为扩展Do
        ' pRevs:是否取反,1：取反,0：不取反
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDOBitRevs(devHandle As HAND, bitIndex As Int16, ByRef pRevs As Int16) As Int16
        End Function

        ' DO输出定时脉冲
        ' bitIndex:取值范围[0,n],位序号,前64位为本地的通用输出,大于64为扩展Do
        ' value:设置通用数字量输出。1, 输出高电平,0,输出低电平
        ' reverseTime:持续的电平,单位:毫秒
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDOBitAutoReverse(devHandle As HAND, bitIndex As Int16, value As Int16, reverseTime As Int16) As Int16
        End Function

        ' 读取扩展IO模块的状态
        ' sts:io模块状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetIOModuleSts(devHandle As HAND, ByRef sts As UInt32) As Int16
        End Function

        ' 扩展模块类型定义
        Public Const IOMODULE_TYPE_IO64 As Int32 = 1       ' 32DI32DO模块（包括16DI16DO模块）
        Public Const IOMODULE_TYPE_IO32_DA As Int32 = 2       ' 4AD4DA模块

        ' 设置扩展IO模块有效(带模块类型)
        ' chDevId:设备ID
        ' chDevType:模块类型，见宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_IOModuleSetEn(devHandle As HAND, chDevId As Byte, chDevType As Int16) As Int16
        End Function

        ' 读取扩展IO模块类型
        ' chDevId:设备ID
        ' pChDevType:返回的模块类型，见宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_IOModuleGetType(devHandle As HAND, chDevId As Byte, ByRef pChDevType As Int16) As Int16
        End Function

        ' 设置伺服ON, 轴静止时执行，如果后面是update指令，需要延时一个周期
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetSvOn(axisHandle As HAND) As Int16
        End Function

        ' 设置伺服OFF, 轴静止时执行，如果后面是update指令，需要延时一个周期
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetSvOff(axisHandle As HAND) As Int16
        End Function

        ' 设置伺服报警清除
        ' swt: 设置开关有效状态。1, 有效（输出低电平），0，无效（输出高电平）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetSvClr(axisHandle As HAND, swt As Int16) As Int16
        End Function

        ' 设置DAC（模拟量输出）通道的模式
        ' ch:模拟量通道号,取值范围[0,n]
        ' mode:模拟量输出范围,0:0~5V, 1:0~10V, 2: 0~10.8V, 3:+/-5V, 4:+/-10V, 5:+/-10.8V,其他无效，默认为4
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDacMode(devHandle As HAND, ch As Int16, mode As Int16) As Int16
        End Function

        ' 读取DAC（模拟量输出）通道的模式
        ' ch:模拟量通道号,取值范围[0,n]
        ' pMode:返回的模拟量输出范围设定值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDacMode(devHandle As HAND, ch As Int16, ByRef pMode As Int16) As Int16
        End Function

        ' 设置Adc参数
        ' ch:模拟量通道号,0~7表示轴通道上的AD，256：表示扩展AD
        ' mode:模拟量范围,0:0~5V, 1:0~10V, 2: 0~10.8V, 3:+/-5V, 4:+/-10V, 5:+/-10.8V,默认为4
        ' 注意：目前只支持+/-10V
        ' filterCoe:滤波系数，取值范围[0,64],0表示取消Adc滤波，单位:ms，默认值为0
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetAdcMode(devHandle As HAND, ch As Int16, range As Int16, filterCoe As Int16) As Int16
        End Function

        ' 读取Adc参数
        ' ch:模拟量通道号,0~7表示轴通道上的AD，256：表示扩展AD
        ' pMode:模拟量范围
        ' pFilterCoe:滤波系数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetAdcMode(devHandle As HAND, ch As Int16, ByRef pRange As Int16, ByRef pFilterCoe As Int16) As Int16
        End Function

        ' 设置DAC（模拟量输出）输出值
        ' ch:模拟量通道号,取值范围[0,n]
        ' dacValue:模拟量输出值,取值范围[-32768,32767],对应DAC输出范围
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDac(devHandle As HAND, ch As Int16, dacValue As Int16) As Int16
        End Function

        ' 读取DAC（模拟量输出）输出值
        ' ch:模拟量通道号,取值范围[0,n]
        ' pDacValue:返回模拟量输出值,取值范围[-32768,32767],对应DAC输出范围
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDac(devHandle As HAND, ch As Int16, ByRef pDacValue As Int16) As Int16
        End Function

        ' 读取ADC（模拟量输入）值
        ' ch:模拟量通道号,取值范围[0,n]
        ' pAdcValue:返回模拟量输入值，取值范围[-32768,32767],对应Adc输入电压范围
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetAdc(devHandle As HAND, ch As Int16, ByRef pAdcValue As Int16) As Int16
        End Function

        ' DIO映射
        Public Const DIO_MAP_MAX_NUM As Int32 = 8   ' 最多允许的映射关系

        ' 信号类型定义
        Public Const DIO_TYPE_GPI As Int32 = 1   ' 通用输入
        Public Const DIO_TYPE_HOME As Int32 = 2   ' 轴Home信号
        Public Const DIO_TYPE_ALM As Int32 = 3   ' 驱动器报警信号
        Public Const DIO_TYPE_LMTN As Int32 = 4   ' 轴负向限位信号
        Public Const DIO_TYPE_LMTP As Int32 = 5   ' 轴正向限位信号
        Public Const DIO_TYPE_GPO As Int32 = 6   ' 通用输出信号
        Public Const DIO_TYPE_SVON As Int32 = 7   ' 伺服使能信号
        Public Const DIO_TYPE_SVCLR As Int32 = 8   ' 报警清除信号


        ' DIo映射参数配置
        Public Structure TDioMappingCfg
            Public enable As Byte      ' 1：启用，0：禁用
            Public pinGrp As Byte      ' 映射的信号类型
            Public pinIndex As Byte     ' 映射的信号序号
            Public outEnable As Byte    ' 输出允许       
            Public newGrp As Byte      ' 映射到的信号类型
            Public newIndex As Byte    ' 映射到的信号序号
        End Structure

        ' 增加一组映射，映射关系目前最多存在DIO_MAP_MAX_NUM组
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDioMapping(devHandle As HAND, ByRef pDioCfg As TDioMappingCfg) As Int16
        End Function

        ' 获取所有的DIO映射数据
        ' pDioCfg：映射数据数组,目前为DIO_MAP_MAX_NUM组
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetAllDioMapping(devHandle As HAND, ByRef pDioCfg As TDioMappingCfg) As Int16
        End Function

        ' 清除所有的DIO映射关系
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_ClrAllDioMapping(devHandle As HAND) As Int16
        End Function

        '----------------------------------------------------------
        '	8.手脉功能
        '----------------------------------------------------------
        ' 退出手轮
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_ClrHandWheel(devHandle As HAND) As Int16
        End Function

        ' 启动手轮
        ' axis:轴号,取值范围[0,n]
        ' ratio:跟随倍率,取值范围(0,..],数值越大,则同样的输入,跟随轴运动距离越长
        ' acc:跟随的加速度
        ' vel:跟随的速度
        ' 注：编码器信号源为控制器上手脉端口
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetHandWheel(devHandle As HAND, axis As Int16, ratio As Double, acc As Double, vel As Double) As Int16
        End Function

        ' 选择手轮跟随的编码器通道
        ' index:编码器通道编号,如果是轴通道,取值范围[0,n]
        '                    如果是扩展编码器通道,则256表示第一个扩展编码器通道,257表示第二个,以此类推
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetHandWheelInput(devHandle As HAND, index As Int16) As Int16
        End Function

        ' 设置手轮跟随的倍率
        ' ratio:跟随倍率,取值范围(0,..]
        ' 选择手轮跟随的编码器通道
        ' index:编码器通道编号,如果是轴通道,取值范围[0,n]
        '                    如果是扩展编码器通道,则256表示第一个扩展编码器通道,257表示第二个,以此类推
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetHandWheelRatio(devHandle As HAND, ratio As Double) As Int16
        End Function

        '----------------------------------------------------------
        '	9.龙门功能
        '----------------------------------------------------------

        ' 设置龙门主动轴
        ' axisHandle: 龙门主动轴句柄
        ' group     : 龙门组号,取值范围[0,n]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetGantryMaster(axisHandle As HAND, group As Int16) As Int16
        End Function

        ' 设置龙门从动轴
        ' axisHandle  : 龙门从动轴句柄;
        ' group       : 龙门组号,取值范围[0,n]
        ' gantryErrLmt: 龙门保护误差,取值范围(0,...)
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetGantrySlave(axisHandle As HAND, group As Int16, gantryErrLmt As Int32) As Int16
        End Function

        ' 龙门功能关闭
        ' group :       龙门组号,取值范围[0,n]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_DelGantryGroup(axisHandle As HAND, group As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	10.位置比较输出
        '----------------------------------------------------------

        '----------------------------------------------------------
        '	10.1 多维位置比较输出（软件比较）
        '----------------------------------------------------------
        Public Const CMP_OUTPUT_CHN_MAX As Int32 = (3)

        ' X维位置点比较结构体
        Public Structure TCompXDimensParam
            Public dimens As Int16                          ' 维度
            Public axMask As Int16                           ' 使用的轴,按位
            Public src As Int16                                 ' 轴位置类型 ：0规划1：编码器

            Public outCnts As Int16                             ' 输出数量
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=CMP_OUTPUT_CHN_MAX)>
            Public outType As Int16()         ' 输出方式0：脉冲1：电平
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=CMP_OUTPUT_CHN_MAX)>
            Public outChnType As Int16()  ' 通道类型：0 GPO, 1  GATE通道
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=CMP_OUTPUT_CHN_MAX)>
            Public outIndex As Int16()     ' GPO：0~63  GATE：0
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=CMP_OUTPUT_CHN_MAX)>
            Public outStLevel As Int16()   ' 电平模式下的起始电平（0或1）
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=CMP_OUTPUT_CHN_MAX)>
            Public outGateTime As Int16()     ' 脉冲模式下的脉冲时间:单位ms
            Public errZone As Int16                             ' 进入比较点容差半径范围（pulse）
        End Structure

        ' 功能：设置X维位置比较的参数
        ' param: X维比较参数
        ' ch:组号,0~2
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompXDimensSetParam(devHandle As HAND, ByRef param As TCompXDimensParam, chn As Int16) As Int16
        End Function

        ' 功能：获取X维位置比较的参数
        ' param: 二维比较参数
        ' chn:组号
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompXDimensGetParam(devHandle As HAND, ByRef param As TCompXDimensParam, chn As Int16) As Int16
        End Function

        ' 功能：设置X维位置比较的输出模式
        ' outMode: 输出模式 0：同时输出模式 1： 轮循输出模式
        ' ch:组号,0~N
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompXDimensSetCmpOutMode(devHandle As HAND, outMode As Int16, chn As Int16) As Int16
        End Function

        ' 功能：设置X维比较数据
        ' pArrayPos:比较数组地址,注：若是1维比较,则pPosArray传入一维数组地址,若是2维比较,则pPosArray应传入2维数组地址
        ' outValue
        ' count:位置点数,注：若为2维数组比较时,每两个数据为一个点数
        ' ch:组号,0~N
        ' 注：按结构体定义的IO,同时输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompXDimensSetData(devHandle As HAND, ByRef pPosArray As Int32, count As Int16, chn As Int16) As Int16
        End Function

        ' 功能：X维位置比较使能
        ' onOff： 0 停止,1输出
        ' chn： 组号
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompXDimensOnoff(devHandle As HAND, onOff As Int16, chn As Int16) As Int16
        End Function

        ' 功能：X维位置比较的输出状态
        ' pStatus: 0 未启动比较 1 比较输出中
        ' pOutCount：输出的个数
        ' chn：组号
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompXDimensStatus(devHandle As HAND, ByRef pStatus As Int16, ByRef pOutCount As Int16, chn As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	10.2 一维高速位置比较（硬件比较）
        '----------------------------------------------------------
        Public Const CMP_HS1DIMENS_CHN_MAX As Int32 = (4)         ' 最大支持四个通道
        Public Const CMP_HS1DIMENS_POS_MAX As Int32 = (8)         ' 每个通道最多支持8个位置点

        ' 一维高速位置比较参数结构
        Public Structure TCompHs1DimensParam
            Public dirNo As Int16            ' 编码器源（0~7），对应轴0~7的编码器。
            Public out1StLevel As Int16      ' out1起始电平（0或1）
            Public out2StLevel As Int16      ' out2起始电平（0或1）
            Public reserved As Int16         ' 保留
            Public out1Width As Int32         ' out1脉冲宽度，0~65535,单位us
            Public out2Width As Int32         ' out2脉冲宽度，0~65535,单位us
            Public out2Delay As Int32        ' out2延时，0~65535,单位us
        End Structure

        ' 功能：设置高速1维位置比较的参数（比较编码器）
        ' param: 一维比较参数
        ' chn：通道号,范围0~3
        ' 注：1)需要先设置编码器模式，可设置外部编码器或内部计数。
        '???? 2)比较输出引脚位置请参考硬件手册。
        '???? 3)out1比较位置到后马上输出, out2到位后延时输出。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompHs1DimensSetParam(devHandle As HAND, ByRef param As TCompHs1DimensParam, chn As Int16) As Int16
        End Function

        ' 功能：读取高速1维位置比较的参数
        ' param, chn：同上
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompHs1DimensGetParam(devHandle As HAND, ByRef param As TCompHs1DimensParam, chn As Int16) As Int16
        End Function

        ' 功能：设置高速1维比较数据
        ' pArrayPos:比较数组地址
        ' count:位置点数
        ' chn: 同上
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompHs1DimensSetData(devHandle As HAND, ByRef pArrayPos As Int32, count As Int16, chn As Int16) As Int16
        End Function

        ' 功能：高速1维位置比较使能
        ' onOff： 0:停止,1:输出,2:手动输出（必须在空闲状态下,也需要提前设置参数）
        ' chn: 同上
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompHs1DimensOnOff(devHandle As HAND, onOff As Int16, chn As Int16) As Int16
        End Function

        ' 功能：高速1维位置比较的状态
        ' pBusy: 0 未启动比较 1 比较输出中
        ' pOutCount：输出的个数
        ' pWaitCnts：等待比较的个数
        ' pFreeCnts：缓冲区空闲的个数
        ' chn: 同上
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CompHs1DimensStatus(devHandle As HAND, ByRef pBusy As Int16, ByRef pOutCount As Int16, ByRef pWaitCnts As Int16, ByRef pFreeCnts As Int16, chn As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	11.激光功能
        '----------------------------------------------------------

        '----------------------------------------------------------
        '	11.1 激光模式设置
        '----------------------------------------------------------
        Public Const MAX_LASER_NUMS As Int32 = (2)     ' 最大激光通道

        ' 激光控制模式
        Public Const LASER_DISABLE_MODE As Int32 = (0)     ' 禁用激光功能
        Public Const BASIC_OUTPUT_MODE As Int32 = (1)     ' 基本控制模式
        Public Const TIME_ARRAY_OUTPUT_MODE As Int32 = (2)     ' 波形控制模式
        Public Const SHIO_OUTPUT_MODE As Int32 = (3)     ' 位置比较控制模式

        '设置激光控制的模式。该模式的设定,约束相应指令的功能和操作
        'mode: 激光控制模式,参考上述宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserSetMode(devHandle As HAND, mode As Int16, ch As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	11.2 基本控制模式
        '----------------------------------------------------------
        ' 激光物理信号输出类型配置(高精度)
        ' outputType：输出的类型
        ' index :输出通道序号,取值范围[0,n]
        ' optionVal: 当作为占空比输出时,该值为PWM的频率,单位HZ；
        '            当为LASER_PWM_FRQ时,该值作为占空比值,单位为百分比；
        '            当为LASER_PWM_FRQ_EXT时,该值为脉宽,单位为微秒,取值范围(0,~)
        ' ch :激光通道,取值范围[0,n]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserSetOutputTypeEx(devHandle As HAND, outputType As Int16, index As Int16, optionVal As Double, ch As Int16) As Int16
        End Function

        ' 功能：设置立即输出激光的能量(高精度)
        ' chn：输出通道 (需要根据不同物理信号端口数量进行设定)
        ' outVal: 激光能量（设定值意义与NMC_LaserSetOutputTypeEx设置的输出类型对应）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserSetPowerEx(devHandle As HAND, outVal As Double, ch As Int16) As Int16
        End Function

        ' 功能：读取当前激光的能量 
        ' pVal: 激光能量值
        ' ch：通道号
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserGetPower(devHandle As HAND, ByRef pVal As Double, ch As Int16) As Int16
        End Function

        ' 设置激光参数
        ' onDelay:开光延时,单位us,取值范围[0,65535]
        ' offDelay:关光延时,单位us,取值范围[0,65535]
        ' minValue:最小输出值,取值范围[0,32767]
        ' maxValue:最大输出值,取值范围[0,32767]
        ' standbyPower:待机能量,为0表示取消待机能量输出功能
        ' ch:激光控制通道
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserSetParam(devHandle As HAND, onDelay As Int32, offDelay As Int32, minValue As Int32, maxValue As Int32, standbyPower As Int32, ch As Int16) As Int16
        End Function

        ' 读取激光参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserGetParam(devHandle As HAND, ByRef onDelay As Int32, ByRef offDelay As Int32, ByRef minValue As Int32, ByRef maxValue As Int32, ByRef standbyPower As Int32, ch As Int16) As Int16
        End Function

        ' 缓冲区设置激光参数
        ' onDelay:开光延时,单位us,取值范围[0,65535]
        ' offDelay:关光延时,单位us,取值范围[0,65535]
        ' minValue:最小输出值，DA输出时，范围[0,32767],占空比输出时，范围[0,100],频率输出时，范围[0,2000000]
        ' maxValue:最大输出值，DA输出时，范围[0,32767],占空比输出时，范围[0,100],频率输出时，范围[0,2000000]
        ' standbyPower:待机能量,为0表示取消待机能量输出功能
        ' ch:激光控制通道
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufLaserSetParam(crdHandle As HAND, segment As Int32, onDelay As Int32, offDelay As Int32, minValue As Int32, maxValue As Int32, standbyPower As Int32, ch As Int16) As Int16
        End Function

        ' 设置缓冲区激光能量跟随
        ' segNo:段号
        ' overRide:跟随倍率,为0表示取消激光能量跟随
        ' followType:跟随类型,0：跟随规划速度,1：跟随实际速度
        ' ch:激光通道号,取值范围[0,n]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufLaserSetFollow(crdHandle As HAND, segNo As Int32, overRide As Double, followType As Int16, ch As Int16) As Int16
        End Function

        ' 设置激光能量跟随滤波系数
        ' powerFilter:能量输出滤波系数，取值范围[0,32]，0：不开启（默认）
        ' followAdvMode:能量输出计算方法
        ' ch:激光通道号,取值范围[0,n]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserSetFollowParam(devHandle As HAND, powerFilter As Int16, followAdvMode As Int16, ch As Int16) As Int16
        End Function

        ' 激光能量补偿数据表单方向长度最大值
        Public Const LASER_CMP_DATA_LEN_MAX As Int32 = (10)

        ' 设置激光能量补偿表
        ' tableNo： 补偿表号 ：支持20张表
        ' pXCmpPos：X方向轴的比较位置,长度为xCount  
        ' pYCmpPos: Y方向轴的比较位置,长度为yCount  
        ' xCount： 表X方向的长度,取值范围[2,10]
        ' yCount： 表Y方向的长度,取值范围[2,10]
        ' powerMin:	大于该最小能量才补偿
        ' powerMax:	小于该最大能量才补偿
        ' pLaserCmpPower：补偿表的值，该参数为2维数组的首地址
        ' chn:对应的激光通道号
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetLaserPowerCmpTable(devHandle As HAND, tableNo As Int16, ByRef pXCmpPos As Int32, ByRef pYCmpPos As Int32, xCount As Int16, yCount As Int16, powerMin As UInt32, powerMax As UInt32, ByRef pLaserCmpPower As UInt32, chn As Int16) As Int16
        End Function

        ' 启动激光能量补偿
        ' pAxisNo： pAxisNo[0]表X方向的位置比较轴号 pAxisNo[1]表Y方向的位置比较轴号
        ' chn：补偿输出给哪路激光通道
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_StartLaserPowerComp(devHandle As HAND, ByRef pAxisNo As Int16, ch As Int16) As Int16
        End Function

        ' 停止激光能量补偿
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_StopLaserPowerComp(devHandle As HAND, ch As Int16) As Int16
        End Function

        ' 功能：激光立即输出开关 
        ' onOffl: 0或者1表示打开或关闭激光输出
        ' ch：输出通道 (需要根据不同物理信号端口数量进行设定)
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserOnOff(devHandle As HAND, onOff As Int16, ch As Int16) As Int16
        End Function

        ' 功能：读取当前激光开关状态 
        ' pOnOffState: 激光开关状态，1：激光处于打开状态，0:激光处于关闭状态
        ' ch：通道号
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserGetOnOff(devHandle As HAND, ByRef pOnOffState As Int16, ch As Int16) As Int16
        End Function

        ' 缓冲区激光开关
        ' segNo:段号
        ' onOff:开关,0：关光,1：开光
        ' ch:激光控制通道
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufLaserOnOff(crdHandle As HAND, segNo As Int32, onOff As Int16, ch As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	11.3 波形控制模式
        '----------------------------------------------------------
        ' 缓冲区设置激光能量,激光能量跟随模式下,调用这条指令无效
        ' segNo:段号
        ' power:能量
        ' ch:激光控制通道
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufLaserPower(crdHandle As HAND, segNo As Int32, power As Int32, ch As Int16) As Int16
        End Function

        Public Const LASER_GROUP As Int32 = (12)            ' 最大激光能量组数
        Public Const LASET_POINT As Int32 = (40)            ' 每组最大点数

        Public Structure TTimeArrayPara
            Public pwmEnable As Int16       ' 是否需要输出PWM,0:立即输出一个波形，1：根据位移周期输出
            Public outputType As Int16      ' 开关信号输出类型：0：gate,1：GPO
            Public outputCh As Int16            ' 开关信号输出通道
            Public stLevelRevs As Int16     ' SHIO输出电平取反,默认为0，不取反
            Public pwmPeriod As Int32           ' 保留,PWM周期,单位us,不能小于时间数组的总周期
            Public pwmWidth As Int32            ' 保留,PWM脉宽,单位us,此参数保留,脉宽等于时间数组的总周期
            Public gateDistance As Int32        ' 固定模式下的位置间隔 单位：pulse。
            '                                     默认0,模式2~4 下会进行有效性检查
            Public minFrqFrq As Int32       ' 保留,SHIO输出最低频率，单位HZ
            Public posSrc As Int16          ' 比较模式,外部编码器还是内部规划值。
            '                                 0：外部编码器（推荐）,1：内部规划值。
            '                                 默认0。
            Public axisMask As Int16        ' 轴号,按bit 位对应。（一般两个轴）。
            '                                  默认 0。
            Public minFrqEn As Int16            ' 保留,是否启用SHIO输出最低频率，默认0，不启用
            Public reserved2 As Int16       ' 保留
        End Structure

        ' 设置时间数组输出参数
        ' ch : 激光通道
        ' pPara ： 参数
        ' 注：1.仅时间数组输出方式下有效
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserSetTimeArrayPara(devHandle As HAND, ByRef pPara As TTimeArrayPara, ch As Int16) As Int16
        End Function

        Public Structure TLaserPower
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=LASET_POINT)>
            Public time As UInt16() ' 每个点之间的间隔时间,单位微秒
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=LASET_POINT)>
            Public power As Int16()      ' 各点的能量大小
            Public count As Int16                   ' 实际压入点数
        End Structure

        ' 设置激光的能量,对于立即输出模式,group无效,pLaserPower为指定的单个能量信息
        ' group : 设置哪一组激光能量
        ' pLaserPower ： 设置的数据
        ' 注：1.即波形设置 
        '     2.该接口对于SHIO模式无效
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserSetTimeArrayPower(devHandle As HAND, group As Int16, ByRef pLaserPower As TLaserPower) As Int16
        End Function

        ' 执行时间序列激光,只在时间序列输出模式下有效
        ' group : 设置哪一组激光能量
        ' ch:激光通道
        ' 注：1.启用时间数组输出后,直到最后一个点,如果最后一个点能量不为0,则维持最后一个能量输出
        '    2.如果最后一个点能量为0,且没有PWM输出配合,则自动关闭激光。有PWM配合则需要调用NMC_LaserOnOff或者NMC_CrdBufLaserOnOff关闭激光
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_LaserTimeArrayExe(devHandle As HAND, group As Int16, ch As Int16) As Int16
        End Function

        ' 缓冲区执行时间序列激光,只在时间序列输出模式下有效
        ' segNo:段号
        ' group:设置哪一组激光能量
        ' ch:激光控制通道
        ' 注：1.启用时间数组输出后,直到最后一个点,如果最后一个点能量不为0,则维持最后一个能量输出
        '    2.如果最后一个点能量为0,且没有PWM输出配合,则自动关闭激光。有PWM配合则需要调用NMC_LaserOnOff或者NMC_CrdBufLaserOnOff关闭激光
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufLaserTimeArrayExe(crdHandle As HAND, segNo As Int32, group As Int16, ch As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	11.4 位置比较控制模式
        '----------------------------------------------------------
        Public Structure TSHIOPara
            Public isArray As Int16         ' 是否固定间距还是数组。0：固定间距（仅支持）,默认0
            Public outMode As Int16         ' 输出模式。默认1
            ' 1：只输出gate 立即开或关,
            ' 2: 根据位移输出gate
            ' 3: 根据位移输出gate,gate 和同部trigger 信号同步
            ' 4: 根据位移输出gate,gate 和信号输入同步
            Public posSrc As Int16      ' 比较模式,外部编码器还是内部规划值。
            ' 0：外部编码器（推荐）,1：内部规划值。
            ' 默认0。
            Public axisMask As Int16    ' 轴号,按bit 位对应。（一般两个轴）。
            ' 默认 0。
            Public delay As Double      ' 延时开关光时间( 暂不用 ),单位：s。默认 0。
            Public gateTime As Double   ' 设置gate 打开时间,单位：s（内部最小值：1/36us ）,取值范围(0,0.0009)
            ' 默认0。
            Public gateDistance As Int32    ' 固定模式下的位置间隔 单位：pulse。
            ' 默认0,模式2~4 下会进行有效性检查。
            Public reserved1 As Int32       ' 保留参数,应设为0。
            Public reserved2 As Int32   ' 保留参数,应设为0。
            Public reserved3 As Int32   ' 保留参数,应设为0。
            Public reserved4 As Int32   ' 保留参数,应设为0。
            Public reserved5 As Int32   ' 保留参数,应设为0。
        End Structure

        ' 配置SHIO功能的参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIOConfigPara(devHandle As HAND, ByRef pSHIOPara As TSHIOPara, ch As Int16) As Int16
        End Function

        ' 缓冲区配置SHIO功能的参数
        ' delay:延时开关光时间( 暂不用 ),单位：s。默认 0。
        ' gateTime:设置gate 打开时间,单位：s（内部最小值：1/36us ）,取值范围(0,0.0009),默认0。
        ' gateDistance:固定模式下的位置间隔 单位：pulse。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufSHIOSetParam(crdHandle As HAND, segment As Int32, delay As Double, gateTime As Double, gateDistance As Double, ch As Int16) As Int16
        End Function

        ' SHIO输出的最小频率功能开
        ' minFrq:最低频率，单位HZ
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIOEnableMinFrq(devHandle As HAND, minFrq As Int32, ch As Int16) As Int16
        End Function

        ' SHIO输出的最小频率功能关闭
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIODisableMinFrq(devHandle As HAND, ch As Int16) As Int16
        End Function

        ' 缓冲区SHIO输出的最小频率功能开
        ' minFrq:最低频率，单位HZ
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufSHIOSetMinFrq(crdHandle As HAND, segment As Int32, minFrq As Int32, ch As Int16) As Int16
        End Function

        ' 缓冲区SHIO输出的最小频率功能关闭
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufSHIOClrMinFrq(crdHandle As HAND, segment As Int32, ch As Int16) As Int16
        End Function

        ' 切换轴（允许和坐标系不完全一致）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIOChangeAxisMask(devHandle As HAND, axisMask As Int16, ch As Int16) As Int16
        End Function

        ' 切换轴（允许和坐标系不完全一致）,缓冲区指令
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufSHIOChangeAxisMask(crdHandle As HAND, segment As Int32, axisMask As Int16, ch As Int16) As Int16
        End Function

        ' 允许GATE输出
        ' 注：设置后根据模式输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIOGateOn(devHandle As HAND, ch As Int16) As Int16
        End Function

        ' 禁止GATE输出
        ' 注：设置后立即禁止输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIOGateOff(devHandle As HAND, ch As Int16) As Int16
        End Function

        ' 设置Trigger 输出,
        ' triggerFreq : 设置triger 脉冲频率单位：HZ。
        ' triggerWidth : 设置triger 脉冲宽度,单位：s（内部最小值：1/36us ）。默认0。
        ' 注：设置后立即输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIOTriggerOn(devHandle As HAND, freq As Double, width As Double, ch As Int16) As Int16
        End Function

        ' 禁止Trigger输出
        ' 注：设置后马上输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIOTriggerOff(devHandle As HAND, ch As Int16) As Int16
        End Function

        ' 缓冲区允许GATE输出
        ' 注：设置后根据模式输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_BufSHIOGateOn(crdHandle As HAND, segNo As Int32, ch As Int16) As Int16
        End Function

        '缓冲区禁止GATE输出
        '注：缓冲区执行到该指令后立即禁止输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_BufSHIOGateOff(crdHandle As HAND, segNo As Int32, ch As Int16) As Int16
        End Function

        ' PWM映射到GATE引脚输出
        ' pwmCh:pwm 通道号
        ' gateCh:gate信号通道号
        ' onOff: 0 -- 不映射，1 -- 映射 （默认为0）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetPwmToGate(devHandle As HAND, pwmCh As Int16, gateCh As Int16, onOff As Int16) As Int16
        End Function

        ' 缓冲区SHIO点动出光，输出一段gate脉冲,注意：必须在激光SHIO控制模式下使用
        ' gateTime:gate输出的脉宽，单位：微秒
        ' gateFrq:gate输出的频率，单位：HZ
        ' outCount:输出个数
        ' ch:通道
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdBufSHIOGatePulse(crdHandle As HAND, segNo As Int32, gateTime As Double, gateFrq As Double, outCount As Int32, ch As Int16) As Int16
        End Function

        ' SHIO点动出光，输出一段gate脉冲,注意：必须在激光SHIO控制模式下使用
        ' gateTime:gate输出的脉宽，单位：微秒
        ' gateFrq:gate输出的频率，单位：HZ
        ' outCount:输出个数
        ' ch:通道
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SHIOGatePulse(devHandle As HAND, gateTime As Double, gateFrq As Double, outCount As Int32, ch As Int16) As Int16
        End Function

        ' 输出一段PWM脉冲,注意：必须在激光SHIO控制模式下使用
        ' onTime:PWM输出的脉宽，单位：微秒
        ' pwmFrq:PWM输出的频率，单位：HZ
        ' outCount:输出个数
        ' ch:通道
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_PwmPulseOut(devHandle As HAND, onTime As Double, pwmFrq As Double, outCount As Int32, ch As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	12.PT运动
        '----------------------------------------------------------
        ' onOff:		1：数据驻存模式   0：数据刷新模式(默认模式)
        ' loopCount:	循环次数 ：仅数据驻存模式下有效
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtPtSetStatic(axisHandle As HAND, onOff As Int16, loopCount As Int32) As Int16
        End Function

        ' onOff:		1：数据驻存模式   0：数据刷新模式(默认模式)
        ' loopCount:	循环次数 ：仅数据驻存模式下有效
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtPtGetStatic(axisHandle As HAND, ByRef pOnOff As Int16, ByRef pLoopCount As Int32) As Int16
        End Function

        ' 查询PT数据剩余空间大小
        ' pSpace:返回的剩余空间大小
        ' pUsed: 已使用的空间段数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtPtGetSpace(axisHandle As HAND, ByRef pSpace As Int16, ByRef pUsed As Int16) As Int16
        End Function

        ' PT数据段类型
        Public Const MT_PT_NORMAL As Int32 = (0)
        Public Const MT_PT_STOP As Int32 = (1)
        Public Const MT_PT_EVEN As Int32 = (2)

        ' 向Pt运动缓存区中压运动数据段
        ' count:压入的数据段数
        ' pPosArray:段运行距离
        ' pTimeArray:段运行时间
        ' pTypeArray:段类型,见宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtPtPush(axisHandle As HAND, count As Int16, ByRef pPosArray As Double, ByRef pTimeArray As Int32, ByRef pTypeArray As Int16) As Int16
        End Function

        ' 清空PT数据
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtPtBufClr(axisHandle As HAND) As Int16
        End Function

        ' 启动Pt运动
        ' otherSynAxCnts： 不包括axisHandle 的其他同步启动轴数量
        ' pOtherSynAxArray: 其他同步启动轴的序号：0~N	
        ' 注：同步的轴必须属于同一个控制器
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtPtStartMtn(axisHandle As HAND, otherSynAxCnts As Int16, ByRef pOtherSynAxArray As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	13.闭环控制
        '----------------------------------------------------------
        ' PID参数
        Public Structure TPidPara
            Public kp As Single                                         ' 增益系数
            Public ki As Single                                         ' 积分系数
            Public kd As Single                                         ' 微分系数
            Public kvff As Single                                       ' 速度前馈系数
            Public integralLimit As Int32                                ' 积分饱和极限
            Public derivativeLimit As Int32                               ' 微分饱和极限
            Public outLimit As Int16                                     ' 输出饱和极限
        End Structure

        ' Dac参数
        Public Structure TDacMotor
            Public inverse As Int16         ' 电压是否取反
            Public bias As Int16                ' Dac零漂
            Public dacLmt As Int16          ' Dac输出极限值
        End Structure

        ' 设置单轴闭环控制的DA参数,轴与DA通道的对应
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetCloseLoopDac(axisHandle As HAND, ByRef pDacPara As TDacMotor) As Int16
        End Function

        ' 获取单轴闭环控制的DA参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetCloseLoopDac(axisHandle As HAND, ByRef pDacPara As TDacMotor) As Int16
        End Function

        ' 设置单轴的控制模式：默认使用对应轴的编码器作为输入反馈,对应序号的DAC作为输出
        ' 闭环模式下,先调用NMC_SetCloseLoopDac指令
        'mode: 0 脉冲控制  1 DA闭环控制，默认为脉冲控制
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetCtrlMode(axisHandle As HAND, mode As Int16) As Int16
        End Function

        ' 读取单轴的控制模式
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetCtrlMode(axisHandle As HAND, ByRef pMode As Int16) As Int16
        End Function

        '设置对应组号的PID参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetPIDPara(axisHandle As HAND, index As Int16, ByRef pidPara As TPidPara) As Int16
        End Function

        ' 获取对应组号的PID参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPIDPara(axisHandle As HAND, index As Int16, ByRef pidPara As TPidPara) As Int16
        End Function

        ' 设置使用哪组PID
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetPIDIndex(axisHandle As HAND, index As Int16) As Int16
        End Function

        ' 获取正使用的PID组号
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPIDIndex(axisHandle As HAND, ByRef pIndex As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	14 拓展资源及其他指令
        '----------------------------------------------------------

        '----------------------------------------------------------
        '	14.1 辅助编码器
        '----------------------------------------------------------
        ' 读编码器通道位置
        ' devHandle : 控制器句柄；encId: 编码器ID,取值范围[0,n]
        ' pos:返回编码器数值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetEncPos(devHandle As HAND, encId As Int16, ByRef pos As Int32) As Int16
        End Function

        ' 写编码器通道位置
        ' devHandle : 控制器句柄
        ' encId: 编码器ID,对于轴编码器通道,取值范围[0,n]
        '				  对于扩展编码器通道,256表示第一个扩展编码器通道,257表示第二个,以此类推
        ' encPos:编码器数值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetEncPos(devHandle As HAND, encId As Int16, encPos As Int32) As Int16
        End Function

        '----------------------------------------------------------
        '	14.2 捕获功能
        '----------------------------------------------------------
        ' 设置捕获有效电平
        ' mode : 模式选择，参考宏定义
        ' ioSrc：IO输入源选择，参考宏定义
        ' level: 触发沿。0为下降沿，1为上升沿
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetCaptSns(axisHandle As HAND, mode As Int16, ioSrc As Int16, level As Int16) As Int16
        End Function

        ' 读取捕获有效电平
        ' mode : 模式选择，参考宏定义
        ' ioSrc：IO输入源选择，参考宏定义
        ' level: 触发沿。0为下降沿，1为上升沿
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetCaptSns(axisHandle As HAND, ByRef mode As Int16, ByRef ioSrc As Int16, ByRef level As Int16) As Int16
        End Function

        ' 设置启动捕获
        ' 注：捕获触发标志在轴状态字里。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetCapt(axisHandle As HAND) As Int16
        End Function

        ' 清除轴的捕获状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtClrCaptSts(axisHandle As HAND) As Int16
        End Function


        ' 读捕获位置
        ' pos : 返回位置，单位:脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetCaptPos(axisHandle As HAND, ByRef pos As Int32) As Int16
        End Function

        ' 高级捕获通道数目
        Public Const CAPT_EX_CH_NUM As Int32 = 6   ' 

        ' 捕获源
        Public Const CAPT_EX_SRC_GPI As Int32 = 0   ' 通用输入
        Public Const CAPT_EX_SRC_NEGLMT As Int32 = 1   ' 负向限位
        Public Const CAPT_EX_SRC_POSLMT As Int32 = 2   ' 正向限位
        Public Const CAPT_EX_SRC_HOME As Int32 = 3   ' 原点
        Public Const CAPT_EX_SRC_Z As Int32 = 4   ' Z向信号
        Public Const CAPT_EX_SRC_PRFPOS As Int32 = 5   ' 规划位置（当规划位置达到设定值时触发）
        Public Const CAPT_EX_SRC_ENCPOS As Int32 = 6   ' 编码器位置

        Public Structure TAdvCaptureParam
            Public capPosIndex As Int16 ' 捕获的位置源序号,0~N：轴1~N+1。（默认0）注：捕获的编码器位置根据用户设置的编码器模式决定 

            Public trigSrc As Int16     ' 触发源,见上面的定义。（默认：CAPT_EX_SRC_GPI）
            Public trigIndex As Int16   ' 触发源序号。（默认0）
            Public filter As Int16      ' 滤波时间常数,单位0.1毫秒,取值范围[0,255]
            Public trigValue As Int32  ' 触发值,对于触发源为IO,表示信号触发的有效电平；对于触发源为位置,则表示触发捕获的位置。（默认0）
        End Structure

        ' 设置高级捕获参数,并启动捕获
        ' pParam:参数
        ' ch：高级捕获通道号,[0~3]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetAdvCaptParam(devHandle As HAND, ByRef pParam As TAdvCaptureParam, ch As Int16) As Int16
        End Function

        ' 清除高级捕获状态,并取消该通道的捕获
        ' ch：高级捕获通道号,[0~3]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtClrAdvCaptSts(devHandle As HAND, ch As Int16) As Int16
        End Function

        ' 读取高级捕获状态
        ' captSts:捕获状态,bit0表示设置的信号前沿触发到,bit1表示信号的后沿触发到。
        ' pPosArray : 返回位置,在触发到时,位置为捕获到的位置值。
        '				pPosArray[0]:信号前沿触发位置,pPosArray[1]:信号后沿触发位置,单位:脉冲
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetAdvCaptPos(devHandle As HAND, ByRef captSts As Int16, ByRef pPosArray As Int32, ch As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	14.3 位置系统操作
        '----------------------------------------------------------
        ' 单轴位置系统清零，规划以及编码器
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtZeroPos(axisHandle As HAND) As Int16
        End Function

        ' 设定实际位置, 轴静止时执行，如果后面是update指令，需要延时一个周期
        ' encPos: 设定实际位置值
        ' 注：只能在轴静止时使用。
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetAxisPos(axisHandle As HAND, encPos As Int32) As Int16
        End Function

        ' 设定编码器位置, 轴静止时执行,如果后面是update指令,需要延时一个周期
        ' encPos: 设定编码器位置值
        ' 注：只能在轴静止时使用
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetEncPos(axisHandle As HAND, encPos As Int32) As Int16
        End Function

        ' 设置单轴比例系数
        ' axisHandle : 轴句柄
        ' inCoe：单轴比例系数,取值范围(0,1]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetPrfCoe(axisHandle As HAND, inCoe As Double) As Int16
        End Function

        ' 读取单轴比例系数
        ' axisHandle : 轴句柄
        ' pInCoe：单轴比例系数,取值范围(0,1]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetPrfCoe(axisHandle As HAND, ByRef pInCoe As Double) As Int16
        End Function

        ' 设置轴通道编码器的系数,默认为1
        ' axisHandle : 轴句柄
        ' encCoe：单轴通道编码器比例系数,取值范围(0,1]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetEncCoe(axisHandle As HAND, encCoe As Double) As Int16
        End Function

        ' 读取轴通道编码器的系数
        ' axisHandle : 轴句柄
        ' pEncCoe：比例系数,取值范围(0,1]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetEncCoe(axisHandle As HAND, ByRef pEncCoe As Double) As Int16
        End Function

        ' 设置轴的到位误差参数
        ' axisHandle : 轴句柄
        ' arrivalBand: 到位误差,单位Pulse 取值大于0
        ' stableTime: 到位保持时间,单位 ms 取值大于0
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetAxisArrivalPara(axisHandle As HAND, arrivalBand As Int32, stableTime As Int32) As Int16
        End Function

        ' 获取轴的到位误差参数
        ' axisHandle : 轴句柄
        ' pArrivalBand:到位误差,单位Pulse 
        ' pStableTime：到位保持时间,单位 ms
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetAxisArrivalPara(axisHandle As HAND, ByRef pArrivalBand As Int32, ByRef pStableTime As Int32) As Int16
        End Function

        ' 设置单轴急停DI
        ' gpiIndex：通用输入序号,[0,]，设置为-1，则表示取消急停DI
        ' sense :触发电平,0：低电平,1：高电平
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetEstopDI(axisHandle As HAND, gpiIndex As Int16, sense As Int16) As Int16
        End Function

        ' 读取单轴急停DI
        ' gpiIndex：通用输入序号,[0,]
        ' sense :触发电平,0：低电平,1：高电平
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetEstopDI(axisHandle As HAND, ByRef gpiIndex As Int16, ByRef sense As Int16) As Int16
        End Function

        '----------------------------------------------------------
        '	14.4 螺距补偿和间隙补偿
        '----------------------------------------------------------
        ' 设置螺距误差补偿参数
        ' num：补偿的段数,取值范围[2,128]
        ' startPos：补偿起始位置，终止位置为 startPos + cmpLen
        ' cmpLen:补偿长度
        ' pCompPos:正向补偿值
        ' pCompNeg:负向补偿值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetLeadScrewCompPara(axisHandle As HAND, num As Int16, startPos As Int32, cmpLen As Int32, ByRef pCompPos As Int16, ByRef pCompNeg As Int16) As Int16
        End Function

        ' 使能或禁止螺距位置补偿
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtEnableLeadScrew(axisHandle As HAND, enable As Int16) As Int16
        End Function

        ' 设置反向间隙补偿
        ' compValue： 补偿量
        ' compDelta： 周期补偿量，比如补偿量为100，周期补偿量为10，则反向补偿会在10个规划周期完成100个脉冲的补偿
        ' compDir：	 补偿方向,0:正向补偿，1：负向补偿
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtSetBacklash(axisHandle As HAND, compValue As Int32, compDelta As Double, compDir As Int32) As Int16
        End Function

        ' 获取反向间隙补偿
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGetBacklash(axisHandle As HAND, ByRef pCompValue As Int32, ByRef pCompDelta As Double, ByRef pCompDir As Int32) As Int16
        End Function

        '----------------------------------------------------------
        '	14.5 控制器资源(参数、版本信息等)
        '----------------------------------------------------------
        ' 平台：控制器时间结构
        Public Structure TNMCTime
            Public year As Int16           ' 年,真实年份。取值范围[2000,2099]
            Public mon As Int16            ' 月,取值范围[1,12]
            Public day As Int16            ' 日,取值范围[1,31]
            Public hour As Int16           ' 时,取值范围[0,23]
            Public min As Int16            ' 分,取值范围[0,59]
            Public second As Int16        ' 秒,取值范围[0,59]
        End Structure
        ' 读时间
        ' pTime ：返回时间结构,参考 TNMCTime 结构定义
        ' 注：时间在出厂时根据实际时间设定,用户不可通过指令修改
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetTime(devHandle As HAND, ByRef pTime As TNMCTime) As Int16
        End Function


        ' 写时间
        ' pTime ：时间结构,参考 TNMCTime 结构定义
        ' pPassword : 控制器系统密码,长度最多为16个字节
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetTime(devHandle As HAND, ByRef pTime As TNMCTime, ByRef pPassword As Byte) As Int16
        End Function

        ' 读设备唯一序列号
        ' pUID ：返回设备唯一序列号,为四个Int32的数据
        ' example:unsigned long devID[4];
        '         NMC_GetUID(g_hDev,devID);
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetUID(devHandle As HAND, ByRef pUID As UInt32) As Int16
        End Function

        ' 写用户参数
        ' add ：参数区的偏移地址(字节地址)
        ' len : 写入长度,单位：byte
        ' pWrData ：要写入的数据；
        ' 注：1)写入的数据掉电不丢失。
        '     2)一次最多写256字节。参数区总长度为2048字节。
        '     3)此指令比其它指令操作时间会长,如果出现通讯错误（返回-1）,则需要将通过NMC_SetCommPara延长指令通讯时间
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_UserParaWr(devHandle As HAND, add As UInt32, len As UInt32, ByRef pWrData As String) As Int16
        End Function

        ' 读用户参数
        ' add ：参数区的偏移地址(字节地址)
        ' len : 写入长度,单位：byte
        ' pRdData ：要读取的数据存储
        ' 注：一次最多读256字节。参数区总长度为2048字节。（参考函数 ： NMC_UserParaWr）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_UserParaRd(devHandle As HAND, add As UInt32, len As UInt32, ByRef pWrData As String) As Int16
        End Function

        ' 设置通讯参数
        ' devHandle : 设备句柄
        ' waitTimeInUs：等待时间，微秒
        ' retryTimes： 通讯重试次数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetCommPara(devHandle As HAND, waitTimeInUs As UInt32, retryTimes As UInt32) As Int16
        End Function

        ' 修改板卡ID号
        ' idStr: 要写入的板卡ID字符串，最长16字节，以\0结尾
        ' 注：修改ID号完成后，板卡要掉电重启，新的ID才有效。

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_DevWriteID(devHandle As HAND, ByRef idStr As Byte) As Int16
        End Function

        ' 读取板卡ID号
        ' idStr: 存储字符串的数组，数组长度大于16字节

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_DevReadID(devHandle As HAND, idStr As StringBuilder) As Int16
        End Function

        ' 读取库的版本
        ' pVersion：接收版本信息
        ' example(c):
        '          char dllVersion[128];
        '          NMC_GetDllVersion(dllVersion);

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDllVersion(ByRef pVersion As String) As Int16
        End Function

        ' 读取当前运动控制器固件的版本等信息
        ' devHandle : 设备句柄
        ' pVersion：版本信息

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetMtLibVersion(devHandle As HAND, ByRef pVersion As TMtLibVersion) As Int16
        End Function

        Public Structure TCardInfo
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)>
            Public strVer As String()          ' 控制器版本号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)>
            Public strOemVer As String()        ' OEM版本号(定制控制器才有),默认为0
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)>
            Public time As Int16()          ' 时间,年月日,时分秒
            Public axisNum As Int16          ' 支持的轴数
            Public encNum As Int16           ' 支持的编码器数
            Public diNum As Int16            ' 数字输入数量
            Public doNum As Int16            ' 数字输出数量
            Public daNum As Int16            ' 模拟量通道
            Public adNum As Int16            ' 模拟量输入通道
            Public shioNum As Int16          ' 同步高速IO通道
            Public reserved As Int16         ' 保留
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public ipv4 As String()           ' IP地址
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)>
            Public idStr As String()         ' 板卡名称,多卡时可用名称打开参考NMC_DevOpenByID
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)>
            Public uid As UInt32()   ' 唯一序列号
        End Structure
        ' 读取当前运动控制器信息
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetCardInfo(devHandle As HAND, ByRef pInfo As TCardInfo) As Int16
        End Function

        ''' <summary>
        ''' 启动库调试
        ''' </summary>
        ''' <param name="enable">调试模式：0--关闭调试，默认状态；1--打印到文件；2--输出到GCS</param>
        ''' <param name="debugOutputFile">enable为1时表示输出文件名</param>
        ''' <returns></returns>
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetCmdDebug(enable As Short, debugOutputFile As String) As Int16
        End Function

        ' 获取错误代码信息
        ' errCode:错误代码
        ' errDesc:返回的错误代码描述
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetErrDesc(errCode As Short, errDesc As String) As Int16
        End Function

        ' 保存为配置文件
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SaveConfigToFile(devHandle As HAND, pFilePath As String) As Int16
        End Function

        ' 掉电保存：备份数据定义
        Public Structure TBackGroup1
            Public crdSegNo As Int32()       ' 坐标系运动的段号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public crdPrfPos As Int32()    ' 坐标系运动的规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public axPrfPos As Int32()     ' 规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public axisPos As Int32()      ' 机械位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)>
            Public encPos As Int32()       ' 编码器位置
        End Structure
        ' 读取当前备份的变量数值（断电自动保存）
        ' pBackVar : 备份的变量值,参考结构体定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetBackedVarGroup1(devHandle As HAND, ByRef pBackVar As TBackGroup1) As Int16
        End Function

        ' 掉电保存：备份数据定义（12轴）
        Public Structure TBackGroup2
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdSegNo As Int32() ' 坐标系运动的段号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=6)>
            Public crdPrfPos As Int32()    ' 坐标系运动的规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public axPrfPos As Int32()        ' 规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public axisPos As Int32()     ' 机械位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public encPos As Int32()      ' 编码器位置
        End Structure
        ' 读取当前备份的变量数值（断电自动保存）
        ' pBackVar : 备份的变量值,参考结构体定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetBackedVarGroup2(devHandle As HAND, ByRef pBackVar As TBackGroup2) As Int16
        End Function

        ' 开始或者关闭变量的自动备份（断电自动保存,默认为关闭状态）
        ' en:是否开启,1：开启变量的自动备份,0：停止变量的自动备份
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetBackedVarOnOff(devHandle As HAND, en As Int16) As Int16
        End Function

        ' 读取当前自动备份的开启状态
        ' pEn:当前的开启状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetBackedVarOnOff(devHandle As HAND, ByRef pEn As Int16) As Int16
        End Function

        ' paraID
        Public Const PARA_IP_ADDR As Int32 = 100     ' IP地址,四个字节分别表示四段
        Public Const PARA_IP_MSK As Int32 = 101     ' IP mask
        Public Const PARA_IP_GW As Int32 = 102     ' Gateway
        Public Const PARA_IP_DHCP As Int32 = 103     ' DHCP
        Public Const PARA_WRITE_EN As Int32 = 999     ' 参数保存
        ' 读取系统参数（long 型）
        ' paraID :　系统参数ID,参见后面定义。pValue : 返回值
        ' 注：此函数可用于设置板卡上的扩展资源
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_DevGetPara(devHandle As HAND, paraID As UInt32, ByRef pValue As Int32) As Int16
        End Function

        ' 设置系统参数（long 型）
        ' paraID :　系统参数ID,参见后面定义。value : 设置值
        ' 注：此函数可用于读取板卡上的扩展资源
        ' 注：IP地址等参数写成功后,需要调用NMC_DevSetPara(devHandle,PARA_WRITE_EN,1)才能使得写下去的参数保存
        ' 注：IP地址等参数写成功后,将在控制器重新启动后生效
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_DevSetPara(devHandle As HAND, paraID As UInt32, value As Int32) As Int16
        End Function

        ' 设置用户密码
        ' pUserName    : 指定的用户名,目前只支持"USER1"
        ' pPasswordOld : 该用户的当前密码,长度最多为15个字符
        ' pPasswordNew : 新的该用户的密码,长度最多为15个字符
        ' 注意：1.初始出厂无密码,一旦设置密码,则必须要登陆后,控制器某些指令才能正常工作（包括启动运动指令,设置DO输出指令）
        '      2.修改密码后,请务必记住新的密码。忘记密码只能返厂复位。
        '      3.密码大小写敏感
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_UserSetPassword(devHandle As HAND, pUserName As String, pPasswordOld As String, pPasswordNew As String) As Int16
        End Function

        ' 用户登陆
        ' pUserName    : 指定的用户名,目前只支持"USER1"
        ' pPassword    : 该用户的密码
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_UserLogin(devHandle As HAND, pUserName As String, pPasswordOld As String) As Int16
        End Function

        ' 用户退出登陆
        ' pUserName    : 指定的用户名,目前只支持"USER1"
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_UserLogout(devHandle As HAND, pUserName As String) As Int16
        End Function

        ' 设置控制器的规划周期
        ' period：单位us	只能为250 500 1000
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetProfilePeriod(devHandle As HAND, period As Int16) As Int16
        End Function

        ' 获取控制器的规划周期
        ' period：单位us	只能为250 500 1000
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetProfilePeriod(devHandle As HAND, ByRef pPeriod As Int16) As Int16
        End Function

        ' 读取最后一次的错误代码
        ' 返回值：错误代码
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetLastErr() As Int16
        End Function

        ' 设置指令错误返回值模式
        ' mode:0-标准模式,将返回详细的错误代码(默认)；1--简洁模式,只返回错误代码类别
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetErrCodeMode(mode As Int16) As Int16
        End Function

        ' 设置指令通讯看门狗
        ' timeout:看门狗超时时间,单位毫秒,小于等于0代表关闭看门狗功能
        ' stopMode:超时停止模式,1:马上停止,0:缓冲区执行完毕后停止
        ' groupID:超时输出do的组号
        ' doValue:超时输出do状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetWatchDog(devHandle As HAND, timeout As Int32, stopMode As Int16, groupID As Int16, doValue As Int32) As Int16
        End Function

        '----------------------------------------------------------
        '	14.6 数据采集
        '----------------------------------------------------------

        ' Collect模块：变量类型
        Public Const COLLECT_ADDRESS_PRF_POS As Int32 = (0) ' 规划位置
        Public Const COLLECT_ADDRESS_AXIS_POS As Int32 = (1) ' 机械位置
        Public Const COLLECT_ADDRESS_ENC_POS As Int32 = (2) ' 编码器位置
        Public Const COLLECT_ADDRESS_CMD_POS As Int32 = (3) ' 命令位置
        Public Const COLLECT_ADDRESS_AXIS_VEL As Int32 = (4) ' 电机速度
        Public Const COLLECT_ADDRESS_CRD_POS As Int32 = (5) ' 坐标系0位置
        Public Const COLLECT_ADDRESS_CRD_VEL As Int32 = (6) ' 坐标系0速度
        Public Const COLLECT_ADDRESS_CRD_POS0 As Int32 = (5) ' 坐标系0位置
        Public Const COLLECT_ADDRESS_CRD_VEL0 As Int32 = (6) ' 坐标系0速度
        Public Const COLLECT_ADDRESS_CRD_POS1 As Int32 = (9) ' 坐标系1位置		
        Public Const COLLECT_ADDRESS_CRD_VEL1 As Int32 = (10) ' 坐标系1速度
        Public Const COLLECT_ADDRESS_ENC_VEL As Int32 = (7) ' 编码器速度
        Public Const COLLECT_ADDRESS_CMD_VEL As Int32 = (8) ' 命令速度
        Public Const COLLECT_ADDRESS_LASER_OUTPUT As Int32 = (11) ' 激光输出（补偿前）
        Public Const COLLECT_ADDRESS_LASER_GATE As Int32 = (12) ' 激光gate信号状态
        Public Const COLLECT_ADDRESS_LASER_POWER As Int32 = (13) ' 激光能量当前输出值
        Public Const COLLECT_ADDRESS_DI As Int32 = (14) ' 数字量输入状态
        Public Const COLLECT_ADDRESS_DO As Int32 = (15) ' 数字量输出状态
        ' 获取需要采集数据变量的地址
        '  index:变量的序号(从0开始)
        '  type: 变量的类型,参数‘Collect模块：变量类型’宏定义
        '  pAddr: 返回的数据地址
        ' pDataLen: 返回的该数据长度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetCollectDataAddr(devHandle As HAND, index As Int16, dataType As Int16, ByRef pAddr As UInt32, ByRef pDataLen As Int16) As Int16
        End Function

        ' 采集模块：采集配置
        Public Const COLLECT_LIST_MAX As Int32 = (8)             '每组最多采集8个数据

        Public Structure TCollectCfg
            Public count As Int16                              ' 需要采集的变量个数
            Public interval As Int16                           ' 采集的间隔时间,0表示每隔1毫米采集一次数据,1表示每隔2ms...
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=COLLECT_LIST_MAX)>
            Public address As UInt32()  ' 变量的地址
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=COLLECT_LIST_MAX)>
            Public length As Int16()          ' 每个变量的长度（单位：char）
        End Structure

        ' 采集模块：触发模式
        Public Const COLLECT_MODE_NONE As Int32 = 0   ' 无条件
        Public Const COLLECT_MODE_G_SRC1 As Int32 = 1   ' 采集源1数值大于比较值
        Public Const COLLECT_MODE_L_SRC1 As Int32 = 2   ' 采集源1数值小于比较值
        Public Const COLLECT_MODE_DIFF As Int32 = 3   ' 采集源1与采集源2两项差值大于比较值

        Public Structure TCollectTrig
            Public mode As Int16                               ' 触发模式,
            Public source1 As Int16                                ' 触发源1
            Public source2 As Int16                                ' 触发源2
            Public startDelay As Int16                         ' 触发启动的延时
            Public value As Double                             ' 触发比较值
        End Structure
        ' 配置采集数据通道,需要配置对应结构体参数
        ' pCollect:采集模块配置
        ' pTrig:采集模块触发方式配置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_ConfigCollect(devHandle As HAND, ByRef pCollect As TCollectCfg, ByRef pTrig As TCollectTrig) As Int16
        End Function

        ' 启动或停止数据采集
        ' en：1启动 0停止
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CollectOnOff(devHandle As HAND, en As Int16) As Int16
        End Function

        ' Collect模块：采集状态
        Public Const COLLECT_BUSY As Int32 = &H1
        Public Const COLLECT_OVERRIDE_DATA As Int32 = &H2
        Public Const COLLECT_PUSH_DATA_ERR As Int32 = &H4
        ' 获取采集状态:
        ' pSts：采集状态,按位表示各自状态,参考‘Collect模块：采集状态’宏定义
        ' pDataLen: 采集的数据量
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetCollectSts(devHandle As HAND, ByRef pSts As Int16, ByRef pDataLen As Int32) As Int16
        End Function

        ' 获取采数据:
        ' len：采集数据长度（单位：char,一次最多读1440字节）
        ' pData: 采集的数据（均以char为单元存储）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetCollectData(devHandle As HAND, len As Int16, ByRef pData As String) As Int16
        End Function

        ' 清除采集状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_ClearCollectSts(devHandle As HAND) As Int16
        End Function

        '----------------------------------------------------------
        '	14.7 坐标系变换功能
        '----------------------------------------------------------

        ' 功能：使能旋转转换处理
        '       用户数据是按照直角坐标描述,实际加工在一个旋转面上加工,可以用此功能
        ' rotAxisNo：旋转轴轴号
        ' angleRadEqual：旋转轴脉冲转弧度系数
        ' firstAxisInitPos：旋转中心,X轴的位置
        ' secAxisInitPos：旋转中心,Y轴的位置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetTransRotate(crdHandle As HAND, rotAxisNo As Int16, angleRadEqual As Double, firstAxisInitPos As Int32, secAxisInitPos As Int32) As Int16
        End Function

        ' 功能：关闭旋转转换处理
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdDelTransRotate(crdHandle As HAND) As Int16
        End Function

        ' 功能：使能极坐标转换处理
        '       用户数据是按照直角坐标描述,实际机械机构是一个旋转轴和一个进给轴
        '参数：	rotAxNo：旋转轴轴号
        '		transAxNo：平移轴轴号
        '		rotEquiv：旋转轴当量,2PI/电机一圈脉冲数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetTransPolar(crdHandle As HAND, rotAxNo As Int16, transAxNo As Int16, rotEquiv As Double) As Int16
        End Function

        ' 功能：运行至设定的极坐标位置并且进行圈数清零处理（利用单轴PTP运行到指定位置）
        '参数：	xPos:极坐标系下X方向位置
        '		yPos:极坐标系下Y方向位置,比如运动到（5000,5000）的位置,则相当于旋转轴转到45度角,进给轴运动到根号2*5000的位置
        '		rotVel:旋转速度
        '		transVel:进给速度
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdRunToPolarPos(crdHandle As HAND, xPos As Double, yPos As Double, rotVel As Double, transVel As Double) As Int16
        End Function

        ' 功能：运行至设定的极坐标角度位置（利用单轴PTP运行到指定位置）
        '参数：	theta:旋转轴目标角度
        '				vel:旋转速度
        '				clrRoundFlag:是否清除圈数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdRunToPolarTheta(crdHandle As HAND, theta As Double, vel As Double, clrRoundFlag As Int16) As Int16
        End Function

        ' 功能：销毁极坐标机型（只恢复直角坐标系）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdDelTransPolar(crdHandle As HAND) As Int16
        End Function

        ' XYZA机型设置接口
        ' 设置XYZA的映射轴号
        ' pAxisMapArray[0]~[3]分别对应X、Y、Z和A
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetTransXYZA(crdHandle As HAND, ByRef pAxisMapArray As Int16) As Int16
        End Function

        ' 销毁XYZA机型，回归XYZ结构
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdDelTransXYZA(crdHandle As HAND) As Int16
        End Function

        ' 求工具参数
        ' deltaTheta：从0°往正方向旋转过的角度值
        ' deltaX：旋转deltaTheta角度后，重新校正到同一点位置后，X轴的相对移动量
        ' deltaY：旋转deltaTheta角度后，重新校正到同一点位置后，Y轴的相对移动量
        ' pToolX: 工具的X值
        ' pToolY: 工具的Y值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetXYZAToolCalc(crdHandle As HAND, deltaTheta As Double, deltaX As Int32, deltaY As Int32, ByRef pToolX As Int32, ByRef pToolY As Int32) As Int16
        End Function

        ' 设置XYZA机型参数
        ' pulse2Rad: A轴的每个脉冲对应的弧度值
        ' toolX：工具的X值
        ' toolY: 工具的Y值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdSetXYZAPara(crdHandle As HAND, pulse2Rad As Double, toolX As Int32, toolY As Int32) As Int16
        End Function

        ' 获取XYZA机型参数
        ' pPulse2Rad:A轴的每个脉冲对应的弧度值
        ' pToolX:工具的X值
        ' pToolY:工具的Y值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_CrdGetXYZAPara(crdHandle As HAND, ByRef pulse2Rad As Double, ByRef toolX As Int32, ByRef toolY As Int32) As Int16
        End Function

        '----------------------------------------------------------
        '	15 非常用指令
        '----------------------------------------------------------

        ' 打开坐标系组
        ' pCrdHandle：返回坐标系组句柄

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdOpen(devHandle As HAND, ByRef pCrdHandle As UInt16) As Int16
        End Function


        ' 设置单轴规划高级参数
        ' axisHandle : 轴句柄
        ' mapAxisNo：轴号，取值范围[0,n]
        ' pCrdHandle：坐标系组句柄
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtPrfConfig(axisHandle As HAND, mapAxisNo As Int16, port As Int16, startPos As Int32) As Int16
        End Function

        ' 读取单轴规划高级参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtGetPrfConfig(axisHandle As HAND, ByRef mapAxisNo As Int16, ByRef port As Int16, ByRef startPos As Int32) As Int16
        End Function


        ' 打包读取多个轴的状态，从第一个轴开始读取后续四个轴的状态
        ' axisFirstHandle : 第一个轴句柄
        ' count :几个轴
        ' packSts: 打包的状态数据，参考结构体定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtGetStsPack(axisFirstHandle As HAND, count As Int16, ByRef packSts As TAxisStsPack) As Int16
        End Function


        ' 设置限位开关输入是否停止运动
        ' posEn：正向限位触发允许设置，1为允许，0为禁止
        ' negEn: 负向限位触发允许设置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtLmtOnOff(axisHandle As HAND, posSwt As Int16, negSwt As Int16) As Int16
        End Function

        ' 设置限位开关触发电平
        ' posSwt：正向限位触发电平设置，1为高电平触发，0为低电平触发
        ' negSwt: 负向限位触发电平设置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtLmtSns(axisHandle As HAND, posSwt As Int16, negSwt As Int16) As Int16
        End Function

        ' 设置伺服报警开关是否停止运动
        ' swt：伺服报警开关输入允许设置，1为允许，0为禁止。（默认为高电平触发）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtAlarmOnOff(axisHandle As HAND, swt As Int16) As Int16
        End Function



        ' 设置伺服报警开关电平
        ' swt：伺服报警触发电平设置，1为高电平触发，0为低电平触发
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtAlarmSns(axisHandle As HAND, swt As Int16) As Int16
        End Function


        '----------------------------------------------------------
        '	3.通用IO及外部资源读写
        '----------------------------------------------------------
        ' 设置通用输出(按通道,支持超过32位)
        ' groupID:DO组，取值范围[0,n],具体需要看控制器是否存在多组数字量输出
        ' value: 设置通用数字量输出。1, 输出高电平，0，输出低电平
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_SetDO(devHandle As HAND, groupID As Int16, value As Int32) As Int16
        End Function

        ' 读取通用输出
        ' groupID:DO组，取值范围[0,n],具体需要看控制器是否存在多组数字量输出
        ' value: 设置通用数字量输出。1, 高电平，0，低电平
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_GetDO(devHandle As HAND, groupID As Int16, ByRef value As Int32) As Int16
        End Function

        ' 读通用输入 
        ' groupID:DI组，取值范围[0,n],具体需要看控制器是否存在多组数字量输入
        ' inValue: 通用数字量输入值。1, 高电平，0，低电平
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_GetDI(devHandle As HAND, groupID As Int16, ByRef inValue As Int32) As Int16
        End Function


        '----------------------------------------------------------
        '	4.缓冲区配置和管理
        '----------------------------------------------------------

        ' 设置坐标系运动缓冲区是否启用，默认为启用状态
        ' enFlag:启用，1：启动，0：不启用
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_EnableCrdSdram(crdHandle As HAND, enFlag As Int16) As Int16
        End Function

        ' 坐标系运动模式下，打包读取控制器状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdGetStsPack3(crdHandle As HAND, ByRef pPackSts As TPackedCrdSts3) As Int16
        End Function


        ' 坐标系能量跟随设置
        ' gourp:跟随的能力类别组号
        ' channel:通道号
        ' start：起始值
        ' coe:跟随的系数（与速度的比值）
        ' max:跟随的最大值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdSetValueFollow(crdHandle As HAND, group As Int16, channel As Int16, start As Double, coe As Double, max As Double) As Int16
        End Function


        '----------------------------------------------------------
        '	5.缓冲区指令
        '----------------------------------------------------------
        ' 直线插补
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' mask:参与的轴，按位表示
        ' pTgPos：目标位置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdLineXYZ(crdHandle As HAND, segNo As Int32, mask As Int16, pTgPos As Int32(), endVel As Double, vel As Double, _
            synAcc As Double) As Int16
        End Function

        ' 圆弧插补：终点位置、半径、方向
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' radius:圆弧半径
        ' pTgPos：目标位置
        ' circleDir:圆弧方向
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdArcRadius(crdHandle As HAND, segNo As Int32, pTgPos As Int32(), radius As Double, circleDir As Int16, endVel As Double, _
            vel As Double, synAcc As Double) As Int16
        End Function

        ' 圆弧插补：终点位置、圆心、方向
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pCenterPos:圆心坐标
        ' pTgPos：目标位置
        ' circleDir:圆弧方向
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdArcCenter(crdHandle As HAND, segNo As Int32, pTgPos As Int32(), pCenterPos As Int32(), circleDir As Int16, endVel As Double, _
            vel As Double, synAcc As Double) As Int16
        End Function

        ' 圆弧插补：起点、中点、终点
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' pMidPos:中间位置点坐标
        ' pTgPos：终点位置坐标
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdArcPPP(crdHandle As HAND, segNo As Int32, pMidPos As Int32(), pTgPos As Int32(), endVel As Double, vel As Double, _
            synAcc As Double) As Int16
        End Function

        ' 螺旋线插补
        ' segNo:段号；endVel:终点速度;vel:最大速度;synAcc:合成加速度
        ' mask:参与的轴，按位表示
        ' pTgPos：目标位置
        ' rounds：螺距
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdHelixCenter(crdHandle As HAND, segNo As Int32, pTgPos As Int32(), pCenterPos As Int32(), circleDir As Int16, rounds As Double, _
            endVel As Double, vel As Double, synAcc As Double) As Int16
        End Function


        ' 缓冲区单轴移动
        ' segNo:段号
        ' axMask:参与的轴
        ' pTgPos：目标位置
        ' blockEn:是否为阻塞模式
        ' synEn：是否为同步模式
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdBufAxMove(crdHandle As HAND, segNo As Int32, axMask As Int16, pTgPos As Int32(), blockEn As Int16, synEn As Int16) As Int16
        End Function

        ' 缓冲区跟随
        ' segNo:段号
        ' onOff:开关
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdBufValueFollow(crdHandle As HAND, segNo As Int32, onOff As Int16) As Int16
        End Function


        ' 设置通用可寻址变量
        ' varID:变量ID
        ' value:设置值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_SetVar8B(devHandle As HAND, varID As Int32, value As Int64) As Int16
        End Function

        ' 读取通用可寻址变量  
        ' varID:变量ID
        ' pValue:变量当前值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_GetVar8B(devHandle As HAND, varID As Int32, ByRef pValue As Int64) As Int16
        End Function

        ' 设置通用可寻址变量
        ' varID:变量ID
        ' value:设置值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_SysSetVar8B(devHandle As HAND, varID As Int32, value As Int64) As Int16
        End Function

        ' 读取通用可寻址变量  
        ' varID:变量ID
        ' pValue:变量当前值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_SysGetVar8B(devHandle As HAND, varID As Int32, ByRef pValue As Int64) As Int16
        End Function

        '-------------------------------------------------------------------------------
        ' 结构体初始化函数
        '-------------------------------------------------------------------------------

        '精确输出结构体
        Public Structure TLinearCmpPara
            Public dimens As Int16
            Public compMode As Int16
            Public axMask As Int16
            Public src As Int16
            Public gateTime As Double
        End Structure
        '二维位置点比较结构体
        Public Structure TComp2DimensParam
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=[CMP_OUTPUT_CHN_MAX])>
            Public outputchn As Int16()     '比较输出的通道:  -1表示不输出处理
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=[CMP_OUTPUT_CHN_MAX])>
            Public outputType As Int16()        ' 输出方式0：  脉冲1：电平
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=[CMP_OUTPUT_CHN_MAX])>
            Public chnType As Int16()       ' 通道类型：  0 GPO, 1  GATE通道
            Public dir1No As Int16                              ' 方向1 的位置源轴号（0~11）
            Public dir2No As Int16                              ' 方向2 的位置源轴号（0~11）
            Public posSrc As Int16                              ' 轴位置类型 ：  0规划1：编码器
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=[CMP_OUTPUT_CHN_MAX])>
            Public stLevel As Int16()           ' 电平模式下的起始电平（0或1）
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=[CMP_OUTPUT_CHN_MAX])>
            Public gateTime As Int16()     ' 脉冲方式脉冲时间:  单位ms
            Public errZone As Int16                                 ' 进入比较点容差半径范围（pulse）
        End Structure

        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TSafeParaStructInit(devHandle As HAND, ByRef pPara As TSafePara) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TCrdConfigStructInit(devHandle As HAND, ByRef pPara As TCrdConfig) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TCrdSafeParaStructInit(devHandle As HAND, ByRef pPara As TCrdSafePara) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_THomeSettingStructInit(devHandle As HAND, ByRef pPara As THomeSetting) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TArcSecSettingStructInit(devHandle As HAND, ByRef pPara As TArcSecSetting) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TCrdParaStructInit(devHandle As HAND, ByRef pPara As TCrdPara) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TCollectCfgStructInit(devHandle As HAND, ByRef pPara As TCollectCfg) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TCollectTrigStructInit(devHandle As HAND, ByRef pPara As TCollectTrig) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TTimeArrayParaStructInit(devHandle As HAND, ByRef pPara As TTimeArrayPara) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TLaserPowerStructInit(devHandle As HAND, ByRef pPara As TLaserPower) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_TSHIOParaStructInit(devHandle As HAND, ByRef pPara As TSHIOPara) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_TLinearCmpParaStructInit(devHandle As HAND, ByRef pPara As TLinearCmpPara) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TComp2DimensParamStructInit(devHandle As HAND, ByRef pPara As TComp2DimensParam) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TPtpParaStructInit(devHandle As HAND, ByRef pPara As TPtpPara) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TJogParaStructInit(devHandle As HAND, ByRef pPara As TJogPara) As Int16
        End Function
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_TNMCTimeStructInit(devHandle As HAND, ByRef pPara As TNMCTime) As Int16
        End Function

        ' 清除轴错误状态,同时多个
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtClrErrorEx(axisHandle As HAND, count As Int16) As Int16
        End Function

        ' 输出DO,16位
        ' bitsFlag,0:低16位,1：高16位
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_SetDOGroupEx(devHandle As HAND, value As Int32, groupID As Int16, bitsFlag As Int16) As Int16
        End Function

        '-------------------------------------------------------------------------------
        ' 高级BufIo输出配置及控制
        '-------------------------------------------------------------------------------
        ' BufIo输出最大组数
        Public Const MAX_ADV_BUFIO_GROUP As Int32 = 2

        ' 高级BufIo输出参数
        Public Structure TAdvBufIoParam
            ' 输出点
            Public outType As Int16             ' 输出类型，0：通用输出；1：Gate信号；其他保留
            Public outGroup As Int16                ' 输出组，取值范围[0,n]
            Public outIndex As Int16                ' 输出序号，取值范围[0,n]
            Public outSns As Int16              ' 有效电平,0:低电平有效，1：高电平

            ' 信号
            Public pulseMode As Int16       ' 0：电平输出，1：脉冲输出W
            Public pulseOnTime As Int32        ' 有效电平时间（脉冲输出方式下有效），单位：微秒
            Public pulseOffTime As Int32       ' 无效电平时间（脉冲输出方式下有效），单位：微秒
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public reserved As Byte() ' 保留
        End Structure

        ' 设置BufIo输出参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_AdvBufIoSetParam(devHandle As HAND, ByRef pPrm As TAdvBufIoParam, ch As Int16) As Int16
        End Function

        ' 读取BufIo输出参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_AdvBufIoGetParam(devHandle As HAND, ByRef pPrm As TAdvBufIoParam, ch As Int16) As Int16
        End Function

        ' 缓冲区设置高级BufIo输出有效（运动一段距离后输出特定状态）
        ' outLength:距离，单位：脉冲
        ' value: 脉冲模式下输出脉冲个数，电平方式下无意义。
        ' ch:输出组，取值范围：[0,MAX_ADV_BUFIO_GROUP)
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdAdvBufIoOnAfterLen(crdHandle As HAND, segNo As Int32, outLength As Int32, value As Int32, ch As Int16) As Int16
        End Function

        ' 缓冲区设置高级BufIo关闭输出（缓冲区全部运动结束前提前一段距离输出特定状态）
        ' outLength:距离，单位：脉冲
        ' ch:输出组，取值范围：[0,MAX_ADV_BUFIO_GROUP)
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdAdvBufIoOffBeforeLen(crdHandle As HAND, segNo As Int32, outLength As Int32, ch As Int16) As Int16
        End Function

        ' 立即设置高级BufIo输出
        ' value: 脉冲模式下输出脉冲个数，电平方式下0:关闭，1:打开。
        ' ch:输出组，取值范围：[0,MAX_ADV_BUFIO_GROUP)
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_AdvBufIoOut(devHandle As HAND, value As Int32, ch As Int16) As Int16
        End Function

        ' 读取BufIo的输出数量
        ' pOutCout:输出脉冲个数
        ' ch:输出组，取值范围：[0,MAX_ADV_BUFIO_GROUP)
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_AdvBufIoGetPulseCnt(devHandle As HAND, ByRef pOutCout As Int32, ch As Int16) As Int16
        End Function

        ' DO脉冲输出最大通道数
        Public Const MAX_NUM_DOBIT_PULSE As Int32 = 4

        ' DO脉冲输出
        ' doType:DO类型,0：通用输出；其他保留
        ' doIndex:DO序号，取值范围[0,n]
        ' highLevelTime:高电平宽度，单位:us
        ' lowLevelTime:低电平宽度，单位:us
        ' outCount:输出脉冲个数
        ' firstLevel:0：先输出低电平，1：先输出高电平
        ' ch:输出脉冲通道号,取值范围:[0,MAX_NUM_DOBIT_PULSE-1]
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DoBitPulseEnable(devHandle As HAND, doType As Int16, doIndex As Int16, highLevelTime As Int32, lowLevelTime As Int32, outCount As Int32, initialLevel As Int16, ch As Int16) As Int16
        End Function

        ' 关闭DO脉冲输出
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DoBitPulseDisable(devHandle As HAND, ch As Int16) As Int16
        End Function

        ' DO脉冲输出 （缓冲区）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdBufDoBitPulseEnable(crdHandle As HAND, segNo As Int32, doType As Int16, doIndex As Int16, highLevelTime As Int32, lowLevelTime As Int32, outCount As Int32, initialLevel As Int16, ch As Int16) As Int16
        End Function

        ' 关闭DO脉冲输出（缓冲区）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_CrdBufDoBitPulseDisable(crdHandle As HAND, segNo As Int32, ch As Int16) As Int16
        End Function

        '-------------------------------------------------------------------------------
        ' 坐标系干涉保护指令
        '-------------------------------------------------------------------------------
        Public Const CRD_INTERF_GROUP_MAX As Int32 = (2)

        ' 启动坐标系的干涉保护
        ' groupNo: 干涉坐标系组号（目前只有两个坐标系，所以该值为0）
        ' mode:	0:基本模式，出现干涉，两坐标系均停止  1：激光模式，出现干涉，其中一个停止并离开
        ' 关闭DO脉冲输出（缓冲区）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_SetMvProtect(devHandle As HAND, groupNo As Int16, mode As Int16) As Int16
        End Function

        ' 取消坐标系的干涉保护
        ' groupNo: 干涉坐标系组号（目前只有两个坐标系，所以该值为0）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DelMvProtect(devHandle As HAND, groupNo As Int16) As Int16
        End Function

        ' 获取坐标系的干涉状态
        ' groupNo: 干涉坐标系组号（目前只有两个坐标系，所以该值为0）
        ' pSts:	0 没有启动干涉功能 1  没有出现干涉  2 干涉发生
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_GetMvProtectSts(devHandle As HAND, groupNo As Int16, ByRef pSts As Int16) As Int16
        End Function

        Public Structure TMvProtectPara
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdNo As Int16()     ' 需要干涉保护的两坐标系号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdAxNo As Int16()   ' 坐标系的干涉轴号,指XYZ中哪一个（X:0  Y:1    Z:2）
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public moveDir As Int16()    ' 两干涉轴分别往距离减小时的运动方向，1：正向 -1：负向

            Public orgDis As Int32           ' 两坐标系的crdAxNo轴在原点时的距离
            Public mvProtectDis As Int32  ' 干涉的保护距离   
            Public safeWaitPos As Int32  ' mode为激光模式时，干涉轴需要停止到的等待位置（mode为0时无效）
            Public mvToSafeAcc As Double  ' 运动到等待位置的移动加速度
            Public mvToSafeVel As Double   ' 运动到等待位置的移动速度
            Public stopCrdNo As Int16        ' mode为激光模式时，需要停止的坐标系号（mode为0时无效）
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)>
            Public reserved As Int16()      ' 保留参数
        End Structure

        ' 设置坐标系的干涉保护参数
        ' groupNo:	干涉坐标系组号（目前只有两个坐标系，所以该值为0）
        ' pCrdInterfProtectPara： 干涉参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_SetMvProtectMode01Para(devHandle As HAND, groupNo As Int16, ByRef pMvProtectPara As TMvProtectPara) As Int16
        End Function

        ' 获取坐标系的干涉保护参数
        ' groupNo:	干涉坐标系组号（目前只有两个坐标系，所以该值为0）
        ' pCrdInterfProtectPara： 干涉参数
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_GetMvProtectMode01Para(devHandle As HAND, groupNo As Int16, ByRef pMvProtectPara As TMvProtectPara) As Int16
        End Function

        '------------------------------------------------------------------------
        '                                                     
        '  自动状态返回
        '                                                   
        '------------------------------------------------------------------------
        Public Const AUTO_RTN_MAX_AXIS As Int32 = 12
        ' 打包返回状态结构
        Public Structure TAutoRtnPackedSts
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtSts As Int16()          ' 单轴状态
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtMio As Int16()         ' 单轴专用IO
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtPrfPos As Int32()       ' 单轴规划位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtEncPos As Int32()       ' 单轴实际位置
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=12)>
            Public mtPrfVel As Single()       ' 单轴规划速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdSts As Int16()          ' 坐标系状态
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdPrfVel As Single()     ' 坐标系运动速度
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdUserSeg As Int32()       ' 坐标系运行的缓冲区段号
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdFreeSpace As Int32()     ' 坐标系缓冲区剩余空间
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)>
            Public crdUsedSpace As Int32()     ' 坐标系缓冲区使用空间

            Public gpi As Int32                 ' 通用输入
            Public gpo As Int32                 ' 通用输出
            <MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)>
            Public reserved As Int16()      ' 预留
        End Structure

        ' 设置启用自动状态返回
        ' mode1 : 设置哪些状态主动返回，0：固定时间周期返回（默认）; 1：周期+轴状态变化，坐标系状态变化；
        ' mode2 : 备用
        ' cycleInMs: 周期，单位ms。取值5~10000。建议值100ms。
        ' port: 端口，写0（库里会修改）
        ' hostTag : 上位机标签，写0（库里会修改）
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAutoRtnSet(devHandle As HAND, mode1 As Int32, mode2 As Int32, cycleInMs As Int32, port As Int32, hostTag As Int32) As Int16
        End Function

        ' 设置禁用自动状态返回
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAutoRtnClr(devHandle As HAND) As Int16
        End Function

        ' 同步，
        ' 把之前的状态缓冲清除掉。以后读到的是同步指令发送后的状态
        ' hostTag : 上位机标签，写0
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAutoRtnSyn(devHandle As HAND, hostTag As Int32) As Int16
        End Function

        ' 读状态
        ' packedSts : 打包状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAutoRtnGet(devHandle As HAND, ByRef packedSts As TAutoRtnPackedSts, ByRef pReady As Int16) As Int16
        End Function

        ' 设置PTP位置比较输出
        ' comparaPos： 目标位置，单位是 脉冲
        ' upDateVel：比较后的更新速度 pulse/ms
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtSetPtpComparePara(axisHandle As HAND, dir As Int16, comparaPos As Int32, upDateVel As Double) As Int16
        End Function

        ' 获取PTP比较输出状态
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_MtGetPtpCompareSts(axisHandle As HAND, ByRef pIsCompareActive As Int16, ByRef pIsCompareOut As Int16) As Int16
        End Function

        '------------------------------------------------------------------------
        '                                                     
        '   点位自动收发
        '                                                   
        '------------------------------------------------------------------------

        ' 设置启用点位自动收发
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAsynCommSet(devHandle As HAND, delayInMs As UInt32) As Int16
        End Function

        ' 设置关闭点位自动收发
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAsynCommClr(devHandle As HAND) As Int16
        End Function

        ' 自动状态返回
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAsynGetSts(devHandle As HAND, ByRef packedSts As TAutoRtnPackedSts, ByRef pReady As Int16) As Int16
        End Function

        ' 多轴点位运动    
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAsynAbsMoveType1(axisHandle As HAND, acc As Single, dec As Single, vel As Single, smooth As Int16, arrivalBand As Int32, stableTime As Int32, tgtPos As Int32) As Int16
        End Function

        ' 设置Do
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)> _
        Public Shared Function NMC_DevAsynSetDoBit(devHandle As HAND, bitIdx As Int16, setValue As Int16) As Int16
        End Function

        '---------------------电子齿轮-----------------------------------------

        '设置Gear跟随方向
        'axisHandle：跟随轴句柄
        'dir：  0:双向跟随，<0负向跟随， >0正向跟随
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGearSetDir(axisHandle As HAND, dir As Int16) As Int16
        End Function

        '获取Gear跟随方向
        'axisHandle：跟随轴句柄
        'dir：  0:双向跟随，<0负向跟随， >0正向跟随
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGearGetDir(axisHandle As HAND, ByRef pdir As Int16) As Int16
        End Function

        '设置Gear主轴参数
        'axisHandle:主轴句柄
        'masterNo:主轴序列号（0~N）
        'masterType:主轴类型  1:AXIS规划值  2：AXIS反馈值 3：编码器值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGearSetMaster(axisHandle As HAND, masterNo As Int16, masterType As Int16) As Int16
        End Function

        '读取Gear主轴参数
        'axisHandle:主轴句柄
        'masterNo:主轴序列号（0~N）
        'masterType:主轴类型  1:AXIS规划值  2：AXIS反馈值 3：编码器值
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGearGetMaster(axisHandle As HAND, ByRef pmasterNo As Int16, ByRef pmasterType As Int16) As Int16
        End Function


        '设置Gear跟随倍率
        'axisHandle：从轴跟随轴号
        'masterEven： 传动比系数，主轴位移
        'slaveEven：  传动比系数，从轴位移
        'masterSlope：主轴离合区位移,必须大于0，同时不能等于1
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGearSetRatio(axisHandle As HAND, masterEven As Int32, slaveEven As Int32, masterSlope As Int32) As Int16
        End Function

        '读取Gear跟随倍率
        'axisHandle：从轴跟随轴号
        'masterEven： 传动比系数，主轴位移
        'slaveEven：  传动比系数，从轴位移
        'masterSlope：主轴离合区位移,必须大于0，同时不能等于1
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGearGetRatio(axisHandle As HAND, ByRef pmasterEven As Int32, ByRef pslaveEven As Int32, ByRef pmasterSlope As Int32) As Int16
        End Function

        '启动Gear运动
        'axisHandle：从轴跟随轴号
        'pSyncAxisArray: 其他同步启动轴的序号：0~N	
        '注：同步的轴必须属于同一个控制器
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtGearStartMtn(axisHandle As HAND, syncAxCnts As Int16, ByRef pSyncAxArray As Int16) As Int16
        End Function

        '电子凸轮---------------------------
        '设置FOLLOW跟随方向
        'dir：  0:双向跟随，<0负向跟随， >0正向跟随
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowSetDir(axisHandle As HAND, dir As Int16) As Int16
        End Function

        '获取FOLLOW跟随方向
        'dir：  0:双向跟随，<0负向跟随， >0正向跟随
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowGetDir(axisHandle As HAND, ByRef pdir As Int16) As Int16
        End Function

        'FOLLOW跟随的主轴类型
        Public Const PROFILE_FOLLOW_MASTER_NONE As Int32 = 0       ' 0:无效
        Public Const PROFILE_FOLLOW_MASTER_AXIS_PRF As Int32 = 1   ' 1:AXIS规划值
        Public Const PROFILE_FOLLOW_MASTER_AXIS_ENC As Int32 = 2   ' 2：AXIS反馈值
        Public Const PROFILE_FOLLOW_MASTER_ENC As Int32 = 3        ' 3：编码器值

        '设置FOLLOW主轴参数
        'axisHandle：从轴跟随轴号
        'masterNo：  主轴序列号（0~N）
        'masterType：  主轴类型  见上面宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowSetMaster(axisHandle As HAND, masterNo As Int16, masterType As Int16) As Int16
        End Function

        '获取FOLLOW主轴参数
        'axisHandle：从轴跟随轴号
        'masterNo：  主轴序列号（0~N）
        'masterType：  主轴类型  见上面宏定义
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowGetMaster(axisHandle As HAND, ByRef pmasterNo As Int16, ByRef pmasterType As Int16) As Int16
        End Function

        '设置FOLLOW的循环执行次数
        'loopCnt：循环
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowSetLoopCount(axisHandle As HAND, loopCnt As Int32) As Int16
        End Function

        '获取FOLLOW的循环执行次数
        'loopCnt：循环
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowGetLoopCount(axisHandle As HAND, ByRef loopCnt As Int32) As Int16
        End Function

        'FOLLOW跟随事件
        Public Const PROFILE_FOLLOW_EVENT_START As Int32 = (1)  ' 立即启动
        Public Const PROFILE_FOLLOW_EVENT_PASS As Int32 = (2)   '主轴穿越设定位置以后启动跟随

        '设置FOLLOW的的启动事件
        'eventType：1 表示调用启动指令以后	立即启动，2表示	主轴穿越设定位置以后启动跟随
        'masterDir:穿越启动时，主轴的运动方向，1 主轴正向运动，-1 主轴负向运动
        'pos:穿越位置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowSetEvent(axisHandle As HAND, eventType As Int16, masterDir As Int16, pos As Int32) As Int16
        End Function

        '获取FOLLOW的的启动事件
        'eventType：1 表示调用启动指令以后	立即启动，2表示	主轴穿越设定位置以后启动跟随
        'masterDir:穿越启动时，主轴的运动方向，1 主轴正向运动，-1 主轴负向运动
        'pos:穿越位置
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowGetEvent(axisHandle As HAND, ByRef peventType As Int16, ByRef pmasterDir As Int16, ByRef ppos As Int32) As Int16
        End Function

        '获取FOLLOW的fifo剩余空间
        'pSpace：空间大小
        'fifoNo:fifo号，0或1
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowGetSpace(axisHandle As HAND, ByRef pSpace As Int16, fifoNo As Int16) As Int16
        End Function

        'FOLLOW的段类型
        Public Const PROFILE_FOLLOW_SEGMENT_NORMAL As Int32 = (0)   '0普通段
        Public Const PROFILE_FOLLOW_SEGMENT_EVEN As Int32 = (1)     ' 1匀速段
        Public Const PROFILE_FOLLOW_SEGMENT_STOP As Int32 = (2)     ' 2停止段
        Public Const PROFILE_FOLLOW_SEGMENT_CONTINUE As Int32 = (3) ' 3连续段

        '设置FOLLOW的数据
        'masterPos：主轴位移
        'slavePos:从轴位移
        'type:数据段类型：0普通段，默认；1匀速段；2 减速到 0 段；3保持 FIFO 之间速度连续
        'fifoNo:fifo号，0或1
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowPushData(axisHandle As HAND, masterPos As Int32, slavePos As Double, type As Int16, fifoNo As Int16) As Int16
        End Function

        '清除FOLLOW对应fifo号的数据
        'fifoNo:fifo号，0或1
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowClear(axisHandle As HAND, fifoNo As Int16) As Int16
        End Function

        '启动Follow运动
        'syncCount： 不包括axisHandle 的其他同步启动轴数量
        'pSyncAxisArray: 其他同步启动轴的序号：0~N	
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowStart(axisHandle As HAND, syncAxCnts As Int16, ByRef pSyncAxArray As Int16) As Int16
        End Function

        '切换Follow运动的fifo号
        'syncCount： 不包括axisHandle 的其他同步启动轴数量
        'pSyncAxisArray: 其他同步启动轴的序号：0~N	
        <DllImport(DLL_PATH, CallingConvention:=CallingConvention.StdCall)>
        Public Shared Function NMC_MtFollowSwitch(axisHandle As HAND, syncAxCnts As Int16, ByRef pSyncAxArray As Int16) As Int16
        End Function

    End Class
End Namespace

'=======================================================
'Service provided by Telerik (www.telerik.com)
'Conversion powered by NRefactory.
'Twitter: @telerik
'Facebook: facebook.com/telerik
'=======================================================
