Attribute VB_Name = "I7565CPM" Option Explicit '-------------------------------------------------- ' Return Code '-------------------------------------------------- Public Const CPM_NoError As Integer = 0 Public Const CPM_OpenComErr As Integer = 2 Public Const CPM_ComPortErr As Integer = 3 Public Const CPM_MasterFull As Integer = 4 Public Const CPM_ConfigErr As Integer = 5 Public Const CPM_MasterInitErr As Integer = 6 Public Const CPM_MasterNotInit As Integer = 7 Public Const CPM_ListenMode As Integer = 8 Public Const CPM_NodeErr As Integer = 9 Public Const CPM_NodeExist As Integer = 10 Public Const CPM_TxBusy As Integer = 12 Public Const CPM_UnknowCmd As Integer = 13 Public Const CPM_CmdReceErr As Integer = 14 Public Const CPM_DataEmpty As Integer = 15 Public Const CPM_MemAllocErr As Integer = 16 Public Const CPM_SendCycMsgErr As Integer = 17 Public Const CPM_StatusErr As Integer = 18 Public Const CPM_SetGuardErr As Integer = 20 Public Const CPM_SetHbeatErr As Integer = 21 Public Const CPM_SegLenErr As Integer = 22 Public Const CPM_SegToggleErr As Integer = 23 Public Const CPM_SegWriteErr As Integer = 24 Public Const CPM_Abort As Integer = 25 Public Const CPM_PDOLenErr As Integer = 26 Public Const CPM_COBIDErr As Integer = 27 Public Const CPM_PDOInstErr As Integer = 28 Public Const CPM_PDODynaErr As Integer = 29 Public Const CPM_PDONumErr As Integer = 30 Public Const CPM_PDOSetErr As Integer = 31 Public Const CPM_PDOEntryErr As Integer = 32 Public Const CPM_SetCobIdErr As Integer = 33 Public Const CPM_CycFullErr As Integer = 34 Public Const CPM_Timeout As Integer = 35 Public Const CPM_DataLenErr As Integer = 36 Public Const CPM_SendLose As Integer = 38 Public Const CPM_SendCmdErr As Integer = 39 Public Const CPM_Wait As Integer = 40 Public Const CPM_Processing As Integer = 41 Public Const CPM_LoadEDSErr As Integer = 50 Public Const CPM_EDSFormatErr As Integer = 51 '-------------------------------------------------- ' CANopen Master NMTErr Event Define '-------------------------------------------------- Public Const CPM_Node_Guarding_Event As Integer = 1 Public Const CPM_Heartbeat_Event As Integer = 2 '-------------------------------------------------- ' Common functions '-------------------------------------------------- Declare Function I7565CPM_GetVersion Lib "I7565CPM.dll" () As Integer Declare Function I7565CPM_GetCANStatus Lib "I7565CPM.dll" (ByVal ComPort As Byte, bStatus As Byte) As Integer Declare Sub I7565CPM_SetFunctionTimeout Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal FunTimeout As Long) Declare Function I7565CPM_InitMaster Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal BaudRate As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_ShutdownMaster Lib "I7565CPM.dll" (ByVal ComPort As Byte) As Integer Declare Function I7565CPM_MasterSendBootupMsg Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_SetMasterMode Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal mode As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetMasterMode Lib "I7565CPM.dll" (ByVal ComPort As Byte, mode As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetFirmwareVersion Lib "I7565CPM.dll" (ByVal ComPort As Byte, Fir_Ver As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_EDS_Load Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal FilePath As String, ByVal DelayTime As Integer, ByVal ResTimeout As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_AddNode Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal AddMode As Byte, ByVal DelayTime As Integer, ByVal ResTimeout As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_RemoveNode Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_RemoveAndResetNode Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_ScanNode Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal S_Node As Byte, ByVal E_Node As Byte, NodeList As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetNodeList Lib "I7565CPM.dll" (ByVal ComPort As Byte, NodeList As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_NMTChangeState Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal State As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_NMTGetState Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, State As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_NMTGuarding Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal GuardTime As Integer, ByVal LiftTime As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_NMTHeartbeat Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal ProduceTime As Integer, ByVal ConsumeTime As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_SDOReadData Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal Index As Integer, ByVal SubIndex As Byte, RDlen As Long, RData As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_SDOReadFile Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal Index As Integer, ByVal SubIndex As Byte, ByVal Start As Long, ByVal DLen As Long, RDlen As Long, RData As Byte) As Integer Declare Function I7565CPM_SDOWriteData Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal Index As Integer, ByVal SubIndex As Byte, ByVal TDLen As Long, TData As Byte, RDlen As Integer, RData As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_SDOAbortTransmit Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal Index As Integer, ByVal SubIndex As Byte, ByVal TData As Long, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_PDOWrite Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, ByVal Offset As Byte, ByVal DLen As Byte, data As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_PDOWrite_Fast Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, ByVal Offset As Byte, ByVal DLen As Byte, data As Byte) As Integer Declare Function I7565CPM_PDORemote Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, DLen As Byte, data As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_PDORemote_Fast Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer) As Integer Declare Function I7565CPM_SetPDORemotePolling Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal PDOCnt As Byte, CobId As Integer, ByVal Polling_Time As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetPDOLastData Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, IsNew As Byte, DLen As Byte, data As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetMultiPDOData Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal PDOCnt As Byte, CobId As Integer, IsNew As Byte, DLen As Byte, data As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetRxPDOID Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, PDO_Cnt As Byte, Id_List As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetTxPDOID Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, PDO_Cnt As Byte, Id_List As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_InstallPDO Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal RxTx As Byte, ByVal PDO_No As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_DynamicPDO Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal RxTx As Byte, ByVal Entry As Byte, ByVal EntryData As Long, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_RemovePDO Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal Entry As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_ChangePDOID Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Old_Cobid As Integer, ByVal New_Cobid As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetPDOMapInfo Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, PDONo As Integer, RxTx As Byte, Tx_Type As Byte, Event_Timer As Integer, Entry_Cnt As Byte, Map_Data As Long, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_InstallPDO_List Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal RxTx As Byte, ByVal PDO_No As Integer, ByVal Tx_Type As Byte, ByVal Event_Timer As Integer, ByVal EntryUse As Byte, EntryData As Long, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_RemovePDO_List Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal Entry As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_PDOUseEntry Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, ByVal Entry As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_PDOTxType Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, ByVal Tx_Type As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_PDOEventTimer Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, ByVal eTimer As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_ChangeSYNCID Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_SetSYNC_List Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetSYNCID Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, CobId As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_SendSYNCMsg Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, ByVal sTimer As Integer, ByVal Times As Long, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetCyclicSYNCInfo Lib "I7565CPM.dll" (ByVal ComPort As Byte, CobId As Integer, Timer As Integer, Times As Long, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_ChangeEMCYID Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_SetEMCY_List Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, ByVal CobId As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetEMCYID Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, CobId As Integer, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_ReadLastEMCY Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal Node As Byte, IsNew As Byte, data As Byte, ByVal BlockMode As Byte) As Integer Declare Function I7565CPM_GetBootUpNodeAfterAdd Lib "I7565CPM.dll" (ComPort As Byte, Node As Byte) As Integer Declare Function I7565CPM_GetEMCYData Lib "I7565CPM.dll" (ComPort As Byte, Node As Byte, data As Byte) As Integer Declare Function I7565CPM_GetNMTError Lib "I7565CPM.dll" (ComPort As Byte, Node As Byte, NMTErrMode As Byte) As Integer Declare Function I7565CPM_InstallBootUpISR Lib "I7565CPM.dll" _ (ByVal ComPort As Byte, ByVal User_BOOTISR As Long) As Integer 'User_BOOTISR is the format of Sub User_BOOTISR () Declare Function I7565CPM_RemoveBootUpISR Lib "I7565CPM.dll" (ByVal ComPort As Byte) As Integer Declare Function I7565CPM_InstallEMCYISR Lib "I7565CPM.dll" _ (ByVal ComPort As Byte, ByVal User_EMCYISR As Long) As Integer 'User_EMCYISR is the format of Sub User_EMCYISR () Declare Function I7565CPM_RemoveEMCYISR Lib "I7565CPM.dll" (ByVal ComPort As Byte) As Integer Declare Function I7565CPM_InstallNMTErrISR Lib "I7565CPM.dll" _ (ByVal ComPort As Byte, ByVal User_NMTErrISR As Long) As Integer 'User_NMTErrISR is the format of Sub User_NMTErrISR () Declare Function I7565CPM_RemoveNMTErrISR Lib "I7565CPM.dll" (ByVal ComPort As Byte) As Integer Declare Function I7565CPM_GetMasterReadSDOEvent Lib "I7565CPM.dll" (ComPort As Byte, Index As Integer, SubIndex As Byte) As Integer Declare Function I7565CPM_GetMasterWriteSDOEvent Lib "I7565CPM.dll" (ComPort As Byte, Index As Integer, SubIndex As Byte, WLen As Byte, WData As Byte) As Integer Declare Function I7565CPM_ResponseMasterSDO Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal ResType As Byte, ByVal Index As Integer, ByVal SubIndex As Byte, ByVal RLen As Byte, RData As Byte) As Integer Declare Function I7565CPM_GetMasterRemotePDOEvent Lib "I7565CPM.dll" (ComPort As Byte, CobId As Integer) As Integer Declare Function I7565CPM_GetMasterRxPDOEvent Lib "I7565CPM.dll" (ComPort As Byte, CobId As Integer, WLen As Byte, WData As Byte) As Integer Declare Function I7565CPM_ResponseMasterPDO Lib "I7565CPM.dll" (ByVal ComPort As Byte, ByVal CobId As Integer, ByVal RLen As Byte, RData As Byte) As Integer Declare Function I7565CPM_InstallReadSDOISR Lib "I7565CPM.dll" _ (ByVal ComPort As Byte, ByVal User_ReadSDOISR As Long) As Integer 'User_ReadSDOISR is the format of Sub User_ReadSDOISR () Declare Function I7565CPM_RemoveReadSDOISR Lib "I7565CPM.dll" (ByVal ComPort As Byte) As Integer Declare Function I7565CPM_InstallWriteSDOISR Lib "I7565CPM.dll" _ (ByVal ComPort As Byte, ByVal User_WriteSDOISR As Long) As Integer 'User_WriteSDOISR is the format of Sub User_WriteSDOISR () Declare Function I7565CPM_RemoveWriteSDOISR Lib "I7565CPM.dll" (ByVal ComPort As Byte) As Integer Declare Function I7565CPM_InstallRxPDOISR Lib "I7565CPM.dll" _ (ByVal ComPort As Byte, ByVal User_RxPDOISR As Long) As Integer 'User_RxPDOISR is the format of Sub User_RxPDOISR () Declare Function I7565CPM_RemoveRxPDOISR Lib "I7565CPM.dll" (ByVal ComPort As Byte) As Integer Declare Function I7565CPM_InstallRemotePDOISR Lib "I7565CPM.dll" _ (ByVal ComPort As Byte, ByVal User_RemotePDOISR As Long) As Integer 'User_RemotePDOISR is the format of Sub User_RemotePDOISR () Declare Function I7565CPM_RemoveRemotePDOISR Lib "I7565CPM.dll" (ByVal ComPort As Byte) As Integer