Attribute VB_Name = "pisocpm100" Option Explicit '-------------------------------------------------- ' Return Code '-------------------------------------------------- 'CPM100_NoError 0 'CPM100_DriverError 1 'CPM100_ActiveBoardError 2 'CPM100_BoardNumberError 3 ' ' 'CPM100_ConfigureErr 102 'CPM100_DataLenErr 103 'CPM100_NodeAddErr 104 ' 'CPM100_StatusErr 106 'CPM100_SetGuardErr 107 ' 'CPM100_NodeNumberErr 109 'CPM100_CobIdErr 110 ' 'CPM100_SDOSendErr 112 ' 'CPM100_PDOSendErr 115 'CPM100_PDOTypeErr 116 ' 'CPM100_PDOEntryErr 118 ' 'CPM100_PDORemoveErr 120 'CPM100_TimeOut 121 ' 'CPM100_ChannelErr 127 ' 'CPM100_SYNCSendErr 130 'CPM100_SYNCSetErr 131 ' 'CPM100_SDODataLose 140 ' 'CPM100_PDOFIFOisEmpty 147 'CPM100_EMCYFIFOisEmpty 148 ' 'CPM100_SendCmdErr 150 ' 'CPM100_FirmwareErr 160 ' 'CPM100_MasterInitErr 162 'CPM100_MasterShutdownErr 163 ' 'CPM100_CobIdChangeErr 165 ' 'CPM100_SetEventTimerErr 167 '-------------------------------------------------- ' Common functions '-------------------------------------------------- Declare Function CPM100_GetVersion Lib "cpm100.dll" () As Double Declare Function CPM100_TotalBoard Lib "cpm100.dll" () As Integer Declare Function CPM100_GetBoardSwitchNo Lib "cpm100.dll" _ (ByVal bBoardCntNo As Byte, bBoardSwitchNo As Byte) As Integer Declare Function CPM100_GetBoardInf Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, dwVID As Long, dwDID As Long, dwSVID As Long, _ dwSDID As Long, dwSAuxID As Long, dwIrqNo As Long) As Integer Declare Function CPM100_ActiveBoard Lib "cpm100.dll" (ByVal bBoardNo As Byte) As Integer Declare Function CPM100_CloseBoard Lib "cpm100.dll" (ByVal bBoardNo As Byte) As Integer Declare Function CPM100_BoardIsActive Lib "cpm100.dll" (ByVal bBoardNo As Byte) As Integer Declare Function CPM100_GetCANStatus Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, bStatus As Byte) As Integer Declare Function CPM100_InitMaster Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bBaudrate As Byte) As Integer 'BaudRate 0=10K 1=20K 2=50K 3=125K 4=250K 5=500K 6=800K 7=1Mbps Declare Function CPM100_ShutdownMaster Lib "cpm100.dll" (ByVal bBoardNo As Byte) As Integer Declare Function CPM100_AddNode Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte) As Integer Declare Function CPM100_RemoveNode Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte) As Integer Declare Function CPM100_NMTChangeState Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal bState As Byte) As Integer ' 1 = Operational mode, 2 = Stop mode, 128 = Pre-Operational mode, 129 = Reset slave Declare Function CPM100_NMTGetState Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, bState As Byte) As Integer ' 4 = Stop status, 5 = Operational status, 127 = Pre-Operational status Declare Function CPM100_NMTGuarding Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wGuardTime As Integer, _ ByVal bLifeTimeFactor As Byte) As Integer Declare Function CPM100_SendSYNC Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal wCobId As Integer, _ ByVal dwSyncCycle As Long) As Integer Declare Function CPM100_GetSYNCingID Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, IdNum As Byte, wSYNCIdList As Integer, _ dwSYNCCycleList As Long) As Integer Declare Function CPM100_ChangeSYNCID Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, _ ByVal wCobId As Integer) As Integer Declare Function CPM100_ChangeEMCYID Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, _ ByVal wCobId As Integer) As Integer Declare Function CPM100_ReadEMCYCount Lib "cpm100.dll" (ByVal bBoardNo As Byte) As Integer Declare Function CPM100_ReadEMCY Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, bNode As Byte, wCobId As Integer, EMCY_Data As Byte, _ wYear As Integer, wMonth As Integer, wDayOfWeek As Integer, _ wDay As Integer, wHour As Integer, wMinute As Integer, _ wSecond As Integer, wMilliseconds As Integer) As Integer Declare Function CPM100_SDOAbortTransmit Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wIndex As Integer, _ ByVal bSubIndex As Byte) As Integer Declare Function CPM100_SDOReadData Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wIndex As Integer, _ ByVal bSubIndex As Byte, wRDatalen As Integer, bRData As Byte) As Integer Declare Function CPM100_SDOWriteData Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wIndex As Integer, _ ByVal bSubIndex As Byte, ByVal wWDatalen As Integer, bWData As Byte, _ wRDatalen As Integer, bRData As Byte) As Integer Declare Function CPM100_DynamicPDO Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wCobId As Integer, _ ByVal bRxTxType As Byte, ByVal bPDOEntry As Byte, _ bMappingData As Byte) As Integer Declare Function CPM100_InstallPDO Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wCobId As Integer, _ ByVal wPDOIndex As Integer) As Integer Declare Function CPM100_RemovePDO Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wCobId As Integer, _ ByVal bRxTxType As Byte, ByVal bPDOEntry As Byte) As Integer Declare Function CPM100_PDOTxType Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wCobId As Integer, _ ByVal bTxtype As Byte) As Integer Declare Function CPM100_SetEventTimer Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal wCobId As Integer, _ ByVal wEventTimer As Integer) As Integer Declare Function CPM100_ChangePDOCobID Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal old_wCobID As Integer, _ ByVal new_wCobID As Integer) As Integer Declare Function CPM100_PDORemote Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal wCobId As Integer, pRDatalen As Byte, _ bRData As Byte, dwUpperTime As Long, dwLowerTime As Long) As Integer Declare Function CPM100_PDOWrite Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal wCobId As Integer, ByVal bOffset As Byte, _ ByVal bTDataLen As Byte, bTData As Byte) As Integer Declare Function CPM100_ReadPDOCount Lib "cpm100.dll" (ByVal bBoardNo As Byte) As Integer Declare Function CPM100_ReadPDOMessage Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, wCobId As Integer, pRDatalen As Byte, _ bRData As Byte, dwUpperTime As Long, dwLowerTime As Long) As Integer Declare Function CPM100_WriteDO Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal bDOChannel As Byte, _ ByVal bValue As Byte) As Integer Declare Function CPM100_WriteAO Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal bAOChannel As Byte, _ ByVal wValue As Integer) As Integer Declare Function CPM100_ReadDI Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal bDIChannel As Byte, _ bValue As Byte) As Integer Declare Function CPM100_ReadAI Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, ByVal bAIChannel As Byte, _ wValue As Integer) As Integer Declare Function CPM100_COBIDInfo Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal bNodeID As Byte, wSYNCID As Integer, _ wEMCYID As Integer, bRxPDONum As Byte, wRxPDOID As Integer, _ bTxPDONum As Byte, wTxPDOID As Integer) As Integer Declare Function CPM100_PDOMappingInfo Lib "cpm100.dll" _ (ByVal bBoardNo As Byte, ByVal wCobId As Integer, bRxTxType As Byte, _ bPDONo As Byte, bPDOEntry As Byte, bLen As Byte, bRxData As Byte, _ bMappingData As Byte) As Integer