Home

English - PEAK

image

Contents

1. 50 Documentation User Guide System o Note It is assumed that the channel was already initialized C TPCANTPStatus result Check the status of the PCI Channel result CANTP GetStatus PCIBUS1 switch result case PCANTP ERROR BUSLIGHT MessageBox NULL PCAN PCI Ch 1 Handling a BUS LIGHT Statius Success MB OK break case PCANT PE RROR B USHEAVY MessageBox NULL UPCAN PCI Ghi21 3 Handling a BUS HEAVY satus s t Success MB OK break case PCANTP ERROR BUSOFF MessageBox NULL PCAN PCI Ch 1 Handling a BUS OFF status Success MB OK break case PCANTP ERROR OK MessageBox NULL PCAN PCI Ch 1 Status is OK Success MB OK break default An error occurred MessageBox NULL Failed to retrieve status Error MB OK break T See also TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Class method Version GetStatus 3 7 9 CANTP Read Reads a CAN ISO TP message from the receive queue of a PCANTP Channel Syntax C TPCANTPStatus _ stdcall CANTP Read TPCANTPHandle CanChannel TPCANTPMsg MessageBuffer TPCANTPTimestamp TimestampBuffer DEF ARG Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Message Buffer A TPCANTPMsg buffer to store the CAN ISO TP mess
2. CLR DIlImport PCAN ISO TP dll EntryPoint CANTP GetValue static TPCANTPStatus GetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter MarshalAs UnmanagedType LPArray 3 66 a PCAN ISO TP API Documentation User Guide System UInt32 BufferLength Visual Basic lt DIllmport PCAN ISO TP dll EntryPoint CANTP_GetValue gt _ Public Shared Function GetValue _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle _ lt MarshalAs UnmanagedType U1 gt _ ByVal Parameter As TPCANTPParameter _ ByVal Buffer As Byte _ ByVal BufferLength As Ulnt32 As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Parameter The code of the value to be set see TPCANTPParameter on page 30 Buffer The buffer containing the array value to retrieve BufferLength The length in bytes of the given buffer Returns The return value is a TPCANTPStatus code PCANTP_ERROR_OK is returned on success The typical errors in case of failure are PCANTP_ERROR_NOT_INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application POBDII ERROR WRONG PARAM Indicates that the parameters passed to the metho
3. a PCAN ISO TP API Documentation User Guide System An error occurred MessageBox 0 error ocured Error MB OK Here can be decided if the loop has to be terminated bStop HandleReadError result end until bStop true end See also Write on page 78 Plain function version CANTP_Read 3 6 19 Read TPCANTPHandle TPCANTPMsg TPCANTPTimestamp Reads a CAN ISO TP message and its timestamp from the receive queue of a PCANTP Channel Syntax Pascal OO class function Read CanChannel TPCANTPHandle var MessageBuffer TPCANTPMsg TimestampBuffer PTPCANTPTimestamp TPCANTPStatus overload C DllImport PCAN ISO TP dll EntryPoint CANTP Read public static extern TPCANTPStatus Read MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel out TPCANTPMsg MessageBuffer out TPCANTPTimestamp TimestampBuffer C CLR DIllmport PCAN ISO TP dll EntryPoint CANTP Read static TPCANTPStatus Read MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel TPCANTPMsg MessageBuffer TPCANTPTimestamp 96 TimestampBuffer Visual Basic Dllimport PCAN ISO TP diI EntryPoint CANTP_Read gt _ Public Shared Function Read _ MarshalAs UnmanagedType U2 _ ByVal CanChannel As TPCANTPHandle _ ByRef MessageBuffer As TPCANTPMsg _ ByRef TimestampBuffer As TPCANTPTimestamp As TPCANTPStatus 75 E PCAN ISO TP API
4. a PCAN ISO TP API Documentation User Guide System MessageBox Show Failed to add second mapping Visual Basic Dim CanChannel As TPCANTPHandle CanTpApi PCANTP_USBBUS1 Dim result As TPCANTPStatus Dim As Byte amp HD1 Dim SA As Byte amp HF1 Dim N TA As Byte amp H30 Dim RA As Byte amp HO adds a mapping to transmit functionally addressed messages result CanTpApi AddMapping CanChannel _ CanTpApi CAN ID NO MAPPING TPCANTPIdType PCANTP ID CAN 11BIT TPCANTPFormatType PCANTP FORMAT NORMAL _ TPCANTPMessageType PCANTP MESSAGE DIAGNOSTIC _ N SA N TA TPCANTPAddressingType PCANTP ADDRESSING FUNCTIONAL N RA If result TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to add mapping png removes the mapping result CanTpApi RemoveMapping 1 If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to add second mapping End If Pascal OO var CanChannel TPCANTPHandle result TPCANTPStatus canld Byte N SA Byte N TA Byte N RA Byte begin CanChannel USBBUS1 canld 501 SA SF1 N_TA 30 N_RA 00 adds a mapping to transmit functionally addressed messages result TCanTpApi AddMapping CanChannel canld TCanTpApi CAN_ID_NO_MAPPING PCANTP ID CAN 11BIT PCAN
5. 42 E PCAN ISO TP API Documentation User Guide System Release channel CanTpApi Uninitialize CanTpApi PCANTP PCIBUS2 Visual Basic Dim result As TPCANTPStatus The Plug amp Play Channel PCAN PCI is initialized result CanTpApi Initialize CanTpApi PCANTP PCIBUS2 TPCANTPBaudrate PCANTP BAUD 500K If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Initialization failed Else MessageBox Show PCAN PCI Ch 2 was initialized End Release channel CanTpApi Uninitialize CanTpApi PCANTP PCIBUS2 Pascal OO var result TPCANTPStatus begin The Plug amp Play Channel PCAN PCI is initialized result TCanTpApi Initialize TCanTpApi PCANTP PCIBUS2 BAUD 500 if result lt gt PCANTP ERROR OK then MessageBox 0 Initialization failed MB OK else MessageBox 0 Ch 2 was initialized MB OK Release channel TCanTpApi Uninitialize TCanTpApi PCANTP PCIBUS2 end See also Initialize on page 35 Plain function version CANTP Uninitialize 3 6 5 SetValue Sets a configuration or information value within a PCANTP Channel Overloads Function Description in SetValue TPCANTPHandle Sets a configuration or information numeric value within a PCANTP Channel TPCANTPParameter UInt32 UInt32 SetValue TPCANTPHandle Sets a configuratio
6. TPCANTPHandle CanChannel CanTpApi PCANTP USBBUS1 TPCANTPStatus result byte canId OxD1 byte SA OxFl1 byte N TA 0x30 byte N RA 0x00 adds a mapping to transmit functionally addressed messages result CanTpApi AddMapping CanChannel CanTpApi CAN ID NO MAPPING TPCANTPIdType PCANTP ID CAN 11BIT TPCANTPFormatType PCANTP FORMAT NORMAL TPCANTPMessageType PCANTP MESSAGE DIAGNOSTIC N SA N TA TPCANTPAddressingType PCANTP ADDRESSING FUNCTIONAL N RA if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Failed to add mapping removes the mapping result CanTpApi RemoveMapping CanChannel if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Failed to remove mapping CLR TPCANTPHandle CanChannel CanTpApi PCANTP USBBUS1 TPCANTPStatus result Byte 0 Byte N SA OxF1 Byte N TA 0x30 Byte N RA 0x00 adds a mapping to transmit functionally addressed messages result CanTpApi AddMapping CanChannel canId CanTpApi CAN ID NO MAPPING PCANTP ID CAN 11BIT PCANTP FORMAT NORMAL PCANTP MESSAGE DIAGNOSTIC N SA N TA PCANTP ADDRESSING FUNCTIONAL N RA if result PCANTP ERROR OK MessageBox Show Failed to add mapping removes the mapping result CanTpApi RemoveMapping CanChannel canId if result PCANTP ERROR OK L 59
7. DIllmport PCAN ISO TP dll EntryPoint CANTP_GetValue static TPCANTPStatus GetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter UInt32 NumericBuffer UInt32 BufferLength Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint CANTP_GetValue gt _ Public Shared Function GetValue _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle _ lt MarshalAs UnmanagedType U1 gt _ ByVal Parameter As TPCANTPParameter _ ByRef NumericBuffer As Ulnt32 _ ByVal BufferLength As Ulnt32 As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Parameter The code of the value to retrieve see TPCANTPParameter on page 30 NumericBuffer The buffer to return the required numeric value 64 E PCAN ISO TP API Documentation User Guide System Parameters Description BufferLength The length in bytes of the given buffer Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel was not found in the list of initialized channels of the calling application PCANTP ERROR WRONG PARAM Indicates that the parameters passed to the method are invalid Check the value of Parameter and asser
8. Public Enum TPCANTPStatus As Integer PCANTP ERROR OK amp HO PCANTP ERROR NOT INITIALIZED amp H1 PCANTP ERROR ALREADY INITIALIZED amp H2 PCANTP ERROR NO MEMORY amp H3 PCANTP ERROR OVERFLOW amp H4 PCANTP ERROR TIMEOUT amp H6 PCANTP ERROR NO MESSAGE amp H7 PCANTP ERROR WRONG PARAM amp H8 PCANTP ERROR BUSLIGHT amp H9 PCANTP ERROR BUSHEAVY PCANTP ERROR BUSOFF amp HB PCANTP ERROR CAN ERROR amp H80000000 End Enum 18 PCAN ISO TP API Documentation User Guide System Remarks The PCANTP ERROR CAN ERROR status is a generic error code that is used to identify PCAN Basic errors as PCAN Basic API is used internally by the PCAN ISO TP API When a PCAN Basic error occurs the API performs a bitwise combination of the PCANTP ERROR CAN ERROR and the PCAN Basic TPCANStatus error Values Name PCANTP ERROR OK PCANTP ERROR NOT INITIALIZED PCANTP ERROR ALREADY INITIALIZED PCANTP ERROR NO MEMORY PCANTP ERROR OVERFLOW PCANTP ERROR TIMEOUT PCANTP ERROR NO MESSAGE value 0x00000 000000 0x00001 000001 0x00002 000002 0x00003 000003 0x00004 000004 0x00006 000006 0x00007 000007 PCANTP ERROR WRONG PARAM 0x00008 000008 PCANTP ERROR BUSLIGHT 0x00009 000009 PCANTP ERROR BUSHEAVY 0x0000A 000010 PCANTP ERROR BUSOFF 0x0000B 000011 PCANTP ERROR CAN ERROR 0x80000000 2147483648 3 5 3 TPCANTPBaudrate Description No error Success Not init
9. PCANTP FORMAT UNKNOWN OxFF PCANTP FORMAT NORMAL 0x01 PCANTP FORMAT FIXED NORMAL 0x02 PCANTP FORMAT EXTENDED 0x03 PCANTP FORMAT MIXED 0x04 PCANTP FORMAT ENHANCED 0x05 Visual Basic Public Enum TPCANTPFormatType As Byte PCANTP FORMAT UNKNOWN amp HFF PCANTP FORMAT NORMAL amp HO1 PCANTP FORMAT FIXED NORMAL amp HO2 PCANTP FORMAT EXTENDED amp H03 PCANTP FORMAT MIXED amp H04 PCANTP FORMAT ENHANCED amp HO5 End Enum 26 PCAN ISO TP API Documentation User Guide Values Name Value Description PCANTP FORMAT UNKNOWN 255 Unknown addressing format PCANTP FORMAT NORMAL Normal addressing format PCANTP FORMAT FIXED NORMAL Fixed Normal addressing format PCANTP FORMAT EXTENDED Extended addressing format PCANTP FORMAT MIXED Mixed Addressing format OW Bl Wl MN PCANTP_FORMAT_ENHANCED See also TPCANTPMsg on page 12 See also Primary language ID CANTP_AddMapping on page 89 3 5 8 TPCANTPAddressingType Represents the format addressing type of CAN ISO TP messages Syntax C Enhanced addressing format defined in ISO 15765 3 System define TPCANTPAddressingType BYTE define PCANTP_ADDRESSING_UNKNOWN 0x00 define PCANTP_ADDRESSING_PHYSICAL 0x01 define PCANTP_ADDRESSING_FUNCTIONAL 0x02 Pascal OO Z1 TPCANTPAddressingType PCANTP ADDRESSING UNKNOWN 00 PCANTP ADDRESSING
10. else MessageBox Show bufferArray ToString Visual Basic Dim CanChannel As TPCANTPHandle CanTpApi PCANTP USBBUSI Dim result As TPCANTPStatus Dim bufferLength As UInt32 2 Dim bufferArray bufferLength As Byte Get the value of the ISO TP Separation Time STmin parameter result CanTpApi GetValue CanChannel TPCANTPParameter PCANTP PARAM SEPERATION TIME _ bufferArray Convert ToUInt32 bufferLength If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to get value Else MessageBox Show bufferArray 0 ToString End Pascal OO var CanChannel TPCANTPHandle result TPCANTPStatus bufferArray array 0 1 of Byte begin CanChannel USBBUS1 Get the value of the ISO TP Separation Time STmin parameter result TCanTpApi GetValue CanChannel SEPERATION TIME PLongWord bufferArray Length bufferArray if result PCANTP ERROR OK then MessageBox 0 Failed to get value MB OK else MessageBox 0 PAnsiChar AnsiString Format STmin 96d Integer bufferArray 0 Success end See also SetValue on page 43 TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Plain function version CANTP GetValue 68 PCAN ISO TP API Documentation User Guide 3 6 16 Getstatus Sys
11. See also Parameter Value Defintions on page 100 34 PCAN ISO TP API Documentation User Guide 3 6 Methods System The methods defined for the classes CanTpApi on page 10 and TCanTpApi on page 11 are divided in 4 groups of functionality Note These methods are static and can be called in the name of the class without instantiation Connection Function a Initialize c Uninitialize Configuration Function ay SetValue ay e AddMapping RemoveMapping Information Function GetValue GetStatus GetErrorText Communication Function ay Read ay E Write ay E Reset 3 6 1 Initialize Initializes a PCANTP Channel Overloads Function Description Initializes a PCANTP channel Uninitializes a PCANTP channel Description Sets a configuration or information value within a PCANTP Channel Configures the ISO TP mapping between a CAN ID and an ISO TP network addressing information Removes a previously configured ISO TP mapping Description Retrieves information from a PCANTP Channel Retrieves the current BUS status of a PCANTP Channel Gets a descriptive text for an error code Description Reads a CAN message from the receive queue of a PCANTP Channel Transmits a CAN message using a connected PCANTP Channel Resets the receive and transmit queues of a PCANTP Channel Description Initialize TPCANTPHandle TPCANTPBaudrate Initializes a Plug And Play PCANTP Channel In
12. 32 E PCAN ISO TP API Documentation User Guide System PCANTP PARAM CHANNEL CONDITION Access RI Description This parameter is used to check and detect available PCAN hardware on a computer even before trying to connect any of them This is useful when an application wants the user to select which hardware should be using in a communication session Possible values This parameter can have one of these values PCANTP_CHANNEL_UNAVAILABLE PCANTP_CHANNEL_AVAILABLE PCANTP_CHANNEL_OCCUPIED Default value NA PCAN Device All PCAN devices excluding PCAN_NONEBUS channel o Note It is not needed to have a PCAN channel initialized before asking for its condition PCANTP PARAM WFT MAX Access m W Description This parameter is used to set the maximum number of FlowControl Wait frame transmission N_WFTmax parameter defined in the ISO TP standard it indicates how many FlowControl frames with the Wait status can be transmitted by a receiver in a row Possible value Any positive number Default value PCANTP_WFT_MAX_DEFAULT 0x10 PCAN Device NA Any PCAN device can be used including the PCANTP_NONEBUS channel Note Also this parameter is set globally channels will use the value set when they are initialized so it is possible to define different values of N WFTmax on separate channels Consequently once a channel is initialized changing the WFTmax parameter will not affect that channel PCANTP PARAM
13. Length request DATA request MSGTYPE PCANTP_MESSAGE_DIAGNOSTIC request IDTYPE ID CAN 11BIT request FORMAT PCANTP FORMAT EXTENDED request SA Sf1 request TA 57 PCANTP ADDRESSING PHYSICAL request RA 00 The message is sent using the PCAN USB result TCanTpApi Write TCanTpApi PCANTP_USBBUS1 request if result PCANTP ERROR OK then begin Loop until the transmission confirmation is received repeat result TCanTpApi Read TCanTpApi PCANTP_USBBUS1 request MessageBox 0 PAnsiChar AnsiString Format Read 96d type d result d Integer result Integer request MSGTYPE Integer request RESULT Error MB until result ERROR MESSAGE end else An error occurred MessageBox 0 PAnsiChar AnsiString Format Error occured Integer result Error MB end See also Read on page 72 81 PCAN ISO TP API Documentation User Guide Plain function version CANTP Read 3 6 21 Reset Resets the receive and transmit queues of a PCANTP Channel Syntax Pascal OO System class function Reset CanChannel TPCANTPHandle TPCANTPStatus Ci DllImport PCAN ISO TP dll EntryPoint CANTP_Reset public static extern TPCANTPStatus Reset MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel C CLR DIlImport PCAN ISO TP dll EntryPoin
14. Any Any Any Any PCANTP_FORMAT_MIXED PCANTP_ID_CAN PCANTP_MESSAGE_REMOTE_DIAGNOSTIC Any Any _11BIT When target type is functional addressing there is no need to define a CAN ID response since responses from functional addressing will be physically addressed The definition value CAN_ID_NO_MAPPING can be used to fill the canldResponse parameter in those cases o Note The formats PCANTP FORMAT FIXED NORMAL PCANTP FORMAT ENHANCED requires 29 bits CAN ID and do not need mappings to be defined see ISO TP network addressing format for more information Example The following example defines two CAN ID mappings in order to receive and transmit ISO TP messages using 11 bit CAN Identifiers with MIXED format addressing Note It is assumed that the channel was already initialized C TPCANTPHandle CanChannel TPCANTPStatus result PCANTP_USBBUS1 BYTE canId 0 BYTE canIdResponse 0xD2 BYTE N SA OxF1 BYTE N TA 0x13 BYTE N RA 0x52 Define a first mapping to allow communication from Source 0 1 to Destination 0x13 result PCANTP FORMAT MIXED PCANTP ADDRESSING PHYSICAL N RA if result PCANTP ERROR OK MessageBox NULL Failed to add first mapping Error MB OK Define a second mapping to allow communication from Destination 0x13 to Source 0 1 PCANTP ID CAN 11 N SA N TA CANTP AddMapping CanChannel canIdResponse PCANTP MESSAGE REMOTE
15. Byte PCANTP_ID_CAN_11BIT 0x01 PCANTP ID CAN 29BIT 0x02 Visual Basic Public Enum TPCANTPIdType As Byte PCANTP ID CAN 11BIT amp H1 PCANTP ID CAN 29BIT amp H2 End Enum values Name Value Description PCANTP ID CAN 11Bit 1 Standard CAN ID 11 bit identifier PCANTP ID CAN 29Bit 2 Extended CAN ID 29 bit identifier See also TPCANTPMsg on page 12 See also Primary language ID CANTP_AddMapping on page 89 3 5 7 TPCANTPFormatType Represents the format addressing type of CAN ISO TP messages Syntax C define TPCANTPFormatType BYTE define PCANTP_FORMAT_UNKNOWN OxFF define PCANTP_FORMAT_NORMAL 0x01 define PCANTP_FORMAT_FIXED_NORMAL 0x02 define PCANTP_FORMAT_EXTENDED 0x03 PCAN ISO TP API Documentation User Guide define FORMAT MIXED 0x04 define FORMAT ENHANCED 0x05 System Pascal OO 571 TPCANTPFormatType PCANTP FORMAT UNKNOWN SFF PCANTP FORMAT NORMAL S01 PCANTP FORMAT FIXED NORMAL 02 PCANTP FORMAT EXTENDED 503 PCANTP FORMAT MIXED 04 PCANTP FORMAT ENHANCED 505 Ci public enum TPCANTPFormatType byte PCANTP_FORMAT_UNKNOWN OxFF PCANTP_FORMAT_NORMAL 0x01 PCANTP FORMAT FIXED NORMAL 0x02 PCANTP FORMAT EXTENDED 0x03 PCANTP FORMAT MIXED 0x04 PCANTP FORMAT ENHANCED 0x05 C CLR public enum class TPCANTPFormatType Byte
16. User Guide System Type Constant value Description i3 TPCANTPHandle PCANTP_USBBUS3 0x53 PCAN USB interface channel 3 i33 TPCANTPHandle PCANTP_USBBUS4 0x54 PCAN USB interface channel 4 21 TPCANTPHandle PCANTP USBBUS5 0x55 PCAN USB interface channel 5 ij TPCANTPHandle PCANTP_USBBUS6 0x56 PCAN USB interface channel 6 34 TPCANTPHandle PCANTP USBBUS7 0x57 PCAN USB interface channel 7 TPCANTPHandle PCANTP_USBBUS8 0x58 PCAN USB interface channel 8 Handles for the PC Card Bus Type Constant value Description i33 TPCANTPHandle PCANTP_PCCBUS1 0x61 PCAN PC Card interface channel 1 212 TPCANTPHandle PCANTP_PCCBUS2 0x62 PCAN PC Card interface channel 2 Remarks o Note These definitions are constants values in an object oriented environment Delphi NET Framework and declared as defines in C and Pascal plain Hardware Type and Channels Not Plug amp Play The hardware channels of this kind are used as registered This mean for example it is allowed to register the ISABUS3 without having registered PCANTP 15 1 and ISA2 It is a decision of each user how to associate a PCAN Channel logical part and a port interrupt pair physical part Plug amp Play For hardware handles of PCI USB and PC Card the availability of the channels is determined by the count of hardware connected to a computer in a given moment in conjunction with their internal handle This means that hav
17. FORMAT MIXED PCANTP MESSAGE REMOTE DIAGNOSTIC TA N SA PCANTP ADDRESSING PHYSICAL N RA if result PCANTP ERROR OK MessageBox Show Failed to add second mapping 56 PCAN ISO TP Documentation User Guide System Visual Basic Dim CanChannel As TPCANTPHandle CanTpApi PCANTP USBBUSI Dim result As TPCANTPStatus Dim As Byte amp HD1 Dim canIdResponse As Byte amp HD2 Dim SA As Byte amp HF1 Dim N TA As Byte amp H13 Dim N RA As Byte amp H52 Define a first mapping to allow communication from Source amp HF1 to Destination amp H13 result CanTpApi AddMapping CanChannel canIdResponse TPCANTPIdType PCANTP ID CAN 11BIT TPCANTPFormatType PCANTP FORMAT MIXED TPCANTPMessageType PCANTP MESSAGE REMOTE DIAGNOSTIC N SA N TA R TPCANTPAddressingType PCANTP ADDRESSING PHYSICAL N_RA If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to add first mapping Eng Define a second mapping to allow communication from Destination amp H13 to Source amp HF1 result CanTpApi AddMapping CanChannel canIdResponse TPCANTPIdType PCANTP ID CAN 11BIT TPCANTPFormatType PCANTP FORMAT MIXED TPCANTPMessageType PCANTP MESSAGE REMOTE DIAGNOSTIC N TA N SA TPCANTPAddressingType PCANTP ADDRESSING PHYSICAL N RA If
18. PCAN ISO TP API Documentation User Guide System Remarks The CanTpApi class collects and implements the PCAN ISO TP API functions Each method is called just like the API function with the exception that the prefix CANTP is not used The structure and functionality of the methods and API functions are the same Within the NET Framework from Microsoft the CanTpApi class is a static not inheritable class It can must directly be used without any instance of it e g TPCANTPStatus res Static use without any instance res CanTpApi Initialize CanTpApi PCANTP USBBUS1 TPCANTPBaudrate PCANTP BAUD 500 Note This class under Delphi is called TCanTpApi See also Methods on page 35 Definitions on page 99 3 3 2 TCanTpApi Defines a class which represents the PCAN ISO TP API for using within the Delphi programming environment Syntax Pascal OO TCanTpApi class Remarks TCanTpApi is a class containing only class methods and constant members allowing their use without the creation of any object just like a static class of another programming languages It collects and implements the PCAN ISO TP API functions Each method is called just like the API function with the exception that the prefix not used The structure and functionality of the methods and API functions are the same o Note This class under NET framework is called CanTpApi See also Methods on page 35
19. PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application PCANTP ERROR WRONG PARAM Indicates that the parameters passed to the method are invalid Check the value of Parameter and assert it is compatible with an integer buffer Remarks Use the method SetValue to set configuration information or environment values of a PCANTP Channel Note Any calls with non ISO TP parameters ie TPCANTPParameter will be forwarded to PCAN Basic API More information about the parameters and values that can be set can be found in Parameter Value Definitions Since most of the ISO TP parameters require a numeric value byte or integer this is the most common and useful override Example The following example shows the use of the function CANTP SetValue on the channel PCIBUS2 to enable debug mode Note It is assumed that the channel was already initialized C TPCANTPStatus result unsigned int iBuffer 0 Enable CAN DEBUG mode iBuffer PCANTP DEBUG CAN result CANTP SetValue PCANTP 052 PCANTP PARAM DEBUG amp iBuffer sizeof unsigned int if result PCANTP ERROR OK 87 50 Documentation User Guide System Mess
20. PCANTP N TIMEOUT Cr amp H03 WRONG SN amp H04 PCANTP INVALID FS amp HO5 PCANTP UNEXP PDU amp H06 PCANTP N WFT OVRN amp HO7 PCANTP BUFFER OVFLW amp H08 PCANTP ERROR amp HO9 End Enum 29 PCAN ISO TP API Documentation User Guide Values Name Value System Description OK No network error TIMEOUT A Timeout occured between 2 frames transmission sender and receiver side PCANTP N TIMEOUT Bs 2 Sender side timeout while waiting for flow control frame PCANTP N TIMEOUT Cr 3 Receiver side timeout while waiting for consecutive frame PCANTP N WRONG SN 4 Unexpected sequence number PCANTP N INVALID FS 5 Invalid or unknown FlowStatus PCANTP N UNEXP PDU 6 Unexpected protocol data unit PCANTP N WFT OVRN 7 Reception of flow control WAIT frame that exceeds the maximum counter defined by PARAM WFT PCANTP N BUFFER OVFLW 8 Buffer on the receiver side cannot store the data length server side only PCANTP N ERROR 9 General error See also TPCANTPMsg on page 12 3 5 10 TPCANTPParameter Represents a PCAN ISO TP parameter or a PCAN ISO TP Value that can be read or set According with the programming language this type can be a group of defined values or an enumeration With some exceptions a channel must first be initialized before their parameters can be read or set Syntax
21. PCANTP TYPE DNG SJA PCAN Dongle SJA1000 PCANTP TYPE DNG SJA EPP PCAN Dongle EPP SJA1000 A Oje See also PCANTP_Initialize class method initialize 3 5 5 TPCANTPMessageType Represents the type of PCAN ISO TP messages ISO TP defines 2 types of message diagnostic and remote diagnostic the API adds two more for information purpose Syntax C define TPCANTPMessageType BYTE define PCANTP_MESSAGE_UNKNOWN 0x00 define PCANTP_MESSAGE_DIAGNOSTIC 0x01 define PCANTP_MESSAGE_REMOTE_DIAGNOSTIC 0x02 ttdefine PCANTP_MESSAGE_REQUEST_CONFIRMATION 0x03 define MESSAGE INDICATION 0x04 Pascal OO 21 TPCANTPMessageType PCANTP MESSAGE UNKNOWN 00 PCANTP MESSAGE DIAGNOSTIC 501 PCANTP MESSAGE REMOTE DIAGNOSTIC 502 PCANTP MESSAGE REQUEST CONFIRMATION 503 PCANTP MESSAGE INDICATION 04 Ci public enum TPCANTPMessageType byte PCANTP MESSAGE UNKNOWN 0x00 PCANTP MESSAGE DIAGNOSTIC 0x01 23 a 150 Documentation User Guide System PCANTP MESSAGE REMOTE DIAGNOSTIC 0x02 PCANTP MESSAGE REQUEST CONFIRMATION 0x03 PCANTP MESSAGE INDICATION 0x04 C CLR public enum class TPCANTPMessageType Byte PCANTP MESSAGE UNKNOWN 0x00 PCANTP MESSAGE DIAGNOSTIC 0x01 PCANTP MESSAGE REMOTE DIAGNOSTIC 0x02 PCANTP MESSAGE REQUEST CONFIRMATION 0x03 PCA
22. The Write function do not actually send the ISO TP message the transmission is asynchronous Should a message fail to be transmitted it will be added to the reception queue with a specific network error code in the RESULT value of the TPCANTPMsg Example The following example shows the use of the function CANTP Write on the channel PCANTP_USBBUS1 It then waits until a confirmation message is received Depending on the result a message will be shown to the user Note It is assumed that the channel was already initialized and mapping were configured C TPCANTPStatus result prepare an 11bit CAN ID physically addressed using extended format and extended addressing ISO TP message containing 4095 BYTEs of data TPCANTPMsg request char strMsg 256 request LEN 4095 request MSGTYPE PCANTP MESSAGE DIAGNOSTIC request IDTYPE PCANTP ID CAN 11 request FORMAT PCANTP FORMAT EXTENDED request SA 0 1 request TA 0 7 request TA TYPE PCANTP ADDRESSING PHYSICAL request RA 0x00 The message is sent using the PCAN USB result CANTP Write USBBUS1 amp request if result PCANTP ERROR OK 96 PCAN ISO TP API Documentation User Guide System Loop until the transmission confirmation is received do result CANTP USBBUS1 amp request sprintf strMsg Read td
23. _ ByVal remoteAddr As Byte As TPCANTPStatus 54 E PCAN ISO TP API Documentation User Guide System End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 The CAN Identifier to be mapped canldReponse The CAN Identifier that is used to respond to a request with the CAN Id canld canldType The type of CAN identifier formatType The format type of the ISO TP network addressing information msgType The ISO TP message type sourceAddr The source address targetAddr The target address targetType The type of the target remoteAddr The remote address Returns The return value is aTPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application PCANTP ERROR ALREADY INITIALIZED A mapping with the same CAN ID already exists PCANTP ERROR WRONG PARAM Mapping is not valid in regards to ISO TP standard PCANTP ERROR NO MEMORY Failed to allocate memory to define mapping Remarks The following table summarizes requirements to get a valid mapping based on the addressing format type FormatType parameter Valid valid msgType parameter valid Valid canIdType targetType remoteAddr parameter parameter PCANTP FOR
24. type d result d result request MSGTYPE request RESULT MessageBox NULL strMsg Error MB OK while result PCANTP ERROR NO MESSAGE else An error occurred sprintf strMsg Error occured d result MessageBox NULL strMsg Error MB OK See also CANTP Read on page 94 Class method Version Read 3 7 11 CANTP Reset Resets the receive and transmit queues of a PCANTP Channel Syntax C TPCANTPStatus _ stdcall CANTP Reset TPCANTPHandle CanChannel Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Parameter The code of the value to be set see TPCANTPParameter on page 30 NumericBuffer The buffer containing the string value to be set BufferLength The length in bytes of the given buffer Returns The return value is a TPCANTPStatus code PCANTP_ERROR_OK is returned on success The typical errors in case of failure are PCANTP_ERROR_NOT_INITIALIZED Indicates that the given PCANTP channel was not found in the list of initialized channels of the calling application Remarks Calling this method ONLY clear the queues of a Channel A reset of the CAN controller doesn t take place Example The following example shows the use of the function CANTP_ Reset on the channel PCANTP_PCIBUS1 Depending on the result a message will be shown to the user Note It is assumed that the channel wa
25. BAUD 125K amp H31C PCANTP BAUD 100K amp H432F PCANTP BAUD 95K amp C34E PCANTP BAUD 83K amp 852B PCANTP BAUD 50K amp H472F PCANTP BAUD 47K amp 1414 PCANTP BAUD 33K amp 8B2F PCANTP BAUD 20K amp H532F PCANTP BAUD 10K amp H672F PCANTP BAUD 5K amp H7F7F End Enum values Name value Description PCANTP BAUD 1M 20 1 MBit s PCANTP BAUD 800K 22 800 kBit s BAUD 500 28 500 kBit s PCANTP BAUD 250K 284 250 kBit s PCANTP BAUD 125K 796 125 kBit s BAUD 100 17199 100 kBit s BAUD 95K 49998 95 238 kBit s PCANTP BAUD 83K 34091 83 333 kBit s PCANTP BAUD 50K 18223 50 kBit s PCANTP BAUD 47K 5140 47 619 kBit s PCANTP BAUD 33K 35631 33 333 kBit s PCANTP BAUD 20K 21295 20 kBit s PCANTP BAUD 10K 26415 10 kBit s PCANTP BAUD 5K 32639 5 kBit s See also CANTP_Initialize on page 84 class method initialize 3 5 4 Represents the type of PCAN not plug amp play hardware to be initialized According with the programming language this type can be a group of defined values or an enumeration syntax C define TPCANTPHWType BYTE L2 PCAN ISO TP API Documentation User Guide define TYPE ISA 0x01 define TYPE ISA SJA Ox09 define PCANTP TYPE ISA PHYTEC 0x04 define PCANTP TYPE DNG 0x02 define TYPE EPP 0x03 define TYP
26. CH Syntax public enum TPCANTPParameter byte PCANTP_PARAM_BLOCK_SIZE OxE1 PCANTP_PARAM_SEPERATION_TIME OxE2 PCANTP_PARAM_DEBUG OxE3 PCANTP_PARAM_CHANNEL_CONDITION 4 PCANTP_PARAM_WEFT_MAX 5 PCANTP_PARAM_MSG_PENDING OxE6 PCANTP_PARAM_API_VERSION OxE7 PCANTP PARAM CAN DATA PADDING OxE8 PCANTP RECEIVE EVENT OxEA CLR public enum TPCANTPParameter Byte PCANTP_PARAM_BLOCK_SIZE OxE1 PCANTP_PARAM_SEPERATION_TIME OxE2 PCANTP_PARAM_DEBUG OxE3 PCANTP_PARAM_CHANNEL_CONDITION OxE4 PCANTP_PARAM_WEFT_MAX 5 PCANTP_PARAM_MSG_PENDING OxE6 30 PCAN ISO TP API Documentation User Guide PCANTP PARAM VERSION OxE7 PCANTP PARAM CAN DATA PADDING OxE8 PCANTP RECEIVE EVENT OxEA System C Syntax define PCANTP_PARAM_BLOCK_SIZE OxE1 define PCANTP_PARAM_SEPERATION_TIME OxE2 define PCANTP_PARAM_DEBUG OxE3 define PCANTP_PARAM_CHANNEL_CONDITION OxE4 define PCANTP_PARAM_WFT_MAX OxE5 define PCANTP_PARAM_MSG_PENDING OxE6 define PCANTP_PARAM_API_VERSION OxE7 define PCANTP_PARAM_CAN_DATA_PADDING OxE8 define PCANTP_PARAM_RECEIVE_EVENT OxEA Pascal OO Z1 TPCANTPParameter BLOCK SIZE SE1 PCANTP PARAM SEPERATION TIME SE2 PCANTP PARAM DEBUG SE3 PCANTP PARAM CHANNEL CONDITION SE4 PCANTP PARAM MAX 5 5 PCANTP
27. MSG PENDING Access WH Description This parameter is used to define if the API should filter notifications of pending CAN TP messages fragmented CAN frames either during reception and transmission are notified by the API with a CAN TP message with the type PCANTP_MESSAGE_INDICATION If enabled the function CANTP_Read will also return messages with this type Possible values PCANTP_MSG_PENDING_HIDE enables message indication filtering while PCANTP_MSG_PENDING_SHOW disables it Default value PCANTP_MSG_PENDING_HIDE PCAN Device All PCAN devices excluding PCANTP_NONEBUS channel 33 E PCAN ISO TP API Documentation User Guide System PCANTP PARAM API VERSION Access RI Description This parameter is used to get information about the PCAN ISO TP API implementation version Possible values The value is a null terminated string indication the version number of the API implementation The returned text has the following form x x x x for major minor release and build It represents the binary version of the API within two 32 bit integers defined by four 16 bit integers The length of this text value will have a maximum length of 24 bytes 5 bytes for represent each 16 bit value three separator characters and the null termination Default value NA PCAN Device NA Any PCAN device can be used including the PCANTP_NONEBUS channel PCANTP CAN DATA PADDING Access T Desc
28. NOT INITIALIZED Indicates that the given PCANTP channel was not found in the list of initialized channels of the calling application PCANTP ERROR WRONG Indicates that the parameters passed to the method are invalid Check the value of Parameter and assert it is compatible with a string buffer Example The following example shows the use of the function CANTP GetValue on the channel PCANTP USBBUS1 to retrieve the ISO TP separation time value STmin Depending on the result a message will be shown to the user Note It is assumed that the channel was already initialized C TPCANTPHandle CanChannel PCANTP USBBUS1 TPCANTPStatus result unsigned int iBuffer 0 char strMsg 256 92 E PCAN ISO TP API Documentation User Guide System Get the value of the ISO TP Separation Time STmin parameter result CANTP GetValue CanChannel PCANTP PARAM SEPERATION TIME amp iBuffer sizeof unsigned int if result PCANTP ERROR OK MessageBox NULL Failed to get value Error MB OK else sprintf strMsg Sd iBuffer MessageBox NULL strMsg Success See also CANTP_SetValue on page 87 TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Class method Version Get Value 3 7 8 CANTP_GetStatus Gets the current BUS status of a PCANTP Channel Syntax C TPCANTPStatus stdcall CANTP GetSt
29. PARAM MSG PENDING SE6 PCANTP PARAM API VERSION SE7 PCANTP PARAM CAN DATA PADDING SE8 PCANTP PARAM RECEIVE EVENT SEA y Visual Basic Syntax Public Enum TPCANTPParameter As Byte PCANTP PARAM BLOCK SIZE amp HE1 PCANTP PARAM SEPERATION TIME amp HE2 PCANTP PARAM DEBUG amp HE3 PCANTP PARAM CHANNEL CONDITION amp HE4 PCANTP PARAM WFT MAX amp HE5 PCANTP PARAM MSG PENDING amp HE6 PCANTP PARAM VERSION PCANTP PARAM CAN DATA PADDING amp HE8 PCANTP PARAM RECEIVE EVENT amp HEA End Enum Values Name Value Data type Description PCANTP PARAM BLOCK SIZE OxE1 Byte ISO TP BlockSize BS parameter PARAM SEPARATION TIME OxE2 Byte ISO TP SeparationTime STmin parameter PCANTP PARAM DEBUG OxE3 Byte Debug mode PCANTP PARAM CHANNEL CONDITION OxEA Byte PCAN ISO TP channel condition L3 E PCAN ISO TP API Documentation User Guide System Name Value Data type Description PCANTP PARAM WFT MAX OxE5 Int32 ISO TP WFTmax parameter PCANTP PARAM MSG PENDING OxE6 Byte Filter for message indication PCANTP PARAM VERSION OxE7 String API version PCANTP PARAM DATA PADDING OxE8 Byte ISO TP CAN frame data handling mode PCANTP PARAM RECEIVE EVENT OxEA Byte PCAN ISO TP receive event handler parameter Characteristcis PCAN PARAM BLOCK SIZE Access W Description This value is used to set the BlockSize BS parameter
30. PHYSICAL 01 PCANTP ADDRESSING FUNCTIONAL S02 public enum TPCANTPAddressingType byte PCANTP ADDRESSING UNKNOWN 0x00 PCANTP ADDRESSING PHYSICAL 0x01 PCANTP ADDRESSING FUNCTIONAL 0x02 C CLR public enum class TPCANTPAddressingType Byte PCANTP_ADDRESSING_UNKNOWN 0x00 PCANTP_ADDRESSING_PHYSICAL 0x01 PCANTP_ADDRESSING_FUNCTIONAL 0x02 27 PCAN ISO TP API Documentation User Guide i System Visual Basic Public Enum TPCANTPAddressingType As Byte PCANTP_ADDRESSING_UNKNOWN amp H00 PCANTP_ADDRESSING_PHYSICAL amp H01 PCANTP_ADDRESSING_FUNCTIONAL amp H02 End Enum values Name value Description PCANTP_ADDRESSING_UNKNOWN 0 Unknown addressing PCANTP_ADDRESSING_PHYSICAL 1 Physical addressing used for communication between 2 nodes PCANTP_ADDRESSING_FUNCTIONAL 2 Functional addressing used to broadcast messages on the CAN bus See also TPCANTPMsg on page 12 See also Primary language ID CANTP_AddMapping on page 89 3 5 9 TPCANTPConfi rmation Represents the network status of a communicated CAN ISO TP message Syntax C define TPCANTPConfirmation BYTE define PCANTP_N_OK 0x00 define PCANTP_N_TIMEOUT_A 0x01 define TIMEOUT Bs 0x02 define PCANTP_N_TIMEOUT_Cr 0x03 define WRONG SN 0x04 define INVALID FS 0x05 define
31. Pascal OO var result TPCANTPStatus begin The Plug amp Play Channel PCAN PCI is initialized result TCanTpApi Initialize TCanTpApi PCANTP PCIBUS2 BAUD 500K if result PCANTP ERROR OK then MessageBox 0 Initialization failed MB OK else MessageBox 0 PCAN PCI Ch 2 was initialized Success MB All initialized channels are released TCanTpApi Uninitialize TCanTpApi PCANTP NONEBUS end See also Uninitialize on page 41 GetValue on page 61 Understanding PCAN ISO TP on page 6 Plain function version CANTP Initialize 3 6 3 Initialize TPCANTPHandle TPCANTPBaudrate TPCANTPHWType UInt32 UInt16 Initializes a PCANTP Channel which represents a Non Plug amp Play PCAN Device Syntax Pascal OO class function Initialize CanChannel TPCANTPHandle Baudrate TPCANTPBaudrate HwType TPCANTPHWType LongWord Interrupt Word TPCANTPStatus Ci DllImport PCAN ISO TP dll EntryPoint CANTP Initialize public static extern TPCANTPStatus Initialize MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U2 TPCANTPBaudrate Baudrate MarshalAs UnmanagedType U1 38 PCAN ISO TP API Documentation User Guide System TPCANTPHWType HwType UInt32 lOPort Ulnt16 Interrupt C CLR DIlImport PCAN ISO TP dll EntryPoint CANTP Initialize sta
32. This section contains information about the data types classes structures types defines enumerations and API functions which are contained in the PCAN ISO TP API 3 1 Namespaces PEAK offers the implementation of some specific programming interfaces as namespaces for the NET Framework programming environment The following namespaces are available Namespaces Name Peak Peak Can Peak Can Light Peak Can Basic Peak Can Ccp Peak Can Xcp Peak Can Iso Tp Peak Can Uds Peak Can Obdll Peak Lin Peak RP1210A 3 1 1 Description Contains all namespaces that are part of the managed programming environmet from PEAK System Contains types and classes for using the PCAN API from PEAK System Contains types and classes for using the PCAN Light API from PEAK System Contains types and classes for using the PCAN Basic API from PEAK System Contains types and classes for using the CCP API implementation from PEAK System Contains types and classes for using the XCP API implementation from PEAK System Contains types and classes for using the PCAN ISO TP API implementation from PEAK System Contains types and classes for using the PCAN UDS API implementation from PEAK System Contains types and classes for using the PCAN OBDII API implementation from PEAK System Contains types and classes used to handle with LIN devices from PEAK System Contains types and classes used to handle with CAN devices from PEAK Syst
33. also CANTP Read on page 94 class method Read CANTP Write on page 96 class method write 3 4 2 TPCANTPTimestamp Defines a time stamp of a CAN ISO TP message The time stamp of a CAN message contains the number of microseconds since the start of Windows Syntax C typedef struct DWORD millis WORD millis overflow WORD micros TPCANTPTimestamp Pascal OO TPCANTPTimestamp record millis Longword millis overflow Word micros Word end PTPCANTPTimestamp TPCANTPTimestamp 14 PCAN ISO TP API Documentation Ci User Guide System public value struct TPCANTPTimestamp public uint millis public ushort millis_overflow public ushort micros C CLR public value struct TPCANTPTimestamp Ulnt32 millis Ulnt16 millis overflow Ulnt16 micros Visual Basic Public Structure TPCANTPTimestamp Public millis As UInt32 Public millis overflow As UInt16 Public micros As UInt16 End Structure Remarks Calculation of total of microseconds micros 1000 millis 0x100000000 1000 millis overflow Fields Name Description millis Base value milliseconds 0 2 32 1 millis overflow Roll arounds of millis micros Microseconds 0 999 See also CANTP_Read on page 94 class method Read 15 E PCAN ISO TP API Documentation User Guide System 3 5 Types The PCAN ISO TP API defines the foll
34. common and useful override Example The following example shows the use of the method SetValue on the channel PCIBUS2 to enable debug mode o Note It is assumed that the channel was already initialized Ci TPCANTPStatus UInt32 iBuffer iBuffer result TPCANTPParamet if result Enable CAN res ult 0 DEBUG mode er TPCANTPSta CanTpApi PCANTP DEBUG CAN PCANTP PARAM DEBUG tus PCANTP CanTpApi SetValue CanTpApi PCANTP PCIBUS2 ref iBuffer ERROR OK MessageBox Show Failed to set value else MessageBox Show Val ue changed successfully sizeof UInt32 C CLR TPCANTPStatus result UInt32 iBuffer iBuffer result sizeof UInt32 if result Enable CAN DEBUG mode PCANTP T ERROR OK CanTpApi PCANTP DEBUG CAN CanTpApi SetValue CanTpApi PCANTP PCIBUS2 PCANTP PARAM DI EBUG iBuffer 45 E PCAN ISO TP API Documentation User Guide System MessageBox Show Failed to set value else MessageBox Show Value changed successfully Visual Basic Dim result As TPCANTPStatus Dim iBuffer As UInt32 0 Enable CAN DEBUG mode iBuffer CanTpApi PCANTP DEBUG CAN result CanTpApi SetValue CanTpApi PCANTP PCIBUS2 TPCANTPParameter PCANTP PARAM DEBUG iBuffer Convert ToUInt32 Len iBuffer I
35. message including the reception time stamp Reads multiple received CAN messages Transmits a CAN message at a specified time Description Retrieves client parameter e g total number of transmitted or received CAN messages the PCAN driver name PCAN net or PCAN client name the number of received bits Retrieves the currently used PCAN device Reads the diagnostic text buffer Retrieves the name of a PCAN device type Retrieves a driver parameter Translates an error code into a text Retrieves a hardware parameter Retrieves a net parameter Gets the system time Creates a text form of a CAN message Detects the current status of a CAN hardware Reads version and copyright information from the driver System See also PCAN Fundamentals on page 102 PCAN Basic on page 103 ISO TP network addressing format on page 107 106 E PCAN ISO TP API Documentation User Guide System 4 4 ISO TP network addressing format ISO TP specifies three addressing formats to exchange data normal extended and mixed addressing Each addressing requires a different number of CAN frame data bytes to encapsulate the addressing information associated with the data to be exchanged The following table sums up the mandatory configuration to the ISO TP API for each addressing format Addressing format CAN ID length Mandatory configuration steps Normal addressing 11 bits Define mappings with CANTP AddMapping FORMAT NO
36. of initialized channels of the calling application PCANTP_ERROR_WRONG_PARAM Indicates that the parameters passed to the method are invalid Check the value of Parameter and assert it is compatible with a string buffer Example The following example shows the use of the method GetValue to retrieve the version of the ISO TP API Depending on the result a message will be shown to the user Ci TPCANTPStatus result StringBuilder BufferString Get API version BufferString new StringBuilder 255 result CanTpApi GetValue CanTpApi PCANTP NONEBUS TPCANTPParameter PCANTP PARAM API VERSION BufferString 255 if result TPCANTPStatus PCANTP ERROR OK 62 a PCAN ISO TP API Documentation User Guide System MessageBox Show Failed to get value else MessageBox Show BufferString ToString C CLR TPCANTPStatus result StringBuilder BufferString Get API version BufferString gcnew StringBuilder 255 result CanTpApi GetValue CanTpApi PCANTP NONEBUS PCANTP PARAM API VERSION BufferString 255 if result PCANTP ERROR OK MessageBox Show Failed to get value else MessageBox Show BufferString gt ToString Visual Basic Dim result As TPCANTPStatus Dim BufferString As StringBuilder Get API version BufferString New StringBuilder 255 result CanTpApi GetValue CanTpApi PCA
37. result TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to add second mapping End Pascal OO var CanChannel TPCANTPHandle result TPCANTPStatus canld Byte canldResponse Byte N SA Byte N TA Byte N RA Byte begin CanChannel TCanTpApi PCANTP USBBUS1 canld 501 canldResponse 502 SA SF1 TA 13 RA 52 Define a first mapping to allow communication from Source SF1 to Destination 13 result TCanTpApi AddMapping CanChannel canld canldResponse PCANTP ID 11BIT PCANTP FORMAT MIXED PCANTP MESSAGE REMOTE DIAGNOSTIC SA TA PCANTP ADDRESSING PHYSICAL if result lt gt PCANTP ERROR OK then MessageBox 0 Failed to add first mapping MB OK Define a second mapping to allow communication from Destination 13 to Source SF1 result TCanTpApi AddMapping CanChannel canldResponse canld 57 PCAN ISO TP Documentation User Guide System PCANTP ID CAN 11 PCANTP FORMAT MIXED PCANTP MESSAGE REMOTE DIAGNOSTIC TA SA PCANTP ADDRESSING PHYSICAL RA if result PCANTP ERROR OK then MessageBox 0 Failed to add second mapping Error MB See also RemoveMapping below Plain function version CANTP RemoveMapping 3 6 11 RemoveMapping Removes a previously defined CAN ID mapping Synta
38. support using a channel it is necessary to initialize it first This is done by making a call to the function CANTP Initialize class method Initialize Depending on the message addressing format it may be necessary to define mappings between CAN Identifier and ISO TP network addressing information through the function AddMapping class method AddMapping Interaction After a successful initialization a channel is ready to communicate with the connected CAN bus Further configuration is not needed The functions CANTP Read and CANTP Write class methods Read and Write can be then used to read and write CAN messages that supports ISO TP If desired extra configuration can be made to improve a communication session like changing the time between transmissions of fragmented CAN messages Finalization When the communication is finished the function CANTP Uninitialize class method Uninitialize should be called in order to release the PCANTP Channel and the resources allocated for it In this way the channel is marked as Free and can be used from other applications E PCAN ISO TP API Documentation User Guide System 2 3 License Regulations Namings for products in this manual that are registered trademarks are not separately marked Therefore the missing of the sign does not implicate that the naming is a free trade name Furthermore the used names do not indicate patent rights or anything similar PEAK System T
39. 0 adds a mapping to transmit functionally addressed messages result CANTP AddMapping CanChannel CAN ID NO MAPPING PCANTP ID CAN 11BIT PCANTP FORMAT NORMAL PCANTP MESSAGE DIAGNOSTIC N SA N TA PCANTP ADDRESSING FUNCTIONAL N RA if result PCANTP ERROR OK MessageBox NULL Failed to add mapping Error MB OK 91 PCAN ISO TP API Documentation User Guide System removes the mapping result CANTP RemoveMapping CanChannel if result PCANTP ERROR OK MessageBox NULL Failed to add second mapping Error MB OK See also See also Primary language ID CANTP AddMapping on page 89 Class method Version RemoveMapping 3 7 7 GetValue Retrieves information from a PCAN Channel in numeric form Syntax C TPCANTPStatus stdcall CANTP GetValue TPCANTPHandle CanChannel TPCANTPParameter Parameter void Buffer DWORD BufferLength Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Parameter The code of the value to retrieve see TPCANTPParameter on page 30 Buffer The buffer to return the required numeric value BufferLength The length in bytes of the given buffer Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR
40. C PCANTP BAUD 250K 011C PCANTP BAUD 125K 031C PCANTP_BAUD_100K 432F PCANTP_BAUD_95K 5 PCANTP_BAUD_ 83K 852B PCANTP_BAUD_5OK 472F PCANTP_BAUD_47K 1414 BAUD 33K 58 2 BAUD 20K 532F PCANTP BAUD 10K 672F PCANTP BAUD 5K 7F7F y public enum TPCANBaudrate ushort PCANTP_BAUD_1M 0x0014 PCANTP BAUD 800K 0x0016 PCANTP BAUD 500K 0x001C PCANTP BAUD 250K 0x011C PCANTP BAUD 125K 0x031C PCANTP BAUD 100K 0x432F PCANTP BAUD 95K OxC34E PCANTP BAUD 83K 0x852B PCANTP BAUD 50K Ox472F PCANTP BAUD 47K 0x1414 PCANTP BAUD 33K Ox8B2F PCANTP BAUD 20K 0x532F PCANTP BAUD 10K 0x672F PCANTP BAUD 5K Ox7F7F C CLR public enum class TPCANTPBaudrate Ulnt16 PCANTP_BAUD_1M 0x0014 PCANTP BAUD 800K 0x0016 PCANTP BAUD 500K 0x001C PCANTP BAUD 250K 0x011C PCANTP BAUD 125K 0x031C PCANTP BAUD 100K 0x432F PCANTP BAUD 95K OxC34E PCANTP BAUD 83K 0x852B PCANTP BAUD 50K Ox472F PCANTP BAUD 47K 0x1414 PCANTP BAUD 33K Ox8B2F PCANTP BAUD 20K 0x532F PCANTP BAUD 10K 0x672F 20 a 150 Documentation User Guide System PCANTP BAUD 5K Ox7F7F b Visual Basic Public Enum TPCANTPBaudrate As Ulnt16 PCANTP BAUD 1M amp H14 PCANTP BAUD 800K amp H16 PCANTP BAUD 500K amp H1C PCANTP BAUD 250K amp H11C PCANTP
41. CI Ch 1 Status is OK break default An error occurred MessageBox Show Failed to retrieve status break C CLR TPCANTPStatus result Check the status of the PCI Channel result CanTpApi GetStatus CanTpApi PCANTP PCIBUS1 switch result case PCANTP ERROR BUSLIGHT MessageBox Show PCAN PCI Ch 1 Handling a BUS LIGHT status break case PCANTP ERROR BUSHEAVY MessageBox Show PCAN PCI Ch 1 Handling a BUS HEAVY status break case PCANTP ERROR BUSOFF MessageBox Show PCAN PCI Ch 1 Handling a BUS OFF status break case PCANTP ERROR OK MessageBox Show PCAN PCI Ch 1 Status is OK break 70 a PCAN ISO TP API Documentation User Guide System default An error occurred MessageBox Show Failed to retrieve status break Visual Basic Dim result As TPCANTPStatus Check the status of the PCI Channel result CanTpApi GetStatus CanTpApi PCANTP PCIBUS1 Select Case result Case TPCANTPStatus PCANTP ERROR BUSLIGHT MessageBox Show PCAN PCI Ch 1 Handling a BUS LIGHT status Case TPCANTPStatus PCANTP ERROR BUSHEAVY MessageBox Show PCAN PCI Ch 1 Handling a BUS HEAVY status Case TPCANTPStatus PCANTP ERROR BUSOFF MessageBox Show PCAN PCI Ch 1 Handling a BU
42. D Indicates that the desired PCANTP Channel is already in use PCANTP ERROR CAN ERROR This error flag states that the error is composed of a more precise PCAN Basic error Remarks As indicated by its name the Initialize method initiates a PCANTP Channel preparing it for communicate within the CAN bus connected to it Calls to the other methods will fail if they are used with a Channel handle different than PCANTP_NONEBUS that has not been initialized yet Each initialized channel should be released when it is not needed anymore Initializing a PCANTP Channel means to reserve the Channel for the calling application process to allocate channel resources like receive and transmit queues to forward initialization to PCAN Basic API hence registering connecting the Hardware denoted by the channel handle to set up the default values of the different parameters see CANTP GetValue The Initialization process will fail if an application tries to initialize a PCANTP Channel that has already been initialized within the same process Take in consideration that initializing a channel causes a reset of the CAN hardware In this way errors like BUSOFF BUSHEAVY and BUSLIGHT are removed Example The following example shows the initialize and uninitialize processes for a Plug And Play channel channel 2 of a PCAN PCI hardware C TPCANTPStatus result The Plug amp Play Channel PCAN PCI is initialized result CANTP Initiali
43. DIAGNOSTIC 90 PCAN ISO TP API Documentation User Guide System result CANTP AddMapping CanChannel canIdResponse ID CAN 11 PCANTP FORMAT MIXED PCANTP MESSAGE REMOTE DIAGNOSTIC N TA N SA PCANTP ADDRESSING PHYSICAL N RA if result PCANTP ERROR OK MessageBox NULL Failed to add second mapping Error OK See also CANTP_Remove Mapping below Class method Version RemoveMapping 3 7 6 CANTP Remove Mapping Removes a previously defined CAN ID mapping Syntax C TPCANTPStatus _ stdcall CANTP_RemoveMapping TPCANTPHandle CanChannel DWORD canID Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 The CAN Identifier that identifies the mapping to remove Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized or the mapping was not found Example The following example shows the definition and removal of a CAN ID mapping used for functional addressing with NORMAL addressing C TPCANTPHandle CanChannel PCANTP USBBUS1 TPCANTPStatus result BYTE OxD1 BYTE N SA OxF1 BYTE N TA 0x30 BYTE N RA 0x0
44. Definitions on page 99 11 E PCAN ISO TP API Documentation User Guide System 3 4 Structures The PCAN ISO TP API defines the following structures Name Description TPCANTPMsg Defines a CAN ISO TP message TPCANTPTimestamp Defines a time stamp of a CAN ISO TP message 3 4 1 TPCANTPMSg Defines a CAN ISO TP message Syntax C typedef struct BYTE SA BYTE TA TPCANTPAddressingType TA_TYPE BYTE RA TPCANTPIdType IDTYPE TPCANTPMessageType MSGTYPE TPCANTPFormatType FORMAT BYTE DATA 4095 WORD LEN TPCANTPConfirmation RESULT TPCANMSg Pascal OO TPCANMsg record SA Byte TA Byte TA_TYPE TPCANTPAddressingType RA Byte IDTYPE TPCANTPIdType MSGTYPE TPCANTPMessageType FORMAT TPCANTPFormatType DATA array 0 4094 of Byte LEN Word RESULT TPCANTPConfirmation end C public struct TPCANMsg public byte SA public byte TA 1 a PCAN ISO TP API Documentation User Guide System MarshalAs UnmanagedType U1 public TPCANTPAddressingType TYPE public byte RA MarshalAs UnmanagedType U1 public TPCANTPIdType IDTYPE MarshalAs UnmanagedType U1 public TPCANTPMessageType MSGTYPE MarshalAs UnmanagedType U1 public TPCANTPFormatType FORMAT MarshalAs UnmanagedType ByValArray SizeConst 4095 public byte DATA public ushort LEN MarshalAs UnmanagedType U1 public TPCANTPConfirm
45. Documentation User Guide n e System End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Message Buffer A TPCANTPMsg buffer to store the CAN ISO TP message TimestampBuffer A TPCANTimestamp buffer to get the reception time of the message Returns The return value is a TPCANTPStatus code PCANTP ERROR OK is returned on success The typical errors in case of failure are PCANTP ERROR NO MESSAGE Indicates that the receive queue of the Channel is empty PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be used because it was not found in the list of reserved channels of the calling application Remarks The message type see TPCANTPMessageType of a CAN ISO TP message indicates if the message is a complete ISO TP message diagnostic remote diagnostic a transmission confirmation or an indication of a pending message This value should be checked every time a message has been read successfully along with the RESULT value as it contains the network status of the message Example The following example shows the use of the method Read on the channel PCANTP_USBBUS1 Depending on the result a message will be shown to the user Note It is assumed that the channel was already initialized Ci TPCANTPStatus result TPCANTPMsg msg TPCANTPTimestamp ts bool bStop false do Read the first message in the queue result Can
46. E DNG SJA 0x05 define PCANTP TYPE DNG SJA EPP 0x06 System Pascal OO Z1 TPCANTPHWType PCANTP_TYPE_ISA 01 PCANTP_TYPE_ISA_SJA 09 PCANTP_TYPE_ISA_PHYTEC 04 PCANTP_TYPE_DNG 02 PCANTP_TYPE_DNG_EPP 03 PCANTP TYPE DNG SJA 05 PCANTP TYPE DNG SJA 06 Ci public enum TPCANTPHWType byte PCANTP_TYPE_ISA 0x01 TYPE ISA SJA 0x09 PCANTP TYPE ISA PHYTEC 0x04 PCANTP TYPE DNG 0x02 PCANTP TYPE DNG EPP 0x03 PCANTP SJA 0x05 PCANTP TYPE SJA EPP 0x06 C CLR public enum class TPCANTPHWType Byte PCANTP_TYPE_ISA 0x01 TYPE ISA SJA 0x09 PCANTP TYPE ISA PHYTEC Ox04 PCANTP TYPE DNG 0x02 PCANTP TYPE DNG EPP 0x03 PCANTP TYPE DNG SJA 0x05 PCANTP TYPE SJA EPP 0x06 Visual Basic Public Enum TPCANTPHWType As Byte PCANTP_TYPE_ISA amp H1 PCANTP_TYPE_ISA_SJA amp H9 22 PCAN ISO TP API Documentation User Guide PCANTP TYPE ISA PHYTEC amp H4 PCANTP TYPE DNG amp H2 PCANTP TYPE DNG EPP amp H3 PCANTP TYPE DNG SJA amp H5 PCANTP TYPE DNG SJA EPP amp H6 End Enum System values Name Value Description TYPE 15 PCAN ISA 82 200 TYPE ISA SJA PCAN ISA SJA1000 PCANTP TYPE ISA PHYTEC PHYTEC ISA PCANTP TYPE DNG PCAN Dongle 82C200 PCANTP TYPE DNG EPP PCAN Dongle EPP 82C200
47. ERROR_OK 0x00000 PCANTP_ERROR_NOT_INITIALIZED 0x00001 PCANTP_ERROR_ALREADY_INITIALIZED 0x00002 PCANTP_ERROR_NO_MEMORY 0x00003 PCANTP_ERROR_OVERFLOW 0x00004 PCANTP_ERROR_TIMEOUT 0x00006 PCANTP_ERROR_NO_MESSAGE 0x00007 PCANTP_ERROR_WRONG_PARAM 0x00008 PCANTP_ERROR_BUSLIGHT 0x00009 PCANTP_ERROR_BUSHEAVY 0x0000A PCANTP_ERROR_BUSOFF 0x0000B PCANTP ERROR CAN ERROR 0x80000000 PCAN IS0 TP API Documentation User Guide C Snytax System public enum TPCANTPStatus uint PCANTP ERROR OK 0x00000 PCANTP ERROR NOT INITIALIZED 0x00001 PCANTP ERROR ALREADY INITIALIZED 0x00002 PCANTP ERROR NO MEMORY 0x00003 PCANTP ERROR OVERFLOW 0x00004 PCANTP ERROR TIMEOUT 0x00006 PCANTP ERROR NO MESSAGE 0x00007 PCANTP ERROR WRONG PARAM 0x00008 PCANTP ERROR BUSLIGHT 0x00009 PCANTP ERROR BUSHEAVY 0x00004A PCANTP ERROR BUSOFF 0x0000B PCANTP ERROR ERROR 0x80000000 Pascal OO TPCANTPStatus PCANTP ERROR OK 00000 PCANTP ERROR NOT INITIALIZED 00001 PCANTP ERROR ALREADY INITIALIZED 00002 PCANTP ERROR NO MEMORY 00003 PCANTP ERROR OVERFLOW 00004 PCANTP ERROR TIMEOUT 00006 PCANTP ERROR NO MESSAGE 00007 PCANTP ERROR WRONG PARAM 00008 PCANTP ERROR BUSLIGHT 00009 PCANTP ERROR BUSHEAVY 0000A PCANTP ERROR BUSOFF 0000B PCANTP ERROR CAN ERROR LongWord 80000000 Visual Basic Syntax
48. Fundamentals This section contains an introduction to PCAN PCAN Basic This section contains general information about the PCAN Basic API PCAN API ISO TP network addressing format network addressing format 4 1 PCAN Fundamentals This section contains general information about the PCAN API This section contains general information about the ISO TP PCAN is a synonym for PEAK CAN APPLICATIONS and is a flexible system for planning developing and using a CAN Bus System Developers as well as end users are getting a helpful and powerful product Basis for the communication between PCs and external hardware via CAN is a series of Windows Kernel Mode Drivers Virtual Device Drivers e g PCAN USB SYS PCAN PCI SYS PCAN xxx SYS These drivers are the core of a complete CAN environment on a PC running Windows and work as interfaces between CAN software and PC based CAN hardware The drivers manage the entire data flow of every CAN device connected to the PC A user or administrator of a CAN installation gets access via the PCAN Clients short Clients Several parameters of processes can be visualized and changed with their help The drivers allow the connection of several Clients at the same time Furthermore several hardware components based on the SJA1000 CAN controller are supported by a PCAN driver So called Nets provide the logical structure for CAN busses which are virtually extended into the PC On the hardware side several Clien
49. ISO TP message Represents the CAN ID type of a PCAN ISO TP message Represents the type of format of a PCAN ISO TP message Represents the type of message addressing of a PCAN ISO TP message Represents the network status of a communicated PCAN ISO TP messag Represents a PCAN ISO TP parameter to be read or set PEAK offers the implementation of some specific programming interfaces as Units for the Delphi s programming environment The following units are available to be used Namespaces 3 2 1 Alias PCANTP Unit PCANTP Unit Description Delphi unit for using the PCAN ISO TP API from PEAK System The PCANTP Unit contains types and classes to use the PCAN ISO TP API within Delphi s programming environment and handle PCAN devices from PEAK System Remarks For the NET Framework these elements are enclosed in the Peak Can IsoTp namespace The functionality of all elements included here is just the same The difference between this Unit and the NET namespace consists in the fact that Delphi accesses the Windows API directly it is not Managed Code Aliases Alias TPCANTPHandle Class TCanTpApi Description Represents a PCAN ISO TP channel handle Description Defines a class which represents the PCAN ISO TP API PCAN ISO TP API Documentation User Guide e Structures Class ay TPCANTPMsg ay TPCANTPTimestamp Enumerations Name TPCANTPStatus TPCANTPBaudrate TPCANTPHWType TPCANTPMessageType TPCANT
50. Interface for the use of a collection of Windows Device Drivers from PEAK System which allow the real time connection of Windows applications to all CAN busses physically connected to a PC PCAN Basic principal characteristics are Retrieves information about the receive time of a CAN message Easy switching between different PCAN Channels PCAN PC hardware The possibility to control some parameters in the hardware e g Listen Only mode automatic reset of the CAN controller etc The use of event notifications for faster processing of incomming CAN messages An improved system for debugging operations The use of only one Dynamic Link Library PCANBasic DLL for all supported hardware The possibility to connect more than 2 channels per PCAN Device The following list Shows the PCAN Channels that can be connected per PCAN Device PCAN ISA PCAN Dongle PCAN PCI PCAN USB PCAN PC Card PCAN LAN Number of Channels 8 1 16 16 2 16 Using the PCAN Basic The PCAN basic offers the possibility to use several PCAN Channels within the same application in an easy way The communication process is divided in 3 phases initialization interaction and finalization of a PCAN Channel Initialization In order to do CAN communication using a channel it is necessary to first initialize it This is done making a call to the function CAN_Initialize class method Initialize or CAN InitializeFD class method InitializeFD in case FD communication is desi
51. MAT NORMAL PCANTP MESSAGE DIAGNOSTIC Any values 0x00 value is ignored PCANTP_FORMAT_EXTENDED Any Any Any Any PCANTP_FORMAT_MIXED PCANTP_ID_CAN PCANTP_MESSAGE_REMOTE_DIAGNOSTIC Any Any _11BIT When target type is functional addressing there is no need to define a CAN ID response since responses from functional adressing will be physically adressed The definition value CAN ID NO MAPPING can be used to fill in the canldResponse parameter in those cases Note The formats FORMAT FIXED NORMAL and PCANTP FORMAT ENHANCED requires 29 bits CAN ID and do not need mappings to be defined see ISO TP network addressing format for more information Example The following example defines two CAN ID mappings in order to receive and transmit ISO TP messages using 11 bit CAN Identifiers with MIXED format addressing Note It is assumed that the channel was already initialized 55 E PCAN ISO TP API Documentation User Guide System Ci TPCANTPHandle CanChannel CanTpApi PCANTP USBBUS1 TPCANTPStatus result byte canId OxD1 byte canlIdResponse 0xD2 byte SA OxFl1 byte N TA 0x13 byte N RA 0x52 Define a first mapping to allow communication from Source 0xF1 to Destination 0x13 result CanTpApi AddMapping CanChannel canIdResponse TPCANTPIdType PCANTP ID CAN 11BIT TPCANTPFormatType PCANTP FORMAT MIXED TPCANTPMessageType PCANTP
52. MESSAGE REMOTE DIAGNOSTIC N SA N TA TPCANTPAddressingType PCANTP ADDRESSING PHYSICAL N RA if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Failed to add first mapping Define a second mapping to allow communication from Destination 0x13 to Source OxF1 result CanTpApi AddMapping CanChannel canldResponse TPCANTPIdType PCANTP ID CAN 11BIT TPCANTPFormatType PCANTP FORMAT MIXED TPCANTPMessageType PCANTP MESSAGE REMOTE DIAGNOSTIC N TA N SA TPCANTPAddressingType PCANTP ADDRESSING PHYSICAL N RA if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Failed to add second mapping C CLR TPCANTPHandle CanChannel CanTpApi PCANTP USBBUS1 TPCANTPStatus result Byte 0 Byte canIdResponse 0xD2 Byte SA OxF1 Byte N TA 0x13 Byte N_RA 0x52 Define a first mapping to allow communication from Source 0xF1 to Destination 0x13 result CanTpApi AddMapping CanChannel canIdResponse PCANTP ID 11 FORMAT MIXED PCANTP MESSAGE REMOTE DIAGNOSTIC SA N TA PCANTP ADDRESSING PHYSICAL N RA if result PCANTP ERROR OK MessageBox Show Failed to add first mapping Define a second mapping to allow communication from Destination 0x13 to Source OxF1 result CanTpApi AddMapping CanChannel canldResponse PCANTP ID 11
53. NTP MESSAGE INDICATION 0x04 Visual Basic Public Enum TPCANTPMessageType As Byte PCANTP MESSAGE UNKNOWN amp HO PCANTP MESSAGE DIAGNOSTIC amp H1 PCANTP MESSAGE REMOTE DIAGNOSTIC amp H2 PCANTP MESSAGE REQUEST CONFIRMATION amp H3 PCANTP MESSAGE INDICATION amp H4 End Enum values Name value Description PCANTP MESSAGE UNKNOWN 0 Unknown non ISO TP message PCANTP MESSAGE DIAGNOSTIC 1 Diagnostic message PCANTP MESSAGE REMOTE DIAGNOSTIC 2 Remote Diagnostic message ie message uses the Remote Address RA field Notification message has been sent successfully or not w PCANTP_MESSAGE_REQUEST_CONFIRMATION PCANTP_MESSAGE_INDICATION 4 Notification multi Frame message is being received or transmitted See also TPCANTPMsg on page 12 See also Primary language ID CANTP_AddMapping on page 89 3 5 6 TPCANTPIdType Represents the ID type of CAN messages standard 11bits or extended 29bits Syntax C define TPCANTPIdType BYTE define PCANTP ID CAN 11BIT Ox01 define ID 29BIT 0x02 24 PCAN ISO TP API Documentation User Guide Pascal OO System Z1 TPCANTPldType PCANTP ID CAN 11BIT 01 ID 29BIT 02 C public enum TPCANTPIdType byte PCANTP_ID_CAN_11BIT 0x01 PCANTP ID CAN 29BIT 0x02 CLR public enum class TPCANTPIdType
54. NTP NONEBUS _ TPCANTPParameter PCANTP PARAM API VERSION BufferString 255 If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to get value Else MessageBox Show BufferString ToString End Pascal OO var result TPCANTPStatus BufferString array 0 256 of Char begin Get API version result TCanTpApi GetValue TCanTpApi PCANTP_NONEBUS PCANTP PARAM VERSION BufferString 255 if result PCANTP ERROR OK then MessageBox 0 Failed to get value MB OK else MessageBox 0 BufferString Success MB OK end See also SetValue on page 43 TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Plain function version CANTP GetValue 63 PCAN ISO TP API Documentation User Guide 3 6 14 GetValue TPCANTPHandle TPCANTPParameter Uint32 Uint32 Retrieves information from a PCAN Channel in numeric form Syntax Pascal OO System class function GetValue CanChannel TPCANTPHandle Parameter TPCANTPParameter NumericBuffer PLongWord BufferLength LongWord TPCANTPStatus overload Ci DllImport PCAN ISO TP dll EntryPoint CANTP GetValue public static extern TPCANTPStatus GetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter out Ulnt32 NumericBuffer UInt32 BufferLength C CLR
55. NTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application Remarks A PCAN Channel can be released using one of these possibilities Single Release Given a handle of a PCANTP Channel initialized before with the method initialize If the given channel can not be found then an error is returned Multiple Release Giving the handle value NONEBUS which instructs the API to search for all channels initialized by the calling application and release them all This option cause no errors if no hardware were uninitialized Example The following example shows the initialize and uninitializes processes for a Plug And Play channel channel 2 of a PCAN PCI hardware CH TPCANTPStatus result The Plug amp Play Channel PCAN PCI is initialized result CanTpApi Initialize CanTpApi PCANTP_PCIBUS2 TPCANTPBaudrate PCANTP BAUD 500K if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Initialization failed else MessageBox Show PCAN PCI Ch 2 was initialized Release channel CanTpApi Uninitialize CanTpApi PCANTP PCIBUS2 C CLR TPCANTPStatus result The Plug amp Play Channel PCAN PCI is initialized result CanTpApi Initialize CanTpApi PCANTP PCIBUS2 PCANTP BAUD 500K if result PCANTP ERROR OK MessageBox Show Initialization failed else MessageBox Show PCAN PCI Ch 2 was initialized
56. NTPHandle TPCANTPMsg Reads a CAN ISO TP message from the receive queue of a PCANTP Channel Syntax Pascal OO class function Read CanChannel TPCANTPHandle var MessageBuffer TPCANTPMsg TPCANTPStatus overload Ci DllImport PCAN ISO TP dll EntryPoint CANTP Read public static extern TPCANTPStatus Read MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel out TPCANTPMsg MessageBuffer C CLR DIlImport PCAN ISO TP dll EntryPoint CANTP Read static TPCANTPStatus Read MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel TPCANTP Msg MessageBuffer Visual basic lt Dlllmport PCAN ISO TP dll EntryPoint CANTP_Read gt _ Public Shared Function Read _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle _ ByRef MessageBuffer As TPCANTPMsg As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Message Buffer A TPCANTPMsg buffer to store the CAN ISO TP message 72 E PCAN ISO TP API Documentation User Guide System Returns The return value is a TPCANTPStatus code PCANTP_ERROR_OK is returned on success The typical errors in case of failure are PCANTP ERROR NO MESSAGE Indicates that the receive queue of the Channel is empty PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialize
57. NTPMSg 3 4 2 TPCANTPTimestamp 3 5 Types 3 5 1 TPCANTPHandle 3 5 2 TPCANTPStatus 3 5 3 TPCANTPBaudrate 3 5 4 TPCANTPHWType 3 5 5 TPCANTPMessageType 3 5 6 TPCANTPIdType 3 5 7 TPCANTPFormatType 3 5 8 TPCANTPAddressingType 3 5 9 TPCANTPConf i rmation 3 5 10 TPCANTPParameter 3 6 Methods 3 6 1 Initialize 3 6 2 Initialize TPCANTPHandle TPCANTPBaudrate 3 6 3 Initialize TPCANTPHandle TPCANTPBaudrate TPCANTPHWType UInt32 UInt16 3 6 4 Uninitialize 3 6 5 SetValue 3 6 6 SetValue TPCANTPHandle TPCANTPParameter UInt32 Uint32 3 6 7 SetValue TPCANTPHandle TPCANTPParameter StringBuffer 8 9 UJ UJ UJ UJ UJ NAA DO Uint32 SetValue TPCANTPHandle TPCANTPParameter byte Uint32 GetErrorText TPCANStatus UInt16 StringBuilder 10 AddMapping 11 RemoveMapping 12 GetValue System PCAN ISO TP API Documentation User Guide UJ Ui Uu UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ UJ w w GetValue TPCANTPHandle TPCANTPParameter StringBuilder Uint32 GetValue TPCANTPHandle TPCANTPParameter Uint32 Uint32 GetValue TPCANTPHandle TPCANTPParameter byte UInt32 GetStatus Read Read TPCANTPHandle TPCANTPMSQ Read TPCANTPHandle TPCANTPMsg TPCANTPTimestamp write Reset Functions NNNNNNNNNNN 10 11 CANTP Initialize CANTP Uninitialize CANTP SetValue CANTP Ge
58. NTP_N_WFT_OVRN error will never occur 3 Int32 PCANTP WFT MAX DEFAULT 0x10 The default value used by the API if the number of consecutive FlowControl frame with the Wait status exceeds this value a PCANTP_N_WFT_OVRN error will occur ISO TP message pending indication values Type Constant valu Description e ij Int32 PCANTP MSG PENDING HIDE 0 00 Messages with the type PCANTP MESSAGE INDICATION will be automatically removed from the result of the CANTP Read function Int32 PCANTP MSG PENDING SHOW 0 01 Messages with the type PCANTP MESSAGE INDICATION can be retrieved from the CANTP Read function ISO TP data padding values Type Constant valu Description e 3 Int32 PCANTP CAN DATA PADDING NONE 0x00 frame data optimization is enabled 1 Int32 PCANTP CAN DATA PADDING ON 0 01 CAN frame data optimization is disabled CAN data length is always 8 and data is padded with zeros Remarks These definitions are constants values in an object oriented environment Delphi NET Framework and declared as defines in C plain API See also TPCANTPParameter on page 30 PCAN ISO TP Handle Definitions on page 99 101 PCAN ISO TP API Documentation User Guide System 4 Additional Information PCAN is the platform for PCAN OBDII PCAN UDS and PCAN Basic In the following topics there is an overview of PCAN and the fundamental practice with the interface DLL CanApi2 PCAN API Topics Description PCAN
59. P TYPE DNG SJA 378 7 if result PCANTP ERROR OK then MessageBox 0 Initialization failed MB OK else MessageBox 0 PCAN PCI Ch 2 was initialized MB OK All initialized channels are released TCanTpApi Uninitialize TCanTpApi PCANTP NONEBUS end See also Uninitialize below GetValue on page 61 Understanding PCAN ISO TP on page 6 Plain function version CANTP Uninitialize 3 6 4 Uninitialize Uninitializes a PCANTP Channel Syntax Pascal OO class function Uninitialize CanChannel TPCANTPHandle TPCANTPStatus Ci DllImport PCAN ISO TP dlI EntryPoint CANTP Uninitialize public static TPCANTPStatus Uninitialize MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel C CLR static TPCANTPStatus Uninitialize MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel 41 E PCAN ISO TP API Documentation User Guide e System Visual Basic Public Shared Function Uninitialize _ MarshalAs UnmanagedType U2 _ ByVal CanChannel As TPCANTPHandle As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCA
60. PCAN ISO TP API Documentation PEAK CAN ISO TP Application Programming Interface User Manual Document version 1 2 1 2015 09 21 O PCAN ISO TP API Documentation User Guide System Product names mentioned in this manual may be the trademarks or registered trademarks of their respective companies They are not explicitly marked by and Copyright O 2015 PEAK System Technik GmbH Duplication copying printing or other forms and the electronic distribution of this document is only allowed with explicit permission of PEAK System Technik GmbH PEAK System Technik GmbH reserves the right to change technical data without prior announcement The general business conditions and the regulations of the license agreement apply All rights are reserved PEAK System Technik GmbH Otto R hm Straf e 69 64293 Darmstadt Germany Phone 49 0 6151 8173 20 Fax 49 0 6151 8173 29 www peak system com info peak system com support peak system com Development Packages Forum Document version 1 2 1 2015 09 21 PCAN ISO TP API Documentation User Guide Contents 1 PCAN ISO TP API Documentation nu BRWN PR Introduction Understanding PCAN ISO TP Using PCAN ISO TP License Regulations Features System Requirements Scope of Supply 3 DLL API Reference 3 1 Namespaces 3 1 1 Peak Can IsoTp 3 2 Units 3 2 1 PCANTP Unit 3 3 classes 3 3 1 CanTpApi 3 3 2 TCanTpApi 3 4 Structures 3 4 1 TPCA
61. PCANTPStatus result The PCI Channel is reset result CanTpApi Reset CanTpApi PCANTP PCIBUS1 if result PCANTP ERROR OK An error occurred MessageBox Show An error occured else MessageBox Show PCAN PCI Ch 1 was reset Visual Basic Dim result As TPCANTPStatus The PCI Channel is reset result CanTpApi Reset CanTpApi PCANTP PCIBUSI1 If result TPCANTPStatus PCANTP ERROR OK Then An error occurred MessageBox Show An error occured Else MessageBox Show PCAN PCI Ch 1 was reset End If Pascal OO var result TPCANTPStatus begin The PCI Channel is reset result TCanTpApi Reset TCanTpApi PCANTP PCIBUS1 if result PCANTP ERROR OK then An error occurred MessageBox 0 error occured MB OK else MessageBox 0 PCAN PCI Ch 1 was reset Error MB OK end 83 PCAN ISO TP API Documentation User Guide See also Uninitialize on page 41 Plain function version CANTP Reset 3 7 Functions The functions of the PCAN ISO TP API are divided in 4 groups of functionality Connection Function Description ay Ej CANTP Initialize Initializes a PCANTP channel ay Ej CANTP Uninitialize Uninitializes a PCANTP channel Configuration Function Description ay E CANTP_SetValue Sets a configuration or information value within a PCANTP Channel ay CANTP AddMapping Configures the ISO TP
62. PIdType TPCANTPFormatType TPCANTPAddressingType TPCANTPConfirmation 4 4 1 TPCANTPParameter 3 3 Classes System Description Defines a CAN ISO TP message The members of this structure are sequentially byte aligned Defines a time stamp of a CAN ISO TP message Description Represents a PCAN ISO TP status error code Represents a PCAN Baud rate register value Represents the type of PCAN hardware to be initialized Represents the type of a PCAN ISO TP message Represents the CAN ID type of a PCAN ISO TP message Represents the type of format of a PCAN ISO TP message Represents the type of message addressing of a PCAN ISO TP message Represents the network status of a communicated PCAN ISO TP message Represents a PCAN ISO TP parameter to be read or set The following classes are offered to make use of the PCAN ISO TP API in a managed or unmanaged way Classes Class ay gg CanTpApi 2 gg TCanTpApi 3 3 1 canTpApi Description Defines a class to use the PCAN ISO TP API within the Microsoft s NET Framework programming environment Defines a class to use the PCAN ISO TP API within the Delphi programming environment Defines a class which represents the PCAN ISO TP API for using within the Microsoft s NET Framework Syntax Ci public static class CanTpApi C CLR public ref class CanTpApi abstract sealed Visuel Basic Public NotInheritable Class CanTpApi E
63. RMAL 29 bits Define mappings with CANTP AddMapping Normal fixed addressing 11 bits Addressing is invalid PCANTP FORMAT FIXED NORMAL 29 bits _ Extended addressing 11 bits Define mappings with CANTP AddMapping PCANTP FORMAT EXTENDED 29 bits Define mappings with CANTP AddMapping Mixed addressing 11 bits Define mappings with CANTP AddMapping PCANTP FORMAT MIXED 29 bits _ Enhanced addressing 11 bits Addressing is invalid PCANTP FORMAT ENHANCED 29 bits A mapping allows an ISO TP node to identify and decode CAN Identifiers it binds a CAN ID to an ISO TP network address information CAN messages that cannot be identified are ignored by the API Mappings involving physically addressed communication are most usually defined in pairs the first mapping defines outgoing communication i e request messages from node A to node B and the second to match incoming communication i e responses from node B to node A Functionally addressed communication requires one mapping to transmit functionally addressed messages i e request messages from node A to any node and as many mappings as responding nodes i e responses from nodes B C etc to node A 107 E PCAN ISO TP API Documentation User Guide System 4 5 Using Events Event objects can be used to automatically notify a client on reception of an ISO TP message This has following advantages The client program doesn t need to check periodically for received messages any longer
64. S OFF status Case TPCANTPStatus PCANTP ERROR OK MessageBox Show PCAN PCI Ch 1 Status is OK Case Else An error occurred MessageBox Show Failed to retrieve status End Select Pascal OO var result TPCANTPStatus begin Check the status of the PCI Channel result TCanTpApi GetStatus TCanTpApi PCANTP PCIBUS1 Case result of PCANTP ERROR BUSLIGHT MessageBox 0 PCAN PCI Ch 1 Handling a BUS LIGHT status Error MB OK PCANTP ERROR BUSHEAVY MessageBox 0 PCAN PCI Ch 1 Handling a BUS HEAVY status Error MB OK PCANTP ERROR BUSOFF MessageBox 0 PCAN PCI Ch 1 Handling a BUS OFF status Error MB OK PCANTP ERROR OK MessageBox 0 PCAN PCI Ch 1 Status is OK MB OK else An error occurred MessageBox 0 Failed to retrieve status Error MB end end See also TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Plain function version CANTP_GetStatus 71 E PCAN ISO TP API Documentation User Guide System 3 6 17 Read Reads a CAN ISO TP message from the receive queue of a PCANTP Channel Overloads Function Description 2 Read TPCANTPHandle TPCANTPMsg Reads a CAN ISO TP message from the receive queue of a PCANTP Channel i Read TPCANTPHandle TPCANTPMsg Reads a CAN ISO TP message and its timestamp from the receive queue of a TPCANTPTimestamp PCANTP Channel 3 6 18 Read TPCA
65. SA interface channel 2 ij TPCANTPHandle PCANTP ISABUS3 0x23 PCAN ISA interface channel 3 5j TPCANTPHandle PCANTP_ISABUS4 0x24 PCAN ISA interface channel 4 i33 TPCANTPHandle PCANTP ISABUS5 0x25 PCAN ISA interface channel 5 i3 TPCANTPHandle PCANTP_ISABUS6 0x26 PCAN ISA interface channel 6 ij TPCANTPHandle PCANTP ISABUS7 0x27 PCAN ISA interface channel 7 TPCANTPHandle PCANTP_ISABUS8 0x28 PCAN ISA interface channel 8 Handles for the Dongle Bus Not Plug amp Play Type Constant value Description 33 TPCANTPHandle PCANTP_DNGBUS1 0x31 PCAN Dongle LPT interface channel 1 Handles for the PCI Bus Type Constant value Description ij TPCANTPHandle PCANTP PCIBUS1 0 41 PCAN PCI interface channel 1 i34 TPCANTPHandle PCANTP PCIBUS2 0x42 PCAN PCI interface channel 2 ij TPCANTPHandle PCANTP PCIBUS3 0x43 PCAN PCI interface channel 3 i33 TPCANTPHandle PCANTP_PCIBUS4 0x44 PCAN PCI interface channel 4 i3 TPCANTPHandle PCANTP PCIBUS5 0x45 PCAN PCI interface channel 5 ij TPCANTPHandle PCANTP_PCIBUS6 0x46 PCAN PCI interface channel 6 TPCANTPHandle PCIBUS7 0x47 PCAN PCI interface channel 7 i33 TPCANTPHandle PCANTP_PCIBUS8 amp 0x48 PCAN PCI interface channel 8 Handles for the USB Bus Type Constant value Description 212 TPCANTPHandle PCANTP_USBBUS1 0x51 PCAN USB interface channel 1 i3 TPCANTPHandle PCANTP_USBBUS2 0x52 PCAN USB interface channel 2 99 E PCAN ISO TP API Documentation
66. SBBUS1 It then waits until a confirmation message is received Depending on the result a message will be shown to the user o Note It is assumed that the channel was already initialized and mapping were configured Ci prepare an 11bit CAN ID physically addressed using extended format and extended addressing ISO TP message containing 4095 bytes of data TPCANTPMsg request new TPCANTPMsg request DATA new byte 4095 request LEN ushort request DATA Length request MSGTYPE TPCANTPMessageType PCANTP MESSAGE DIAGNOSTIC request IDTYPE TPCANTPIdType PCANTP ID 11 request FORMAT TPCANTPFormatType PCANTP FORMAT EXTENDED request SA 0 1 request TA 0 7 request TA TYPE TPCANTPAddressingType PCANTP ADDRESSING PHYSICAL request RA 0x00 The message is sent using the PCAN USB TPCANTPStatus result CanTpApi Write CanTpApi PCANTP USBBUS1 ref request if result TPCANTPStatus PCANTP ERROR OK Loop until the transmission confirmation is received do 79 PCAN ISO TP API Documentation User Guide System result CanTpApi Read CanTpApi PCANTP USBBUS1 out request MessageBox Show String Format Read 0 type 1 result 2 result request MSGTYPE request RESULT while result TPCANTPStatus PCANTP ERROR NO MESSAGE else An error occur
67. SO TP API Documentation User Guide System PCANTP ERROR WRONG PARAM Indicates that the parameters passedto the method are invalid Check the value of Parameter and assert it is compatible with an integer buffer Remarks This overrides is only defined for users who wishes to configure PCAN Basic API through the ISO TP API See also GetValue on page 61 TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Plain function version CANTP SetValue 3 6 8 SetValue TPCANTPHandle TPCANTPParameter byte Uint32 Sets a configuration or information value as a byte array within a PCANTP Channel Syntax C DllImport PCAN ISO TP dll EntryPoint CANTP SetValue public static extern TPCANTPStatus SetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter MarshalAs UnmanagedType LPArray SizeParamIndex 3 Byte Buffer UInt32 BufferLength C CLR DIlImport PCAN ISO TP dll EntryPoint SetValue static TPCANTPStatus SetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter MarshalAs UnmanagedType LPArray SizeParamIndex 3 array Byte Buffer UInt32 BufferLength Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint CANTP_SetValue gt _ Public Shared Function SetValue MarshalAs UnmanagedType U2 _ B
68. TP FORMAT NORMAL PCANTP MESSAGE DIAGNOSTIC SA TA ADDRESSING FUNCTIONAL if result lt gt PCANTP ERROR OK then MessageBox 0 Failed to add mapping Error MB OK fas 60 E PCAN ISO TP API Documentation User Guide System removes the mapping result TCanTpApi RemoveMapping CanChannel canld if result lt gt PCANTP ERROR OK then MessageBox 0 Failed to add second mapping Error MB end See also AddMapping on page 53 Plain function version CANTP RemoveMapping 3 6 12 GetValue Retrieves information from a PCANTP Channel Overloads Function Description GetValue TPCANTPHandle Retrieves information from a PCANTP Channel in numeric form TPCANTPParameter UInt32 UInt32 GetValue TPCANTPHandle Retrieves information from a PCANTP Channel in text form TPCANTPParameter String UInt32 i 8 GetValue TPCANTPHandle Retrieves information from a PCANTP Channel in byte array form TPCANTPParameter Byte UInt32 3 6 13 GetValue TPCANTPHandle TPCANTPParameter StringBuilder Uint32 Retrieves information from a PCANTP Channel in text form Syntax Pascal OO class function GetValue CanChannel TPCANTPHandle Parameter TPCANTPParameter StringBuffer PAnsiChar BufferLength LongWord TPCANTPStatus overload Ci DllImport PCAN ISO TP dll EntryPoint CANTP GetValue public static extern TPCANTPSt
69. The response time on received messages is reduced To use events the client application must call the CANTP SetValue function class method SetValue to set the parameter PARAM RECEIVE EVENT This parameter sets the handle for the event object When receiving a message the API sets this event to the Signaled state Another thread must be started in the client application which waits for the event to be signaled using one of the Win32 synchronization functions e g WaitForSingleObject without increasing the processor load After the event is signaled available messages can be read with the CANTP Read function class method Read and the ISO TP messages can be processed Remarks Tips for the creation of the event object Creation of the event as auto reset e Trigger mode set default After the first waiting thread has been released the event object s state changes to non signaled Other waiting threads are not released If no threads are waiting the event object s state remains signaled e Trigger mode pulse After the first waiting thread has been released the event object s state changes to non signaled Other waiting threads are not released If no threads are waiting or if no thread can be released immediately the event object s state is simply set to non signaled Creation of the event as manual reset e Trigger mode set default The state of the event object remains signaled until it is set expli
70. TpApi Read CanTpApi PCANTP USBBUS1 out msg out ts if result TPCANTPStatus PCANTP ERROR OK Process the received messag MessageBox Show A message was received ProcessMessage msg else An error occurred MessageBox Show An error ocured Here can be decided if the loop has to be terminated bStop HandleReadError result while bStop 76 PCAN ISO TP API Documentation User Guide C CLR System TPCANTPStatus result TPCANTPMsg msg TPCANTPTimestamp ts bool bStop false do Read the first message in the queue result CanTpApi Read CanTpApi PCANTP USBBUSI msg ts if result PCANTP ERROR OK Process the received messag MessageBox Show A message was received ProcessMessage msg else An error occurred MessageBox Show An error ocured Here can be decided if the loop has to be terminated bStop HandleReadError result while bStop Visual Basic Dim result As TPCANTPStatus Dim msg As TPCANTPMsg Dim ts As TPCANTPTimestamp Dim bStop As Boolean False Do Read the first message in the queue msg New TPCANTPMsg result CanTpApi Read CanTpApi PCANTP USBBUS1 msg ts If result TPCANTPStatus PCANTP ERROR OK Then Process the received messag MessageBox Show A message was received ProcessMessage msg Else An error occurred MessageBox Sho
71. UNEXP PDU 0x06 define WFT OVRN 0x07 define BUFFER OVFLW 0x08 define PCANTP N ERROR 0x09 Pascal OO 571 TPCANTPConfirmation OK 00 PCANTP N TIMEOUT A 01 TIMEOUT Bs 02 PCANTP N TIMEOUT Cr 03 WRONG SN 04 INVALID FS 05 UNEXP PDU 06 WFT OVRN 07 28 a PCAN ISO TP API Documentation User Guide System PCANTP N BUFFER OVFLW 08 ERROR 09 C public enum TPCANTPConfirmation byte OK 0x00 TIMEOUT A 0x01 TIMEOUT Bs 0 02 PCANTP N TIMEOUT Cr 0x03 WRONG SN 0x04 PCANTP N INVALID FS 0x05 PCANTP N UNEXP PDU 0x06 PCANTP OVRN 0x07 PCANTP N BUFFER OVFLW 0x08 PCANTP N ERROR 0x09 C CLR public enum class TPCANTPConfirmation Byte PCANTP OK 0x00 PCANTP N TIMEOUT A 0x01 TIMEOUT Bs 0 02 PCANTP N TIMEOUT Cr 0x03 WRONG SN 0x04 PCANTP N INVALID FS 0x05 PCANTP N UNEXP PDU 0x06 PCANTP OVRN 0x07 PCANTP N BUFFER OVFLW 0x08 PCANTP N ERROR 0x09 Visual Basic Public Enum TPCANTPConfirmation As Byte PCANTP OK 0x00 PCANTP TIMEOUT A amp HO1 PCANTP TIMEOUT Bs amp HO2
72. _ ByVal Language As UInt16 _ ByVal StringBuffer As StringBuilder As TPCANTPStatus End Function Parameters Parameters Description Error A TPCANTPStatus error code Language Indicates Primary language ID StringBuffer A buffer for a null terminated char array Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR WRONG PARAM Indicates that the parameters passed to the method are invalid Check the parameter Buffer it should point to a char array big enough to allocate the text for the given error code Remarks The Primary language IDs are codes used by Windows OS from Microsoft to identify a human language The PCAN Basic API currently support the following languages Language Primary Language ID Neutral System dependant OOh 0 English 09h 9 German 07h 7 French OCh 12 Italian 10h 16 Spanish OAh 10 51 50 Documentation User Guide System o Note If the buffer is to small for the resulting text the error 0 80008000 PCANTP ERROR CAN ERROR PCAN ERROR ILLPARAMVAL is returned Even when only short texts are being currently returned a text within this function can have a maximum of 255 characters For this reason it is recommended to use a buffer with a length of at least 256 bytes Example The following example shows the use of the method GetErrorT
73. age TimestampBuffer A TPCANTimestamp buffer to get the reception time of the message 94 E PCAN ISO TP API Documentation User Guide System Returns The return value is a TPCANTPStatus code PCANTP_ERROR_OK is returned on success The typical errors in case of failure are PCANTP ERROR NO MESSAGE Indicates that the receive queue of the Channel is empty PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application Remarks The message type see TPCANTPMessageType of a CAN ISO TP message indicates if the message is a complete ISO TP message diagnostic remote diagnostic a transmission confirmation or an indication of a pending message This value should be checked every time a message has been read successfully along with the RESULT value as it contains the network status of the message Specifying the value of NULL for the parameter TimestampBuffer causes reading a message without timestamp when the reception time is not desired Example The following example shows the use of the function CANTP Read on the channel PCANTP_USBBUS1 Depending on the result a message will be shown to the user Note It is assumed that the channel was already initialized C TPCANTPStatus result TPCANTPMsg msg TPCANTPTimestamp ts bool bStop false do Read the first message in the que
74. ageBox NULL Failed to set value Error MB OK else MessageBox NULL Value changed successfully Success MB OK See also CANTP GetValue on page 92 TPCANTPParameter on page 30 Class method Version GetValue 3 7 4 CANTP GetErrorText Gets a descriptive text for an error code Syntax C TPCANTPStatus __stdcall CANTP GetErrorText TPCANTPStatus Error WORD Language LPSTR Buffer Parameters Parameters Description Error A TPCANTPStatus error code Language Indicates Primary language ID StringBuffer A buffer for a null terminated char array Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR WRONG PARAM Indicates that the parameters passed to the method are invalid Check the parameter Buffer it should point to a char array big enough to allocate the text for the given error code Remarks The Primary language IDs are codes used by Windows OS from Microsoft to identify a human language The PCAN Basic API currently supports the following languages Language Primary Language ID Neutral System dependant OOh 0 English 09h 9 German 07h 7 French OCh 12 Italian 10h 16 Spanish OAh 10 o Note If the buffer is to small for the resulting text the error 0 80008000 PCANTP ERROR CAN ERROR PCAN ERROR ILLPARAMVAL is returned Even when only short texts are bei
75. ameter e g the size of the receive or transmit buffer Configures a hardware parameter e g the PEAK serial number and additional parameters for the PCAN USB hardware Configures net parameter Fields Client Functions for the management of the clients Function ConnectToNet DisconnectFromNet RegisterClient RegisterMsg RemoveAllMsgs RemoveClient ResetClient ResetHardware SetClientFilter SetClientFilterEx SetClientParam Description Connects a client to a PCAN net Disconnects a client from a PCAN net Registers an application as PCAN client Expands the reception filter of a client Resets the filter of a Client for a connected Net Removes a client from the driver Resets the receive and transmit queue of a client Resets a CAN hardware Configures the reception filter of a client Configures the reception filter of a client Configures a client parameter e g self receive mode of transmitted messages improve the accuracy of the reception filter 105 PCAN ISO TP API Documentation User Guide Fields Communication Functions for the data interchange over the CAN bus Function Read Read Multi Write Fields Information Functions for the information about clients nets drivers and hardware Function GetClientParam GetDeviceName GetDiagnostic GetDriverName GetDriverParam GetErrText GetHwParam GetNetParam GetSystemTime Msg2Text Status VersionInfo Description Reads a received CAN
76. anagedType U1 gt _ ByVal Parameter As TPCANTPParameter _ ByRef NumericBuffer As UInt32 _ ByVal BufferLength As Ulnt32 As TPCANTPStatus End Function 44 PCAN ISO TP API Documentation User Guide Parameters Parameters CanChanne Parameter NumericBuffer BufferLength Returns Description The handle of a PCANTP Channel see TPCANTPHandle on page 16 The code of the value to be set see TPCANTPParameter on page 30 The buffer containing the numeric value to be set The length in bytes of the given buffer System The return value is aTPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED PCANTP ERROR WRONG PARAM found in the list of reserved channels of the calling application Parameter and assert it is compatible with an integer buffer Indicates that the given PCANTP channel cannot be uninitialized because it was not Indicates that the parameters passedto the method are invalid Check the value of Remarks Use the method SetValue to set configuration information or environment values of a PCANTP Channel Note Any calls with non ISO TP parameters ie TPCANTPParameter will be forwarded to PCAN Basic API More information about the parameters and values that can be set can be found in Parameter Value Definitions Since most of the ISO TP parameters require a numeric value byte or integer this is the most
77. and extended addressing ISO TP message containing 4095 bytes of data Dim request As TPCANTPMsg New TPCANTPMsg request DATA New Byte 4095 request LEN request DATA Length request MSGTYPE TPCANTPMessageType PCANTP MESSAGE DIAGNOSTIC request IDTYPE TPCANTPIdType PCANTP ID CAN 11 request FORMAT TPCANTPFormatType PCANTP FORMAT EXTENDED request SA amp 1 request TA amp 7 pu a PCAN ISO TP API Documentation User Guide System request TA TYPE TPCANTPAddressingType PCANTP ADDRESSING PHYSICAL request RA amp H0 The message is sent using the PCAN USB Dim result As TPCANTPStatus CanTpApi Write CanTpApi PCANTP USBBUSI1 request If result TPCANTPStatus PCANTP ERROR OK Then Loop until the transmission confirmation is received Do result CanTpApi Read CanTpApi PCANTP USBBUS1 request MessageBox Show String Format Read 0 type 1 result 2 result request MSGTYPE request RESULT Loop While result TPCANTPStatus PCANTP ERROR NO MESSAGE Else An error occurred MessageBox Show Error occured result ToString End Pascal OO var prepare an 11bit CAN ID physically addressed using extended format and extended addressing ISO TP message containing 4095 bytes of data request TPCANTPMsg result TPCANTPStatus begin request LEN
78. at the error is composed of a more precise PCAN Basic error Remarks As indicated by its name the Initialize method initiates a PCANTP Channel preparing it for communication within the CAN bus connected to it Calls to the other methods will fail if they are used with a Channel handle different than PCANTP_NONEBUS that has not been initialized yet Each initialized channel should be released when it is not needed anymore 36 E PCAN ISO TP API Documentation User Guide System Initializing a PCANTP Channel means to reserve the Channel for the calling application process to allocate channel resources like receive and transmit queues to forward initialization to PCAN Basic API hence registering connecting the Hardware denoted by the channel handle to set up the default values of the different parameters see GetValue The Initialization process will fail if an application tries to initialize a PCANTP Channel that has already been initialized within the same process Take in consideration that initializing a channel causes a reset of the CAN hardware In this way errors like BUSOFF BUSHEAVY and BUSLIGHT are removed Example The following example shows the initialize and uninitialize processes for a Plug And Play channel channel 2 of a PCAN PCI hardware In case of failure the returned code will be translated to a text according with the operating system language in English German Italian French o
79. ate within the CAN bus connected to it Calls to the other methods will fail if they are used with a Channel handle different than PCANTP_NONEBUS that has not been initialized yet Each initialized channel should be released when it is not needed anymore 39 PCAN ISO TP API Documentation User Guide Initializing a PCANTP Channel means to reserve the Channel for the calling application process to allocate channel resources like receive and transmit queues System to forward initialization to PCAN Basic API hence registering connecting the Hardware denoted by the channel handle to set up the default values of the different parameters see GetValue The Initialization process will fail if an application tries to initialize a PCANTP Channel that has already been initialized within the same process Take in consideration that initializing a channel causes a reset of the CAN hardware In this way errors like BUSOFF BUSHEAVY and BUSLIGHT are removed Example The following example shows the initialize and uninitialize processes for a Non channel 1 of the PCAN DNG Ci Plug And Play channel TPCANTPStatus result The Non Plug amp Play Channel PCAN DNG is initialized result CanTpApi Initialize TPCANTPBaudrate PCANTP BAUD 500K TPCANTPHWType PCANTP TYP if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Initialization failed else MessageBox Show PCAN PCI C
80. ation RESULT C CLR public value struct TPCANMsg Byte SA Byte TA MarshalAs UnmanagedType U1 TPCANTPAddressingType TA TYPE Byte RA MarshalAs UnmanagedType U1 TPCANTPIdType IDTYPE MarshalAs UnmanagedType U1 TPCANTPMessageType MSGTYPE MarshalAs UnmanagedType U1 TPCANTPFormatType FORMAT MarshalAs UnmanagedType ByValArray SizeConst 4095 array Byte DATA unsigned short LEN MarshalAs UnmanagedType U1 TPCANTPConfirmation RESULT Visual Basic Public Structure TPCANMsg Public SA As Byte Public TA As Byte Public TA_TYPE As TPCANTPAddressingType Public RA As Byte lt MarshalAs UnmanagedType U1 gt _ Public IDTYPE As TPCANTPIdType 13 PCAN ISO TP API Documentation User Guide MarshalAs UnmanagedType U1 _ Public MSGTYPE As TPCANTPMessageType MarshalAs UnmanagedType U1 _ Public FORMAT As TPCANTPFormatType MarshalAs UnmanagedType ByValArray SizeConst 24095 _ Public DATA As Byte Public LEN As UShort MarshalAs UnmanagedType U1 _ Public RESULT As TPCANTPConfirmation End Structure System Fields Name Description SA Source Address TA Target Address TA TYPE Target Address Type RA Remote Address IDTYPE CAN ID configuration MSGTYPE Type of the message FORMAT Addressing format DATA Raw data of the message LEN Data Length Code DLC of the message 0 4095 RESULT Network status result See
81. atus TPCANTPHandle CanChannel Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR OK Indicates that the status of the given PCANTP Channel is OK PCANTP ERROR BUSLIGHT Indicates a bus error within the given PCANTP Channel The hardware is in bus light status PCANTP ERROR BUSHEAVY Indicates a bus error within the given PCANTP Channel The hardware is in bus heavy status PCANTP ERROR BUSOFF Indicates a bus error within the given PCANTP Channel The hardware is in bus off status PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application Remarks When the hardware status is bus off an application cannot communicate anymore Consider using the PCAN Basic property BUSOFF AUTORESET which instructs the API to automatically reset the CAN controller when a bus off state is detected Another way to reset errors like bus off bus heavy and bus light is to uninitialize and initialize again the channel used This causes a hardware reset Example The following example shows the use of the function CANTP_GetStatus on the channel PCANTP_PCIBUS1 Depending on the result a message will be shown to the user 93
82. atus GetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter StringBuilder StringBuffer UInt32 BufferLength 61 a PCAN ISO TP API Documentation User Guide System CLR DIlImport PCAN ISO TP dll EntryPoint GetValue static TPCANTPStatus GetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter StringBuilder StringBuffer UInt32 BufferLength Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint CANTP_GetValue gt _ Public Shared Function GetValue _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle _ lt MarshalAs UnmanagedType U1 gt _ ByVal Parameter As TPCANTPParameter _ ByVal StringBuffer As StringBuilder _ ByVal BufferLength As Ulnt32 As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Parameter The code of the value to retrieve see TPCANTPParameter on page 30 StringBuffer The buffer to return the required string value BufferLength The length in bytes of the given buffer Returns The return value is aTPCANTPStatus code PCANTP_ERROR_OK is returned on success The typical errors in case of failure are PCANTP_ERROR_NOT_INITIALIZED Indicates that the given PCANTP channel was not found in the list
83. citly to the non signaled state by the Win32 ResetEvent function Any number of waiting threads or threads that subsequently begin wait operations can be released while the object s state remains signaled e Trigger mode pulse All waiting threads that can be released immediately are released The event object s state is then reset to the non signaled state If no threads are waiting or if no thread can be released immediately the event object s state is simply set to non signaled See also CANTP_SetValue on page 87 class method SetValue Read on page 94 class method Read 108
84. d are invalid Check the value of Parameter and assert it is compatible with a string buffer Example The following example shows the use of the method GetValue on the channel PCANTP_USBBUS1 to retrieve the ISO TP separation time value STmin Depending on the result a message will be shown to the user o Note It is assumed that the channel was already initialized Ci TPCANTPHandle CanChannel CanTpApi PCANTP USBBUSI TPCANTPStatus result uint bufferLength 2 byte bufferArray new byte bufferLength Get the value of the ISO TP Separation Time STmin parameter result CanTpApi GetValue CanChannel TPCANTPParameter PCANTP PARAM SEPERATION TIME bufferArray sizeof byte bufferLength if result TPCANTPStatus PCANT P ERROR OK MessageBox Show Failed to get value else MessageBox Show bufferArray 0 ToString 67 a PCAN ISO TP API Documentation User Guide e System C CLR TPCANTPHandle CanChannel CanTpApi PCANTP USBBUS1 TPCANTPStatus result UInt32 bufferLength 2 array Byte bufferArray gcnew array lt Byte gt bufferLength Get the value of the ISO TP Separation Time STmin parameter result CanTpApi GetValue CanChannel PCANTP PARAM SEPERATION bufferArray sizeof Byte bufferLength if result PCANTP ERROR OK MessageBox Show Failed to get value
85. d because it was not found in the list of reserved channels of the calling application Remarks The message type see TPCANTPMessageType of a CAN ISO TP message indicates if the message is a complete ISO TP message diagnostic remote diagnostic a transmission confirmation or an indication of a pending message This value should be checked every time a message has been read successfully along with the RESULT value as it contains the network status of the message If the time when the message was received is needed use the overloaded Read TPCANTPHandle TPCANTPMsg TPCANTPTimestamp method Example The following example shows the use of the method Read on the channel PCANTP_USBBUS1 Depending on the result a message will be shown to the user Note It is assumed that the channel was already initialized Ci TPCANTPStatus result TPCANTPMsg msg bool bStop false do Read the first message in the queue result CanTpApi Read CanTpApi PCANTP USBBUS1 out msg if result TPCANTPStatus PCANTP ERROR OK Process the received messag MessageBox Show A message was received ProcessMessage msg else An error occurred MessageBox Show An error ocured Here can be decided if the loop has to be terminated bStop HandleReadError result while bStop C CLR TPCANTPStatus result TPCANTPMsg msg bool bStop false do Read the first messag
86. defined in the ISO TP standard it indicates to the sender the maximum number of consecutive frames that can be received without an intermediate FlowControl frame from the receiving network entity A value of 0 indicates that no limit is set and the sending network layer entity shall send all remaining consecutive frames Possible values 0x00 unlimited to OxFF Default value 10 PCAN Device All PCAN devices excluding PCANTP_NONEBUS channel PCANTP PARAM SEPARATION TIME Access W Description This value is used to set the SeparationTime STmin parameter defined in the ISO TP standard it indicates the minimum time the sender is to wait between the transmissions of two Consecutive Frames Possible values 0x00 to Ox7F range from Oms to 127ms Note As set in ISO TP standard values from OxF1 to OxF9 should define a range from 100 5 to 900us but due to system time resolution limitation those value are defaulted to 1ms Other values are ISO reserved Default value 10ms PCAN Device All PCAN devices excluding PCANTP_NONEBUS channel PCANTP_PARAM_DEBUG Access im T Description This parameter is used to control debug mode If enabled any received or transmitted CAN frames will be printed to the standard output Possible values DEBUG NONE disables debug mode and PCANTP DEBUG CAN enables it Default value DEBUG NONE PCAN Device All PCAN devices excluding PCANTP_NONEBUS channel
87. e U2 TPCANTPHandle CanChannel TPCANTP Msg MessageBuffer 78 E PCAN ISO TP API Documentation User Guide System Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint z CANTP Write _ Public Shared Function Write _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle _ ByRef MessageBuffer As TPCANTPMsg As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Message Buffer A TPCANTPMsg buffer containing the CAN ISO TP message to be sent Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel was not found in the list of initialized channels of the calling application or that a required CAN ID mapping was not found PCANTP ERROR WRONG PARAM The network addressing information of the message is not valid PCANTP ERROR NO MEMORY Failed to allocate memory and copy message in the transmission queue Remarks The Write function do not actually send the ISO TP message the transmission is asynchronous Should a message fail to be transmitted it will be added to the reception queue with a specific network error code in the RESULT value of the TPCANTPMsg Example The following example shows the use of the method Write the channel PCANTP_U
88. e in the queue result CanTpApi Read CanTpApi PCANTP_USBBUS1 msg 73 PCAN ISO TP API Documentation User Guide if result PCANTP ERROR OK Process the received messag MessageBox Show A message was received ProcessMessage msg else An error occurred MessageBox Show An error ocured Here can be decided if the loop has to be terminated bStop HandleReadError result while bStop System Visual Basic Dim result As TPCANTPStatus Dim msg As TPCANTPMsg Dim bStop As Boolean False Do Read the first message in the queue msg New TPCANTPMsg result CanTpApi Read CanTpApi PCANTP USBBUS1 msg If result TPCANTPStatus PCANTP ERROR OK Then Process the received messag MessageBox Show A message was received ProcessMessage msg Else An error occurred MessageBox Show An error ocured Here can be decided if the loop has to be terminated bStop HandleReadError result Eng If Loop While bStop False Pascal OO var result TPCANTPStatus msg TPCANTPMsg bStop Boolean begin bStop False repeat Read the first message in the queue result TCanTpApi Read TCanTpApi PCANTP_USBBUS1 msg if result PCANTP ERROR OK then begin Process the received message MessageBox 0 message was received Error MB OK ProcessMessage msg end else begin 74
89. echnik GmbH makes no representation or warranties with respect to the use of enclosed software or the contents of this manual and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose Further PEAK System Technik GmbH reserves the right to revise this publication and to make changes to its content at any time without obligation to notify any person or entity of such revisions or changes Copyright 2000 2014 PEAK System Technik GmbH All rights reserved No part of this publication may be reproduced photocopied stored on a retrieval system or transmitted without the express written consent of PEAK System Technik GmbH 2 4 Features Implementation of the ISO TP protocol ISO 15765 2 for the transfer of data packages up to 4095 Bytes via the CAN bus Windows DLLs for the development of 32 bit and 64 bit applications Physical communication via CAN using a CAN interface of the PCAN series Uses the PCAN Basic programming interface to access the CAN hardware in the computerLists bullets 2 5 System Requirements Windows 8 1 7 Vista 32 64 bit At least 512 MB RAM and 1 GHz CPU PC CAN interface from PEAK System PCAN Basic API 2 6 Scope of Supply Interface DLL examples and header files for all common programming languages Documentation in PDF format Documentation in HTML Help format PCAN ISO TP API Documentation User Guide System 3 DLL API Reference
90. ed in a single data block is 4095 bytes The exchange of data between nodes e g from Electronic Control Units ECU to ECU or between external test equipment and an ECU is supported by different addressing formats Each of them requires a different number of CAN frame data bytes to encapsulate the addressing information associated with the data to be exchanged This protocol is fully described in the norm ISO 15765 2 and is required by UDS Unified Diagnostic Services This later protocol is a communication protocol of the automotive industry and is described in the norm ISO 14229 1 PCAN ISO TP API is an implementation of the ISO TP standard The physical communication is carried out by PCAN Hardware PCAN USB PCAN PCI etc through the PCAN Basic API free CAN API from PEAK System Because of this it is necessary to have also the PCAN Basic API PCAN Basic dll present on the working computer where ISO TP is intended to be used PCAN ISO TP and PCAN Basic APIs are free and available for all people that acquire a PCAN Hardware 2 2 Using PCAN ISO TP Since PCAN ISO TP API is built on top of the PCAN Basic API most of its functions are similar It offers the possibility to use several PCANTP Channels within the same application in an easy way The communication process is divided in 3 phases initialization interaction and finalization of a PCANTP Channel Initialization In order to do CANTP communication i e CAN communication with ISO TP
91. efine unlimited blocksize bufferArray 0 0 result TCanTpApi SetValue TCanTpApi PCANTP_USBBUS1 PCANTP_PARAM_BLOCK_SIZE PLongWord bufferArray Length bufferArray if result lt gt PCANTP_ERROR_OK then MessageBox 0 Failed to set value Error MB OK else MessageBox 0 Value changed successfully Error MB_OK end See also GetValue on page 61 TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Plain function version CANTP_SetValue 3 6 9 GetErrorText TPCANStatus UInt16 StringBuilder Gets a descriptive text for an error code Syntax Pascal OO class function GetErrorText Error TPCANTPStatus Language Word StringBuffer PAnsiChar TPCANTPStatus 50 PCAN ISO TP API Documentation User Guide Ci System DllImport PCAN ISO TP dll EntryPoint CANTP GetErrorText public static extern TPCANTPStatus GetErrorText MarshalAs UnmanagedType U4 TPCANTPStatus Error Ulnt16 Language StringBuilder StringBuffer C CLR DIlImport PCAN ISO TP dll EntryPoint CANTP_GetErrorText static TPCANTPStatus GetErrorText MarshalAs UnmanagedType U4 TPCANTPStatus Error Ulnt16 Language StringBuilder StringBuffer Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint CANTP_GetErrorText gt _ Public Shared Function GetErrorText _ lt MarshalAs UnmanagedType U4 gt _ ByVal anError As TPCANTPStatus
92. em through the TMC Recommended Practices 1210 version A as known as RP1210 A Peak Can IsoTp The Peak Can IsoTp namespace contains types and classes to use the PCAN ISO TP API within the NET Framework programming environment and handle PCAN devices from PEAK System Remarks Under the Delphi environment these elements are enclosed in the PCANTP Unit The functionality of all elements included here is just the same The difference between this namespace and the Delphi unit consists in the fact that Delphi accesses the Windows API directly it is not Managed Code Aliases Li Classes 8 Alias TPCANTPHandle Class CanTpApi Description Represents a PCAN ISO TP channel handle Description Defines a class which represents the PCAN ISO TP API PCAN ISO TP API Documentation User Guide Structures Class TPCANTPMsg System Description Defines a CAN ISO TP message The members of this structure are sequentially byte aligned TPCANTPTimestamp Defines a time stamp of a CAN ISO TP message Enumerations LJL Me o f Me 3 2 Name TPCANTPStatus TPCANTPBaudrate TPCANTPHWType TPCANTPMessageType TPCANTPIdType TPCANTPFormatType TPCANTPAddressingType TPCANTPConfirmation TPCANTPParameter Units Description Represents a PCAN ISO TP status error code Represents a PCAN Baud rate register value Represents the type of PCAN hardware to be initialized Represents the type of a PCAN
93. eter PCANTP PARAM SEPERATION TIME iBuffer Convert ToUInt32 Len iBuffer 65 a PCAN ISO TP API Documentation User Guide System If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to get value Else MessageBox Show iBuffer ToString End ITE Pascal OO var CanChannel TPCANTPHandle result TPCANTPStatus iBuffer UINT begin CanChannel USBBUS1 Get the value of the ISO TP Separation Time STmin parameter result TCanTpApi GetValue CanChannel PCANTP PARAM SEPERATION TIME PLongWord iBuffer sizeof iBuffer if result PCANTP ERROR OK then MessageBox 0 Failed to get value Error MB OK else MessageBox 0 PAnsiChar AnsiString Format STmin 96d Integer iBuffer Success OK end See also SetValue on page 43 TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Plain function version CANTP GetValue 3 6 15 GetValue TPCANTPHandle TPCANTPParameter byte UInt32 Retrieves information from a PCAN Channel in a byte array Syntax C DllImport PCAN ISO TP dll EntryPoint CANTP GetValue public static extern TPCANTPStatus GetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter MarshalAs UnmanagedType LPArray Out Byte Buffer UInt32 BufferLength
94. ext to get the description of an error The language of the description s text will be the same used by the operating system if its language is supported otherwise English is used Ci TPCANTPStatus result StringBuilder strMsg strMsg new StringBuilder 256 Gets the description text for PCANTP ERROR ALREADY INITIALIZED using the Neutral language result CanTpApi GetErrorText TPCANTPStatus PCANTP ERROR AL if result TPCANTPStatus PCANTP EADY INITIALIZED 0 strMsg RROR_OK 2 error occurred MessageBox Show An error occured else MessageBox Show strMsg ToString CLR TPCANTPStatus result StringBuilder strMsg strMsg gcnew StringBuilder 2560 Gets the description text for PCANTP ERROR ALREADY INITIALIZED using the Neutral language result CanTpApi GetErrorText PCANTP ERROR ALREADY INITIALIZI if result PCANTP ERROR OK D 0 strMsg error occurred MessageBox Show An error occured else MessageBox Show strMsg gt ToString Visual Basic Dim result As TPCANTPStatus Dim strMsg As StringBuilder strMsg New StringBuilder 256 Gets the description text for PCANTP ERROR ALREADY INITIALIZED using the Neutral language result CanTpApi GetErrorText _ TPCANTPStatus PCANTP ERROR ALREADY INITIALIZED 0 strMsg If re
95. f result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to set value Else MessageBox Show Value changed successfully End if Pascal OO var result TPCANTPStatus iBuffer UINT begin Enable CAN DEBUG mode iBuffer TCanTpApi PCANTP_DEBUG_CAN result TCanTpApi SetValue TCanTpApi PCANTP_PCIBUS2 PCANTP_PARAM_DEBUG PLongWord iBuffer sizeof iBuffer if result lt gt PCANTP_ERROR_OK then MessageBox 0 Failed to set value Error MB OK else MessageBox 0 Value changed successfully Error MB_OK end See also GetValue on page 61 TPCANTPParameter on page 30 Parameter Value Defintions on page 100 Plain function version CANTP GetValue 3 6 7 SetValue TPCANTPHandle TPCANTPParameter StringBuffer Uint32 Sets a configuration or information string value within a PCANTP Channel Syntax Pascal OO class function SetValue CanChannel TPCANTPHandle Parameter TPCANTPParameter StringBuffer PAnsiChar BufferLength LongWord TPCANTPStatus overload 46 a PCAN ISO TP API Documentation User Guide System C DllImport PCAN ISO TP dll EntryPoint CANTP SetValue public static extern TPCANTPStatus SetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter MarshalAs UnmanagedType LPStr SizeParamIndex 3 stri
96. h 2 was initialized All initialized channels are released CanTpApi Uninitialize CanTpApi PCANTP NONEBUS C CLR CanTpApi PCANTP DNGBUS1 E DNG SJA 0x378 7 TPCANTPStatus result The Non Plug amp Play Channel PCAN DNG is initialized result PCANTP TYPE DNG SJA 0x378 7 if result PCANTP ERROR OK MessageBox Show Initialization failed else MessageBox Show PCAN PCI Ch 2 was initialized All initialized channels are released CanTpApi Uninitialize CanTpApi PCANTP_NONEBUS CanTpApi Initialize CanTpApi PCANTP DNGBUSI PCANTP BAUD 500K Visual Basic Dim result As TPCANTPStatus The Non Plug amp Play Channel PCAN DNG is initialized result CanTpApi Initialize TPCANTPBaudrate PCANTP BAUD 500K TPCANTPHWType PCANTP TYP If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Initialization failed CanTpApi PCANTP DNGBUSI E DNG SJA amp H378 7 40 a PCAN ISO TP API Documentation User Guide System Else MessageBox Show PCAN PCI Ch 2 was initialized Eng All initialized channels are released CanTpApi Uninitialize CanTpApi PCANTP NONEBUS Pascal OO var result TPCANTPStatus begin The Non Plug amp Play Channel PCAN DNG is initialized result TCanTpApi Initialize TCanTpApi PCANTP DNGBUS1 BAUD 500K PCANT
97. h for all channels initialized by the calling application and release them all This option cause no errors if no hardware were uninitialized Example The following example shows the initialize and uninitializes processes for a Plug And Play channel channel 2 of a PCAN PCI hardware C TPCANTPStatus result The Plug amp Play Channel PCAN PCI is initialized result CANTP Initialize 52 PCANTP BAUD 500K if result PCANTP ERROR_OK MessageBox NULL Initialization failed Error MB OK else MessageBox NULL PCAN PCI Ch 2 was initialized Success MB OK Release channel CANTP Uninitialize PCANTP PCIBUS2 See also CANTP_Initialize on page 84 Class method version Uninitilize 86 E PCAN ISO TP API Documentation User Guide System 3 7 3 CANTP SetValue Sets a configuration or information value within a PCANTP Channel Syntax C TPCANTPStatus stdcall CANTP SetValue TPCANTPHandle CanChannel TPCANTPParameter Parameter void Buffer DWORD BufferLength Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Parameter The code of the value to be set see TPCANTPParameter on page 30 Buffer The buffer containing the numeric value to be set BufferLength The length in bytes of the given buffer Returns The return value is a TPCANTPStatus code
98. ialized ex a non initialized CANTP channel or CAN ID mapping Already initialized used by CANTP Channel or CAN ID mapping Failed to allocate memory Buffer overflow occurred too many channels initialized or too many messages in queue Timeout while trying to access the PCAN ISO TP API No message available Invalid parameter Bus error an error counter reached the light limit Bus error an error counter reached the heavy limit Bus error the CAN controller is in bus off state PCAN Basic error flag remove the flag to get a TPCANStatus error code Represents a PCAN Baud rate register value According with the programming language this type can be a group of defined values or an enumeration Syntax C define TPCANBaudrate WORD define PCANTP_BAUD_1M 0x0014 define PCANTP_BAUD_ 800K 0x0016 define PCANTP_BAUD_500K 0x001C define PCANTP_BAUD_250K 0x011C define PCANTP_BAUD_125K 0x031C define PCANTP_BAUD_100K 0x432F define PCANTP_BAUD_95K OxC34E define PCANTP_BAUD_ 83K 0x852B define BAUD 50K 0x472F define BAUD 47K Ox1414 define BAUD 33K Ox8B2F define BAUD 20K 0x532F define BAUD 10K 0x672F define BAUD 5K Ox7F7F Pascal OO 22 TPCANBaudrate PCANTP BAUD 1M 50014 L 19 2 150 Documentation User Guide System PCANTP BAUD 800 0016 PCANTP BAUD 500 001
99. include the defined aliases If it is wished to work with aliases those must be copied to the working file right after the inclusion of the Peak Can IsoTp Namespace Otherwise just use the native type which in this case is a Byte 16 E PCAN ISO TP API Documentation User Guide System Ci using System using Peak Can IsoTp using TPCANTPHandle System Int16 Alias s declaration for System Byte Visual Basic Imports System Imports Peak Can Uds Imports TPCANTPHandle System Int16 Alias declaration for System Byte See also PCAN ISO TP Handle Definitions on page 99 3 5 2 TPCANTPStatus Represents a PCANTP status error code According with the programming language this type can be a group of defined values or an enumeration Syntax C Syntax ttdefine ERROR OK 0x00000 define ERROR NOT INITIALIZED 0x00001 define ERROR ALREADY INITIALIZED 0x00002 ttdefine ERROR NO MEMORY 0x00003 define ERROR OVERFLOW 0x00004 ttdefine ERROR TIMEOUT 0x00006 define ERROR NO MESSAGE 0x00007 ttdefine ERROR WRONG PARAM 0x00008 ttdefine ERROR BUSLIGHT 0x00009 define ERROR BUSHEAVY 0x0000A ttdefine ERROR BUSOFF 0x0000B ttdefine PCANTP ERROR CAN ERROR 0x80000000 C CLR public enum TPCANTPStatus unsigned int PCANTP_
100. ing four PCAN USB connected to a computer will let the user to connect the channels PCANTP USBBUS1 to USBBUSA The association of each channel with hardware is managed internally using the handle of hardware See also Parameter Value Defintions below 3 8 2 Parameter Value Defintions Defines the possible values for setting and getting PCAN ISO TP environment information with the functions PCANTP SetValue and PCANTP GetValue Debug Configuration values Type Constant Valu Description e 35 Int32 PCANTP_DEBUG_NONE 0 No CAN debug messages are being generated Int32 PCANTP DEBUG CAN 1 CAN debug messages are written to the stdout output Channel Available values Type Constant Valu Description e 5j Int32 PCANTP CHANNEL UNAVAILABLE 0 The ISO TP PCAN Channel handle is illegal or its associated hardware is not available a Int32 PCANTP CHANNEL AVAILABLE 1 The ISO TP PCAN Channel handle is valid to connect initialize Furthermore for plug amp play hardware this means that the hardware is plugged in 100 E PCAN ISO TP API Documentation User Guide System Type Constant Valu Description e Int32 PCANTP_CHANNEL_OCCUPIED 2 The ISO TP PCAN Channel handle is valid and is currently being used ISO TP WaitForFrame parameter values Type Constant Valu Description e Int32 PCANTP_WFT_MAX_UNLIMITED OxOO This value disables checks for ISO TP WaitForFrames overrun when receiving a FlowControl frames PCA
101. itialize TPCANTPHandle TPCANTPBaudrate Initializes a Non Plug And Play PCANTP Channel TPCANTPHWType UlInt32 Ulnt16 E PCAN ISO TP API Documentation User Guide System 3 6 2 Initialize TPCANTPHandle TPCANTPBaudrate Initializes a PCANTP Channel which represents a Plug amp Play PCAN Device Syntax Pascal OO class function Initialize CanChannel TPCANTPHandle Baudrate TPCANTPBaudrate TPCANTPStatus overload Ci public static TPCANTPStatus Initialize MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel TPCANTPBaudrate Baudrate C CLR static TPCANTPStatus Initialize MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U2 TPCANTPBaudrate Baudrate Visual Basic Public Shared Function Initialize _ MarshalAs UnmanagedType U2 _ ByVal CanChannel As TPCANTPHandle _ MarshalAs UnmanagedType U2 _ ByVal Baudrate As TPCANTPBaudrate As TPCANTPStatus End Function Parameters Parameters Description CANChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Baudrate The speed for the communication see TPCANTPBaudrate on page 19 Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR ALREADY INITIALIZED Indicates that the desired PCANTP Channel is already in use PCANTP ERROR CAN ERROR This error flag states th
102. lue on the channel PCANTP_USBBUS1 to define the use of unlimited block size during ISO TP communication Note It is assumed that the channel was already initialized Ci TPCANTPStatus result Define unlimited blocksize result CanTpApi SetValue CanTpApi PCANTP USBBUSI TPCANTPParameter PCANTP PARAM BLOCK SIZE new byte 0 1 if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Failed to set value else MessageBox Show Value changed successfully C CLR TPCANTPStatus result Define unlimited blocksize result CanTpApi SetValue CanTpApi PCANTP USBBUS1 PCANTP PARAM BLOCK SIZE gcnew array lt Byte gt 0 1 if result PCANTP ERROR OK MessageBox Show Failed to set value else MessageBox Show Value changed successfully 49 E PCAN ISO TP API Documentation User Guide System Visual Basic Dim result As TPCANTPStatus Dim bufferArray 2 As Byte Define unlimited blocksize bufferArray 0 0 result CanTpApi SetValue CanTpApi PCANTP_USBBUS1 TPCANTPParameter PCANTP PARAM BLOCK SIZE bufferArray Convert ToUInt32 bufferArray Length If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Failed to set value Else MessageBox Show Value changed successfully Enc If Pascal OO var result TPCANTPStatus bufferArray array 0 2 of Byte begin D
103. mapping between a CAN ID and an ISO TP network addressing information a E CANTP_RemoveMapping Removes a previously configured ISO TP mapping Information Function Description CANTP GetValue Retrieves information from a PCANTP Channel E CANTP_GetStatus Retrieves the current BUS status of a PCANTP Channel E CANTP_GetErrorText Gets a descriptive text for an error code Communication Function Description CANTP_Read Reads a CAN message from the receive queue of a PCANTP Channel CANTP_Write Transmits a CAN message using a connected PCANTP Channel CANTP_Reset Resets the receive and transmit queues of a PCANTP Channel 3 7 1 Initialize Initializes a PCANTP Channel Syntax C System TPCANTPStatus stdcall CANTP Initialize TPCANTPHandle Channel TPCANTPBaudrate Baudrate TPCANTPHWType HwType 0 DWORD IOPort 0 WORD Interrupt 0 84 E PCAN ISO TP API Documentation User Guide System Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Baudrate The speed for the communication see TPCANTPBaudrate on page 19 HwType The type of hardware see TPCANTPHWType on page 21 lOPort The I O address for the parallel port Interrupt Interrupt number of the parallel port Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR ALREADY INITIALIZE
104. n or information string value within a PCANTP Channel TPCANTPParameter String UInt32 43 E PCAN ISO TP API Documentation User Guide System Function Description a SetValue TPCANTPHandle Sets a configuration or information with an array of bytes within a PCANTP Channel TPCANTPParameter Byte UInt32 3 6 6 SetValue TPCANTPHandle TPCANTPParameter UInt32 Uint32 Sets a configuration or information numeric value within a PCANTP Channel Syntax Pascal OO class function SetValue CanChannel TPCANTPHandle Parameter TPCANTPParameter NumericBuffer PLongWord BufferLength LongWord TPCANTPStatus overload Ci DllImport PCAN ISO TP dll EntryPoint SetValue public static extern TPCANTPStatus SetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter ref Ulnt32 NumericBuffer UInt32 BufferLength C CLR DIlImport PCAN ISO TP dll EntryPoint SetValue static TPCANTPStatus SetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter UInt3296 NumericBuffer UInt32 BufferLength Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint CANTP_SetValue gt _ Public Shared Function SetValue lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle _ lt MarshalAs Unm
105. ng StringBuffer UInt32 BufferLength CLR DIlImport PCAN ISO TP dll EntryPoint SetValue static TPCANTPStatus SetValue MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U1 TPCANTPParameter Parameter MarshalAs UnmanagedType LPStr SizeParamIndex 3 String StringBuffer UInt32 BufferLength Visual Basic Dllimport PCAN ISO TP dil EntryPoint CANTP_SetValue gt _ Public Shared Function SetValue MarshalAs UnmanagedType U2 _ ByVal CanChannel As TPCANTPHandle _ MarshalAs UnmanagedType U1 _ ByVal Parameter As TPCANTPParameter _ MarshalAs UnmanagedType LPStr 3 gt _ ByVal StringBuffer As String _ ByVal BufferLength As Ulnt32 As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Parameter The code of the value to be set see TPCANTPParameter on page 30 NumericBuffer The buffer containing the string value to be set BufferLength The length in bytes of the given buffer Returns The return value is aTPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application 47 E PCAN I
106. ng currently returned a text within this function can have a maximum of 255 characters For this reason it is recommended to use a buffer with a length of at least 256 bytes 88 PCAN ISO TP API Documentation User Guide Example System The following example shows the use of the method GetErrorText to get the description of an error The language of the description s text will be the same used by the operating system if its language is supported otherwise English is used C TPCANTPStatus result char strMsg 256 Gets the description text for PCANTP ERROR ALREADY INITIALIZED using the Neutral language result CANTP GetErrorText PCANTP ERROR ALREADY INITIALIZED 0 strMsg if result PCANTP ERROR OK An error occurred MessageBox NULL An error occured Error MB OK else MessageBox NULL strMsg Success See also Primary language ID 3 7 5 CANTP AddMapping Adds a mapping between a CAN ID and an ISO TP network addressing information within a PCANTP channel Syntax C TPCANTPStatus stdcall CANTP AddMapping TPCANTPHandle CanChannel DWORD canID DWORD canIDResponse TPCANTPIdType canIdTyrpe TPCANTPFormatType formatType TPCANTPMessageType msgType BYTE sourceAddr BYTE targetAddr TPCANTPAddressingType targetType BYTE remoteAddr Parameters Parameters Description CanChannel The handle
107. of a PCANTP Channel see TPCANTPHandle on page 16 The CAN Identifier to be mapped canldReponse canldType formatType msgType sourceAddr targetAddr targetType remoteAddr The CAN Identifier that is used to respond to a request with the CAN Id canld The type of CAN identifier The format type of the ISO TP network addressing information The ISO TP message type The source address The target address The type of the target The remote address 89 PCAN ISO TP API Documentation User Guide e Returns System The return value is aTPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are ERROR NOT INITIALIZED PCANTP ERROR ALREADY INITIALIZED PCANTP ERROR WRONG PARAM PCANTP ERROR NO MEMORY Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application A mapping with the same CAN ID already exists Mapping is not valid in regards to ISO TP standard Failed to allocate memory to define mapping Remarks The following table summarizes requirements to get a valid mapping based on the addressing format type FormatType parameter Valid valid msgType parameter valid valid canIdType targetType remoteAddr parameter parameter parameter PCANTP FORMAT NORMAL Any PCANTP MESSAGE DIAGNOSTIC Any values 0x00 value is ignored PCANTP_FORMAT_EXTENDED
108. off status Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application 69 E PCAN ISO TP API Documentation User Guide System Remarks When the hardware status is bus off an application cannot communicate anymore Consider using the PCAN Basic property PCAN_BUSOFF_AUTORESET which instructs the API to automatically reset the CAN controller when a bus off state is detected Another way to reset errors like bus off bus heavy and bus light is to uninitialize and initialize again the channel used This causes a hardware reset Example The following example shows the use of the method GetStatus on the channel PCIBUS1 Depending on the result a message will be shown to the user Note It is assumed that the channel was already initialized Ci TPCANTPStatus result Check the status of the PCI Channel result CanTpApi GetStatus CanTpApi PCANTP PCIBUS1 switch result case TPCANTPStatus PCANTP ERROR BUSLIGHT PCI Ch 1 Handling a BUS LIGHT SLtatus RROR BUSHEAVY CI Ch 1 Handling a BUS HEAVY status rg break case TPCANTPStatus PCANTP ERROR BUSOFF MessageBox Show PCAN PCI Ch 1 Handling a BUS OFF status break case TPCANTPStatus PCANTP ERROR OK MessageBox Show PCAN P
109. owing types Name Description TPCANTPHandle Represents a PCAN ISO TP hardware channel handle TPCANTPStatus Represents a PCAN ISO TP status error code TPCANTPBaudrate Represents a PCAN Baud rate register value TPCANTPHWType Represents the type of PCAN hardware to be initialized TPCANTPMessageType Represents the type of a PCAN ISO TP message TPCANTPIdType Represents the CAN ID type of a PCAN ISO TP message TPCANTPFormatType Represents the type of format of a PCAN ISO TP message TPCANTPAddressingType Represents the type of message addressing of a PCAN ISO TP message TPCANTPConfirmation Represents the network status of a communicated PCAN ISO TP message TPCANTPParameter Represents a PCAN ISO TP parameter to be read or set 3 5 1 TPCANTPHandle Represents a PCAN ISO TP channel handle Syntax C Syntax define TPCANTPHandle WORD C CLR Hdefine TPCANTPHandle System Int16 C Syntax using TPCANTPHandle System Int16 Visual Basic Syntax Imports TPCANTPHandle System Int16 Remarks TPCANTPHandle is defined for the ISO TP API but it is identical to a TPCANHandle from PCAN Basic API NET Framework programming languages An alias is used to represent a Channel handle under Microsoft NET in order to originate a homogeneity between all programming languages listed above Aliases are defined in the Peak Can IsoTp Namespace for C and VB NET However including a namespace does not
110. r Spanish and it will be shown to the user CH TPCANTPStatus result The Plug amp Play Channel PCAN PCI is initialized result CanTpApi Initialize CanTpApi PCANTP_PCIBUS2 TPCANTPBaudrate PCANTP BAUD 500K if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Initialization failed else MessageBox Show PCAN PCI Ch 2 was initialized All initialized channels are released CanTpApi Uninitialize CanTpApi PCANTP NONEBUS C CLR TPCANTPStatus result The Plug amp Play Channel PCAN PCI is initialized result CanTpApi Initialize CanTpApi PCANTP PCIBUS2 PCANTP BAUD 500K if result PCANTP ERROR OK MessageBox Show Initialization failed else MessageBox Show PCAN PCI Ch 2 was initialized All initialized channels are released CanTpApi Uninitialize CanTpApi PCANTP NONEBUS Visual Basic Dim result As TPCANTPStatus The Plug amp Play Channel PCAN PCI is initialized result CanTpApi Initialize CanTpApi PCANTP PCIBUS2 TPCANTPBaudrate PCANTP BAUD 500K If result lt gt TPCANTPStatus PCANTP ERROR OK Then MessageBox Show Initialization failed 37 a PCAN ISO TP API Documentation User Guide System Else MessageBox Show PCAN PCI Ch 2 was initialized Eng If All initialized channels are released CanTpApi Uninitialize CanTpApi PCANTP NONEBUS
111. red Interaction After a successful initialization a channel is ready to communicate with the connected CAN bus Further configuration is not needed The functions Read and CAN Write class methods Read and Write can be then used to read and write CAN messages If the channel being used is FD capable and it was initialized using CAN InitializedFD then the functions to use are CAN ReadFD and CAN WriteFD class methods ReadFD and WriteFD If desired extra configuration can be made to improve a communication session like changing the message filter to target specific messages Finalization When the communication is finished the function CAN Uninitialize class method Uninitialize should be called in order to release the PCAN Channel and the resources allocated for it In this way the channel is marked as Free and can be used from other applications 103 PCAN ISO TP API Documentation User Guide Hardware and Drivers Overview of the current PCAN hardware and device drivers Hardware PCAN Dongle PCAN ISA PCAN PC 104 PCAN PCI PCAN PCI Express PCAN cPCI PCAN miniPCl PCAN PC 104 Plus PCAN USB PCAN USB Pro PCAN PC Card Plug and Play Driver Hardware No Pcan_dng sys No Pcan_isa sys No Pcan_isa sys Yes Pcan_pci sys Yes Pcan_pci sys Yes Pcan_pci sys Yes Pcan_pci sys Yes Pcan_pci sys Yes Pcan_usb sys Yes Pcan_usb sys Yes Pcan_pcc sys See also PCAN Fundamentals on page 102 PCAN API on page 105 ISO TP netwo
112. red MessageBox Show Error occured result ToString C CLR TPCANTPStatus result prepare an llbit CAN ID physically addressed using extended format and extended addressing ISO TP message containing 4095 Bytes of data TPCANTPMsg request gcnew TPCANTPMsg request gt DATA gcnew array Byte 4095 request LEN unsigned short request DATA Length request 2MSGTYPE PCANTP MESSAGE DIAGNOSTIC request gt IDTYPE PCANTP ID CAN 11 request 2FORMAT PCANTP FORMAT EXTENDED request gt SA 0 1 request gt TA 0 7 gt PCANTP ADDRESSING PHYSICAL request gt RA 0x00 The message is sent using the PCAN USB result CanTpApi Write CanTpApi PCANTP USBBUS1 request if result PCANTP ERROR OK Loop until the transmission confirmation is received do result CanTpApi Read CanTpApi PCANTP USBBUSI request MessageBox Show String Format Read 0 type 1 result 2 int result ToString int request gt MSGTYPE ToString int request gt RESULT ToString while result PCANTP ERROR NO MESSAGE else An error occurred MessageBox Show String Format Error occured 0 int result Visual Basic prepare llbit CAN ID physically addressed using extended format
113. ription This parameter is used to define if the API should uses CAN data optimization or CAN data padding the first case will optimize the CAN DLC to avoid sending unnecessary data on the other hand with CAN data padding the API will always send CAN frames with a DLC of 8 and pads the data with zeroes Possible values PCANTP DATA PADDING NONE disables data padding enabling CAN data optimization and PCANTP CAN DATA PADDING ON enables data padding Default value PCANTP CAN DATA PADDING ON since ECUs that do not support CAN data optimization may not respond to CAN TP messages PCAN Device All PCAN devices excluding PCANTP_NONEBUS channel PCANTP PARAM RECEIVE EVENT Access E Tu Description This parameter is used to let the PCAN ISO TP API notify an application when ISO TP messages are available to be read In this form message processing tasks of an application can react faster and make a more efficient use of the processor time Possible values This value has to be a handle for an event object returned by the Windows API function CreateEvent or the value 0 IntPtr Zero in a managed environment When setting this parameter the value of 0 resets the parameter in the PCAN ISO TP API Reading a value of indicates that no event handle is set For more information about reading with events please refer to the topic Using Events Default value Disabled 0 PCAN Device All PCAN devices excluding PCANTP_NONEBUS channel
114. rk addressing format on page 107 104 System PCAN ISO TP API Documentation User Guide 4 3 System Also called CanApi2 interface is a synonym for CAN Application Programming Interface version 2 and is a comprehensively programming interface to the PCAN system of the company PEAK System Technik GmbH This interface is more comprehensive than PCAN Basic Important difference to PCAN Basic Transmit a CAN message at a fixed point of time Several application programs could be connected to one PCAN PC hardware Detailed information to PCAN PC hardware and the PCAN system PCAN net and PCAN client The PCAN client is connected via the net to the PCAN PC hardware The following text is a short overview to the CanApi2 functions The functions itself can be categorized as follows Fields Control Register and remove functions for nets and hardware Function CloseAll RegisterHardware RegisterHardwarePCl RegisterNet RemoveHardware RemoveNet Description Disconnects all hardware nets and clients Registers a Not Plug and Play CAN hardware Registers a PCI CAN hardware Defines of a PCAN net Removes and deactivates CAN hardware Removes a PCAN net Fields Configuaration Configuration functions for nets and hardware Function SetDeviceName SetDriverParam SetHwParam SetNetParam Description Sets the PCAN device to be used for subsequent CanApi2 function calls Configures a driver par
115. s already initialized 97 E PCAN ISO TP API Documentation User Guide System C TPCANTPStatus result The PCI Channel is reset result CANTP Reset PCANTP_PCIBUS1 if result PCANTP ERROR OK An error occurred MessageBox NULL An error occured Error MB OK else MessageBox NULL PCAN PCI Ch 1 was reset Success MB See also CANTP Uninitialize on page 86 Class method Version Reset 98 PCAN ISO TP API Documentation User Guide System 3 8 Definitions The PCAN Basic API defines the following values Name PCAN ISO TP Handle Definitions Description Defines the handles for the different PCAN channels Parameter Value Defintions Defines the possible values for setting and getting PCAN s environment information with the functions CANTP_SetValue and CANTP GetValue 3 8 1 PCAN ISO TP Handle Definitions Defines the handles for the different PCAN buses Channels within a class This values are used as parameter where a TPCANTPHandle is needed Default Undefined handle ET Handles for the ISA Bus Not Plug amp Play Type TPCANTPHandle Constant PCANTP NONEBUS value 0x0 Description Undefined default value for a PCAN ISO TP Channel Type Constant value Description 5j TPCANTPHandle ISABUS1 0x21 PCAN ISA interface channel 1 TPCANTPHandle ISABUS2 0x22 PCAN I
116. sult TPCANTPStatus PCANTP ERROR OK Then 52 a PCAN ISO TP API Documentation User Guide System An error occurred MessageBox Show An error occured Else MessageBox Show strMsg ToString End If Pascal OO var result TPCANTPStatus strMsg array 0 256 of Char begin Gets the description text for PCANTP ERROR ALREADY INITIALIZED using the Neutral language result TCanTpApi GetErrorText PCANTP ERROR ALREADY INITIALIZED O strMsg if result lt gt PCANTP ERROR OK then An error occurred MessageBox 0 error occured MB OK else MessageBox 0 strMsg Success MB OK end See also Primary language ID 3 6 10 AddMapping Adds a mapping between a CAN ID and an ISO TP network addressing information within a PCANTP channel Syntax Pascal OO class function AddMapping CanChannel TPCANTPHandle canlD LongWord canlDResponse LongWord canldType TPCANTPIdType formatType TPCANTPFormatType msgType TPCANTPMessageType sourceAddr Byte targetAddr Byte targetType TPCANTPAddressingType remoteAddr Byte TPCANTPStatus Ci DllImport PCAN ISO TP dll EntryPoint CANTP_AddMapping public static extern TPCANTPStatus AddMapping MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel uint canID 53 PCAN ISO TP API Documentation User Guide uin
117. t CANTP Reset static TPCANTPStatus Reset MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint z CANTP Reset _ Public Shared Function Reset _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Returns The return value is a TPCANTPStatus code PCANTP_ERROR_OK is returned on success The typical errors in case of failure are PCANTP_ERROR_NOT_INITIALIZED Indicates that the given PCANTP channel was not found in the list of initialized channels of the calling application Remarks Calling this method ONLY clear the queues of a Channel A reset of the CAN controller doesn t take place Example The following example shows the use of the method Reset on the channel PCANTP_PCIBUS1 Depending on the result a message will be shown to the user 82 PCAN ISO TP API Documentation User Guide o Note It is assumed that the channel was already initialized Ci System TPCANTPStatus result The PCI Channel is reset result CanTpApi Reset CanTpApi PCANTP PCIBUS1 if result TPCANTPStatus PCANTP ERROR OK An error occurred MessageBox Show An error occured else MessageBox Show PCAN PCI Ch 1 was reset C CLR T
118. t canlIDResponse MarshalAs UnmanagedType U1 TPCANTPIdType canldType MarshalAs UnmanagedType U1 TPCANTPFormatType formatType MarshalAs UnmanagedType U1 TPCANTPMessageType msgType byte sourceAddr byte targetAddr MarshalAs UnmanagedType U1 TPCANTPAddressingType targetType byte remoteAddr System CLR DIlImport PCAN ISO TP dll EntryPoint AddMapping static TPCANTPStatus AddMapping MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel UInt32 canID Ulnt32 canlDResponse MarshalAs UnmanagedType U1 TPCANTPIdType canldType MarshalAs UnmanagedType U1 TPCANTPFormatType formatType MarshalAs UnmanagedType U1 TPCANTPMessageType msgType Byte sourceAddr Byte targetAddr MarshalAs UnmanagedType U1 TPCANTPAddressingType targetType Byte remoteAddr Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint CANTP_AddMapping gt _ Public Shared Function AddMapping _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle _ ByVal canID As Ulnt32 _ ByVal canlDResponse As UInt32 _ lt MarshalAs UnmanagedType U1 gt _ ByVal canldType As TPCANTPIdType _ MarshalAs UnmanagedType U1 _ ByVal formatType As TPCANTPFormatType _ MarshalAs UnmanagedType U1 _ ByVal msgType As TPCANTPMessageType _ ByVal sourceAddr As Byte ByVal targetAddr As Byte MarshalAs UnmanagedType U1 _ ByVal targetType As TPCANTPAddressingType
119. t it is compatible with a string buffer Example The following example shows the use of the method GetValue on the channel PCANTP_USBBUS1 to retrieve the ISO TP separation time value STmin Depending on the result a message will be shown to the user Note It is assumed that the channel was already initialized Ci TPCANTPHandle CanChannel CanTpApi PCANTP USBBUSI TPCANTPStatus result UInt32 iBuffer 0 Get the value of the ISO TP Separation Time STmin parameter result CanTpApi GetValue CanChannel TPCANTPParameter PCANTP PARAM SEPERATION TIME out iBuffer sizeof UInt32 if result TPCANTPStatus PCANTP ERROR OK MessageBox Show Failed to get value else MessageBox Show iBuffer ToString CLR TPCANTPHandle CanChannel CanTpApi PCANTP USBBUS1 TPCANTPStatus result UInt32 iBuffer 0 Get the value of the ISO TP Separation Time STmin parameter result CanTpApi GetValue CanChannel PCANTP PARAM SEPERATION TIME iBuffer sizeof UInt32 if result PCANTP ERROR OK MessageBox Show Failed to get value else MessageBox Show iBuffer ToString Visual Basic Dim CanChannel As TPCANTPHandle CanTpApi PCANTP USBBUSI Dim result As TPCANTPStatus Dim iBuffer As UInt32 0 Get the value of the ISO TP Separation Time STmin parameter result CanTpApi GetValue CanChannel TPCANTPParam
120. tErrorText CANTP AddMapping CANTP Remove Mapping CANTP GetValue CANTP GetStatus CANTP Read CANTP write CANTP Reset Definitions 8 8 1 2 PCAN ISO TP Handle Definitions Parameter Value Defintions Additional Information PCAN Fundamentals PCAN Basic PCAN API ISO TP network addressing format Using Events System 102 102 103 105 107 108 E PCAN ISO TP API Documentation User Guide System 1 PCAN ISO TP API Documentation Welcome to the documentation of PCAN ISO TP API a PEAK CAN API that implements ISO 15765 2 or ISO TP an international standard for sending data packets over a CAN Bus In the following chapters you will find all the information needed to take advantage of this API Introduction on page 6 DLL API Reference on page 8 Additional Information on page 102 E PCAN ISO TP API Documentation User Guide System 2 Introduction PCAN ISO TP is a simple programming interface that allows the communication between Windows applications and Electronic Control Units ECU over a CAN Bus and more specifically to transmit and receive bigger data packets than the limited 8 bytes of the CAN standard 2 1 Understanding PCAN ISO TP ISO TP is an international standard for sending data packets over a CAN Bus The protocol defines data segmentation that allows to transmit messages which cannot be transmitted with a single CAN frame the maximum data length that can be transmitt
121. tem Gets the current BUS status of a PCANTP Channel Syntax Pascal OO class function GetStatus CanChannel TPCANTPHandle TPCANTPStatus Ci DllImport PCAN ISO TP dll EntryPoint CANTP GetsStatus public static extern TPCANTPStatus GetStatus MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel C CLR DIlImport PCAN ISO TP dll EntryPoint CANTP GetsStatus static TPCANTPStatus GetStatus MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint CANTP_GetStatus gt _ Public Shared Function GetStatus _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Returns The return value is a TPCANTPStatus code PCANTP_ERROR_OK is returned on success The typical errors in case of failure are PCANTP_ERROR_OK PCANTP_ERROR_BUSLIGHT PCANTP_ERROR_BUSHEAVY PCANTP_ERROR_BUSOFF PCANTP_ERROR_NOT_INITIALIZED Indicates that the status of the given PCANTP Channel is OK Indicates a bus error within the given PCANTP Channel The hardware is in bus light status Indicates a bus error within the given PCANTP Channel The hardware is in bus heavy status Indicates a bus error within the given PCANTP Channel The hardware is in bus
122. tic TPCANTPStatus Initialize MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel MarshalAs UnmanagedType U2 TPCANTPBaudrate Baudrate MarshalAs UnmanagedType U1 TPCANTPHWType HwType UInt32 Ulnt16 Interrupt Visual Basic lt Dlllmport PCAN ISO TP dll EntryPoint z CANTP Initialize _ Public Shared Function Initialize _ MarshalAs UnmanagedType U2 _ ByVal CanChannel As TPCANTPHandle _ MarshalAs UnmanagedType U2 _ ByVal Baudrate As TPCANTPBaudrate _ MarshalAs UnmanagedType U1 _ ByVal HwType As TPCANTPHWType _ ByVal lOPort As Ulnt32 _ ByVal Interrupt As UInt16 As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Baudrate The speed for the communication see TPCANTPBaudrate on page 19 HwType The speed for the communication see TPCANTPHWType on page 21 lOPort The I O address for the parallel port Interrupt Interrupt number of the parallel port Returns The return value is a TPCANTPStatus code PCANTP_ERROR_OK is returned on success The typical errors in case of failure are PCANTP ERROR ALREADY INITIALIZED Indicates that the desired PCANTP Channel is already in use PCANTP ERROR CAN ERROR This error flag states that the error is composed of a more precise PCAN Basic error Remarks As indicated by its name the Initialize method initiates a PCANTP Channel preparing it for communic
123. ts can be connected too The following figures demonstrate different possibilities of Net configurations also realizable at the same time Following rules apply to PCAN clients nets and hardware One Client can be connected to several Nets One Net provides several Clients One piece of hardware belongs to one Net One Net can include none or one piece of hardware A message from a transmitting Client is carried on to Example network External CAN bus A e g PCAN USB Client A Client B Hardware 1 Net 1 Gateway External CAN bus e g PCAN PCI Client C Client D Hardware 2 External CAN bus e g PCAN cPCI Client E Hardware 3 Net 3 Internal network Client F Client G Client H Net 4 every other connected Client and to the external bus via the connected CAN hardware A message received by the CAN hardware is received by every connected Client However Clients react only on those messages that pass their acceptance filter 102 E PCAN ISO TP API Documentation User Guide System Users of PCAN View 3 do not have to define and manage Nets If PCAN View is instructed to connect directly to a PCAN hardware the application automatically creates a Net for the selected hardware and automatically establishes a connection with this Net See also PCAN Basic below ISO TP network addressing format on page 107 4 2 PCAN Basic PCAN Basic is an Application Programming
124. ue result CANTP Read PCANTP USBBUS1 amp msg if result PCANTP ERROR OK Process the received messag MessageBox NULL A message was received Success MB OK ProcessMessage msg else An error occurred MessageBox NULL An error ocured Error MB OK Here can be decided if the loop has to be terminated bStop HandleReadError result while bStop See also CANTP Write on page 96 Class method Version Read 95 E PCAN ISO TP API Documentation User Guide e System 3 7 10 CANTP write Transmits a CAN ISO TP message Syntax C TPCANTPStatus stdcall CANTP Write TPCANTPHandle CanChannel TPCANTPMsg MessageBuffer Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 MessageBuffer A TPCANTPMsg buffer containing the CAN ISO TP message to be sent Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel was not found in the list of initialized channels of the calling application or that a required CAN ID mapping was not found PCANTP ERROR WRONG PARAM The network addressing information of the message is not valid PCANTP ERROR NO MEMORY Failed to allocate memory and copy message in the transmission queue Remarks
125. w An error ocured Here can be decided if the loop has to be terminated bStop HandleReadError result Eng IE Loop While bStop False Pascal OO var result TPCANTPStatus msg TPCANTPMsg ts TPCANTPTimestamp bStop Boolean begin bStop False 77 a PCAN ISO TP API Documentation User Guide System repeat Read the first message in the queue result TCanTpApi Read TCanTpApi PCANTP_USBBUS1 msg PTPCANTPTimestamp ts if result PCANTP_ERROR_OK then begin Process the received message MessageBox 0 message was received Error MB OK ProcessMessage msg end else begin An error occurred 0 error ocured Error MB OK Here can be decided if the loop has to be terminated bStop HandleReadError result end until bStop true end See also Write below Plain function version CANTP_Read 3 6 20 write Transmits a CAN ISO TP message syntax Pascal OO class function Write CanChannel TPCANTPHandle var MessageBuffer TPCANTPMsg TPCANTPStatus Ci DllImport PCAN ISO TP dll EntryPoint CANTP Write public static extern TPCANTPStatus Write MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel ref TPCANTPMsg MessageBuffer CLR DllImport PCAN ISO TP dll EntryPoint CANTP Write static TPCANTPStatus Write MarshalAs UnmanagedTyp
126. x Pascal OO class function RemoveMapping CanChannel TPCANTPHandle canlID LongWord TPCANTPStatus Ci DllImport PCAN ISO TP dll EntryPoint CANTP RemoveMapping public static extern TPCANTPStatus RemoveMapping MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel uint canlD CLR DIlImport PCAN ISO TP dll EntryPoint RemoveMapping static TPCANTPStatus RemoveMapping MarshalAs UnmanagedType U2 TPCANTPHandle CanChannel UInt32 canID Visual Basic Dllimport PCAN ISO TP dil EntryPoint CANTP_RemoveMapping gt _ Public Shared Function RemoveMapping _ lt MarshalAs UnmanagedType U2 gt _ ByVal CanChannel As TPCANTPHandle _ ByVal canID As UInt32 As TPCANTPStatus End Function Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 The CAN Identifier that identifies the mapping to remove 58 PCAN ISO TP Documentation User Guide System Returns The return value is a TPCANTPStatus code PCANTP ERROR OK is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized or the mapping was not found Example The following example shows the definition and removal of a CAN ID mapping used for functional addressing with NORMAL addressing Ci
127. yVal CanChannel As TPCANTPHandle _ MarshalAs UnmanagedType U1 _ ByVal Parameter As TPCANTPParameter _ ByVal Buffer As Byte _ ByVal BufferLength As Ulnt32 As TPCANTPStatus End Function 48 E PCAN ISO TP API Documentation User Guide e System Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Parameter The code of the value to be set see TPCANTPParameter on page 30 NumericBuffer The buffer containing the array value to be set BufferLength The length in bytes of the given buffer Returns The return value is aTPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application PCANTP ERROR WRONG PARAM Indicates that the parameters passedto the method are invalid Check the value of Parameter and assert it is compatible with an integer buffer Remarks Use the method SetValue to set configuration information or environment values of a PCANTP Channel Note Any calls with non ISO TP parameters ie TPCANTPParameter will be forwarded to PCAN Basic API More information about the parameters and values that can be set can be found in Parameter Value Definition Example The following example shows the use of the method SetVa
128. ze 52 PCANTP BAUD 500K if result PCANTP ERROR OK MessageBox NULL Initialization failed Error MB OK else MessageBox NULL PCAN PCI Ch 2 was initialized Success MB OK All initialized channels are released CANTP Uninitialize NONEBUS See also CANTP Uninitialize on page 86 CANTP GetValue on page 92 Understanding PCAN ISO TP on page 6 85 E PCAN ISO TP API Documentation User Guide System Class method Version Initialize 3 7 2 CANTP Uninitialize Uninitializes a PCANTP Channel Syntax C TPCANTPStatus stdcall CANTP Uninitialize TPCANTPHandle CanChannel Parameters Parameters Description CanChannel The handle of a PCANTP Channel see TPCANTPHandle on page 16 Returns The return value is a TPCANTPStatus code PCANTP ERROR is returned on success The typical errors in case of failure are PCANTP ERROR NOT INITIALIZED Indicates that the given PCANTP channel cannot be uninitialized because it was not found in the list of reserved channels of the calling application Remarks A PCAN Channel can be released using one of these possibilities Single Release Given a handle of a PCANTP Channel initialized before with the method initialize If the given channel can not be found then an error is returned Multiple Release Giving the handle value NONEBUS which instructs the API to searc

Download Pdf Manuals

image

Related Search

Related Contents

active.console issues    71913 - S500-Touch DFE.indd  17926740_Speed.ps, page 1-56 @ Normalize_2  日立スポットエアコン - 日立アプライアンス  Cygwin/X User's Guide  Nettoyeurs à haute pression  Whirlpool oortable spa User's Manual  Tripp Lite Minicom Smart 108  

Copyright © All rights reserved.
Failed to retrieve file