libPCBUSB  Version 0.12, Build 1668 of January 31, 2023
macOS Library for PCAN-USB Interfaces
 All Data Structures Files Functions Variables Typedefs Defines
PCBUSB.h File Reference

Go to the source code of this file.

Data Structures

struct  tagTPCANMsg
struct  tagTPCANTimestamp
struct  tagTPCANMsgFD
struct  tagTPCANChannelInformation

Defines

#define PCAN_NONEBUS
 Undefined/default value for a PCAN bus.
#define PCAN_USBBUS1
 PCAN-USB interface, channel 1.
#define PCAN_USBBUS2
 PCAN-USB interface, channel 2.
#define PCAN_USBBUS3
 PCAN-USB interface, channel 3.
#define PCAN_USBBUS4
 PCAN-USB interface, channel 4.
#define PCAN_USBBUS5
 PCAN-USB interface, channel 5.
#define PCAN_USBBUS6
 PCAN-USB interface, channel 6.
#define PCAN_USBBUS7
 PCAN-USB interface, channel 7.
#define PCAN_USBBUS8
 PCAN-USB interface, channel 8.
#define PCAN_USBBUS9
 PCAN-USB interface, channel 9.
#define PCAN_USBBUS10
 PCAN-USB interface, channel 10.
#define PCAN_USBBUS11
 PCAN-USB interface, channel 11.
#define PCAN_USBBUS12
 PCAN-USB interface, channel 12.
#define PCAN_USBBUS13
 PCAN-USB interface, channel 13.
#define PCAN_USBBUS14
 PCAN-USB interface, channel 14.
#define PCAN_USBBUS15
 PCAN-USB interface, channel 15.
#define PCAN_USBBUS16
 PCAN-USB interface, channel 16.
#define PCAN_ERROR_OK
 No error.
#define PCAN_ERROR_XMTFULL
 Transmit buffer in CAN controller is full.
#define PCAN_ERROR_OVERRUN
 CAN controller was read too late.
#define PCAN_ERROR_BUSLIGHT
 Bus error: an error counter reached the 'light' limit.
#define PCAN_ERROR_BUSHEAVY
 Bus error: an error counter reached the 'heavy' limit.
#define PCAN_ERROR_BUSWARNING
 Bus error: an error counter reached the 'warning' limit.
#define PCAN_ERROR_BUSPASSIVE
 Bus error: the CAN controller is error passive.
#define PCAN_ERROR_BUSOFF
 Bus error: the CAN controller is in bus-off state.
#define PCAN_ERROR_ANYBUSERR
 Mask for all bus errors.
#define PCAN_ERROR_QRCVEMPTY
 Receive queue is empty.
#define PCAN_ERROR_QOVERRUN
 Receive queue was read too late.
#define PCAN_ERROR_QXMTFULL
 Transmit queue is full.
#define PCAN_ERROR_REGTEST
 Test of the CAN controller hardware registers failed (no hardware found)
#define PCAN_ERROR_NODRIVER
 Driver not loaded.
#define PCAN_ERROR_HWINUSE
 Hardware already in use by a Net.
#define PCAN_ERROR_NETINUSE
 A Client is already connected to the Net.
#define PCAN_ERROR_ILLHW
 Hardware handle is invalid.
#define PCAN_ERROR_ILLNET
 Net handle is invalid.
#define PCAN_ERROR_ILLCLIENT
 Client handle is invalid.
#define PCAN_ERROR_ILLHANDLE
 Mask for all handle errors.
#define PCAN_ERROR_RESOURCE
 Resource (FIFO, Client, timeout) cannot be created.
#define PCAN_ERROR_ILLPARAMTYPE
 Invalid parameter.
#define PCAN_ERROR_ILLPARAMVAL
 Invalid parameter value.
#define PCAN_ERROR_UNKNOWN
 Unknown error.
#define PCAN_ERROR_ILLDATA
 Invalid data, function, or action.
#define PCAN_ERROR_ILLMODE
 Driver object state is wrong for the attempted operation.
#define PCAN_ERROR_CAUTION
 An operation was successfully carried out, however, irregularities were registered.
#define PCAN_ERROR_INITIALIZE
 Channel is not initialized [Value was changed from 0x40000 to 0x4000000].
#define PCAN_ERROR_ILLOPERATION
 Invalid operation [Value was changed from 0x80000 to 0x8000000].
#define PCAN_NONE
 Undefined, unknown or not selected PCAN device value.
#define PCAN_PEAKCAN
 PCAN Non-PnP devices. NOT USED WITHIN PCAN-Basic API.
#define PCAN_ISA
 PCAN-ISA, PCAN-PC/104, and PCAN-PC/104-Plus.
#define PCAN_DNG
 PCAN-Dongle.
#define PCAN_PCI
 PCAN-PCI, PCAN-cPCI, PCAN-miniPCI, and PCAN-PCI Express.
#define PCAN_USB
 PCAN-USB and PCAN-USB Pro.
#define PCAN_PCC
 PCAN-PC Card.
#define PCAN_VIRTUAL
 PCAN Virtual hardware. NOT USED WITHIN PCAN-Basic API.
#define PCAN_LAN
 PCAN Gateway devices.
#define PCAN_DEVICE_ID
 Device identifier parameter.
#define PCAN_5VOLTS_POWER
 5-Volt power parameter
#define PCAN_RECEIVE_EVENT
 PCAN receive event handler parameter.
#define PCAN_MESSAGE_FILTER
 PCAN message filter parameter.
#define PCAN_API_VERSION
 PCAN-Basic API version parameter.
#define PCAN_CHANNEL_VERSION
 PCAN device channel version parameter.
#define PCAN_BUSOFF_AUTORESET
 PCAN Reset-On-Busoff parameter.
#define PCAN_LISTEN_ONLY
 PCAN Listen-Only parameter.
#define PCAN_LOG_LOCATION
 Directory path for log files.
#define PCAN_LOG_STATUS
 Debug-Log activation status.
#define PCAN_LOG_CONFIGURE
 Configuration of the debugged information (LOG_FUNCTION_***)
#define PCAN_LOG_TEXT
 Custom insertion of text into the log file.
#define PCAN_CHANNEL_CONDITION
 Availability status of a PCAN-Channel.
#define PCAN_HARDWARE_NAME
 PCAN hardware name parameter.
#define PCAN_RECEIVE_STATUS
 Message reception status of a PCAN-Channel.
#define PCAN_CONTROLLER_NUMBER
 CAN-Controller number of a PCAN-Channel.
#define PCAN_TRACE_LOCATION
 Directory path for PCAN trace files.
#define PCAN_TRACE_STATUS
 CAN tracing activation status.
#define PCAN_TRACE_SIZE
 Configuration of the maximum file size of a CAN trace.
#define PCAN_TRACE_CONFIGURE
 Configuration of the trace file storing mode (TRACE_FILE_***)
#define PCAN_CHANNEL_IDENTIFYING
 Physical identification of a USB based PCAN-Channel by blinking its associated LED.
#define PCAN_CHANNEL_FEATURES
 Capabilities of a PCAN device (FEATURE_***)
#define PCAN_BITRATE_ADAPTING
 Using of an existing bit rate (PCAN-View connected to a channel)
#define PCAN_BITRATE_INFO
 Configured bit rate as Btr0Btr1 value.
#define PCAN_BITRATE_INFO_FD
 Configured bit rate as TPCANBitrateFD string.
#define PCAN_BUSSPEED_NOMINAL
 Configured nominal CAN Bus speed as Bits per seconds.
#define PCAN_BUSSPEED_DATA
 Configured CAN data speed as Bits per seconds.
#define PCAN_IP_ADDRESS
 Remote address of a LAN channel as string in IPv4 format.
#define PCAN_LAN_SERVICE_STATUS
 Status of the Virtual PCAN-Gateway Service.
#define PCAN_ALLOW_STATUS_FRAMES
 Status messages reception status within a PCAN-Channel.
#define PCAN_ALLOW_RTR_FRAMES
 RTR messages reception status within a PCAN-Channel.
#define PCAN_ALLOW_ERROR_FRAMES
 Error messages reception status within a PCAN-Channel.
#define PCAN_INTERFRAME_DELAY
 Delay, in microseconds, between sending frames.
#define PCAN_ACCEPTANCE_FILTER_11BIT
 Filter over code and mask patterns for 11-Bit messages.
#define PCAN_ACCEPTANCE_FILTER_29BIT
 Filter over code and mask patterns for 29-Bit messages.
#define PCAN_IO_DIGITAL_CONFIGURATION
 Output mode of 32 digital I/O pin of a PCAN-USB Chip. 1: Output-Active 0 : Output Inactive.
#define PCAN_IO_DIGITAL_VALUE
 Value assigned to a 32 digital I/O pins of a PCAN-USB Chip.
#define PCAN_IO_DIGITAL_SET
 Value assigned to a 32 digital I/O pins of a PCAN-USB Chip - Multiple digital I/O pins to 1 = High.
#define PCAN_IO_DIGITAL_CLEAR
 Clear multiple digital I/O pins to 0.
#define PCAN_IO_ANALOG_VALUE
 Get value of a single analog input pin.
#define PCAN_FIRMWARE_VERSION
 Get the version of the firmware used by the device associated with a PCAN-Channel.
#define PCAN_ATTACHED_CHANNELS_COUNT
 Get the amount of PCAN channels attached to a system.
#define PCAN_ATTACHED_CHANNELS
 Get information about PCAN channels attached to a system.
#define PCAN_ALLOW_ECHO_FRAMES
 Echo messages reception status within a PCAN-Channel.
#define PCAN_DEVICE_PART_NUMBER
 Get the part number associated to a device.
#define PCAN_EXT_BTR0BTR1
 UVS: bit-timing register.
#define PCAN_EXT_TX_COUNTER
 UVS: number of transmitted frames.
#define PCAN_EXT_RX_COUNTER
 UVS: number of received frames.
#define PCAN_EXT_ERR_COUNTER
 UVS: number of error frames.
#define PCAN_EXT_RX_QUE_OVERRUN
 UVS: receive queue overrun counter.
#define PCAN_EXT_HARDWARE_VERSION
 UVS: version number of the interface firmware.
#define PCAN_EXT_SOFTWARE_VERSION
 UVS: version number of the driver respectively library.
#define PCAN_EXT_RECEIVE_CALLBACK
 UVS: callback function called on the reception of an URB.
#define PCAN_EXT_LOG_USB
 UVS: Log USB communication (URB buffer <==> CAN messages)
#define PCAN_DEVICE_NUMBER
 Deprecated parameter. Use PCAN_DEVICE_ID instead.
#define PCAN_PARAMETER_OFF
 The PCAN parameter is not set (inactive)
#define PCAN_PARAMETER_ON
 The PCAN parameter is set (active)
#define PCAN_FILTER_CLOSE
 The PCAN filter is closed. No messages will be received.
#define PCAN_FILTER_OPEN
 The PCAN filter is fully opened. All messages will be received.
#define PCAN_FILTER_CUSTOM
 The PCAN filter is custom configured. Only registered messages will be received.
#define PCAN_CHANNEL_UNAVAILABLE
 The PCAN-Channel handle is illegal, or its associated hardware is not available.
#define PCAN_CHANNEL_AVAILABLE
 The PCAN-Channel handle is available to be connected (PnP Hardware: it means furthermore that the hardware is plugged-in)
#define PCAN_CHANNEL_OCCUPIED
 The PCAN-Channel handle is valid, and is already being used.
#define PCAN_CHANNEL_PCANVIEW
 The PCAN-Channel handle is already being used by a PCAN-View application, but is available to connect.
#define LOG_FUNCTION_DEFAULT
 Logs system exceptions / errors.
#define LOG_FUNCTION_ENTRY
 Logs the entries to the PCAN-Basic API functions.
#define LOG_FUNCTION_PARAMETERS
 Logs the parameters passed to the PCAN-Basic API functions.
#define LOG_FUNCTION_LEAVE
 Logs the exits from the PCAN-Basic API functions.
#define LOG_FUNCTION_WRITE
 Logs the CAN messages passed to the CAN_Write function.
#define LOG_FUNCTION_READ
 Logs the CAN messages received within the CAN_Read function.
#define LOG_FUNCTION_ALL
 Logs all possible information within the PCAN-Basic API functions.
#define TRACE_FILE_SINGLE
 A single file is written until it size reaches PAN_TRACE_SIZE.
#define TRACE_FILE_SEGMENTED
 Traced data is distributed in several files with size PAN_TRACE_SIZE.
#define TRACE_FILE_DATE
 Includes the date into the name of the trace file.
#define TRACE_FILE_TIME
 Includes the start time into the name of the trace file.
#define TRACE_FILE_OVERWRITE
 Causes the overwriting of available traces (same name)
#define FEATURE_FD_CAPABLE
 Device supports flexible data-rate (CAN-FD)
#define FEATURE_DELAY_CAPABLE
 Device supports a delay between sending frames (FPGA based USB devices)
#define FEATURE_IO_CAPABLE
 Device supports I/O functionality for electronic circuits (USB-Chip devices)
#define SERVICE_STATUS_STOPPED
 The service is not running.
#define SERVICE_STATUS_RUNNING
 The service is running.
#define MAX_LENGTH_HARDWARE_NAME
 Maximum length of the name of a device: 32 characters + terminator.
#define MAX_LENGTH_VERSION_STRING
 Maximum length of a version string: 17 characters + terminator.
#define PCAN_MESSAGE_STANDARD
 The PCAN message is a CAN Standard Frame (11-bit identifier)
#define PCAN_MESSAGE_RTR
 The PCAN message is a CAN Remote-Transfer-Request Frame.
#define PCAN_MESSAGE_EXTENDED
 The PCAN message is a CAN Extended Frame (29-bit identifier)
#define PCAN_MESSAGE_FD
 The PCAN message represents a FD frame in terms of CiA Specs.
#define PCAN_MESSAGE_BRS
 The PCAN message represents a FD bit rate switch (CAN data at a higher bit rate)
#define PCAN_MESSAGE_ESI
 The PCAN message represents a FD error state indicator(CAN FD transmitter was error active)
#define PCAN_MESSAGE_ECHO
 The PCAN message represents an echo CAN Frame.
#define PCAN_MESSAGE_ERRFRAME
 The PCAN message represents an error frame.
#define PCAN_MESSAGE_STATUS
 The PCAN message represents a PCAN status message.
#define LOOKUP_DEVICE_TYPE
 Lookup channel by Device type (see PCAN devices e.g. PCAN_USB)
#define LOOKUP_DEVICE_ID
 Lookup channel by device id.
#define LOOKUP_CONTROLLER_NUMBER
 Lookup channel by CAN controller 0-based index.
#define LOOKUP_IP_ADDRESS
 Lookup channel by IP address (LAN channels only)
#define PCAN_MODE_STANDARD
#define PCAN_MODE_EXTENDED
#define PCAN_BAUD_1M
 1 MBit/s
#define PCAN_BAUD_800K
 800 kBit/s
#define PCAN_BAUD_500K
 500 kBit/s
#define PCAN_BAUD_250K
 250 kBit/s
#define PCAN_BAUD_125K
 125 kBit/s
#define PCAN_BAUD_100K
 100 kBit/s
#define PCAN_BAUD_95K
 95,238 kBit/s
#define PCAN_BAUD_83K
 83,333 kBit/s
#define PCAN_BAUD_50K
 50 kBit/s
#define PCAN_BAUD_47K
 47,619 kBit/s
#define PCAN_BAUD_33K
 33,333 kBit/s
#define PCAN_BAUD_20K
 20 kBit/s
#define PCAN_BAUD_10K
 10 kBit/s
#define PCAN_BAUD_5K
 5 kBit/s
#define PCAN_BR_CLOCK
#define PCAN_BR_CLOCK_MHZ
#define PCAN_BR_NOM_BRP
#define PCAN_BR_NOM_TSEG1
#define PCAN_BR_NOM_TSEG2
#define PCAN_BR_NOM_SJW
#define PCAN_BR_NOM_SAMPLE
#define PCAN_BR_DATA_BRP
#define PCAN_BR_DATA_TSEG1
#define PCAN_BR_DATA_TSEG2
#define PCAN_BR_DATA_SJW
#define PCAN_BR_DATA_SAMPLE
#define TPCANHandle
 PCAN hardware channel handle.
#define TPCANStatus
 PCAN status/error code (ATTENTION: changed from 64-bit to 32-bit)
#define TPCANParameter
 PCAN parameter to be read or set.
#define TPCANDevice
 PCAN device.
#define TPCANMessageType
 The type of a PCAN message.
#define TPCANType
 The type of PCAN hardware to be initialized.
#define TPCANMode
 PCAN filter mode.
#define TPCANBaudrate
 PCAN Baud rate register value.
#define TPCANBitrateFD
 PCAN-FD bit rate string.
#define TPCANTimestampFD
 timestamp of a received PCAN FD message
#define _DEF_ARG

Typedefs

typedef struct tagTPCANMsg TPCANMsg
typedef struct tagTPCANTimestamp TPCANTimestamp
typedef struct tagTPCANMsgFD TPCANMsgFD
typedef struct
tagTPCANChannelInformation 
TPCANChannelInformation

Functions

TPCANStatus CAN_Initialize (TPCANHandle Channel, TPCANBaudrate Btr0Btr1, TPCANType HwType _DEF_ARG, DWORD IOPort _DEF_ARG, WORD Interrupt _DEF_ARG)
 Initializes a PCAN Channel.
TPCANStatus CAN_InitializeFD (TPCANHandle Channel, TPCANBitrateFD BitrateFD)
 Initializes a FD capable PCAN Channel.
TPCANStatus CAN_Uninitialize (TPCANHandle Channel)
 Uninitializes one or all PCAN Channels initialized by CAN_Initialize.
TPCANStatus CAN_Reset (TPCANHandle Channel)
 Resets the receive and transmit queues of the PCAN Channel.
TPCANStatus CAN_GetStatus (TPCANHandle Channel)
 Gets the current status of a PCAN Channel.
TPCANStatus CAN_Read (TPCANHandle Channel, TPCANMsg *MessageBuffer, TPCANTimestamp *TimestampBuffer)
 Reads a CAN message from the receive queue of a PCAN Channel.
TPCANStatus CAN_ReadFD (TPCANHandle Channel, TPCANMsgFD *MessageBuffer, TPCANTimestampFD *TimestampBuffer)
 Reads a CAN message from the receive queue of a FD capable PCAN Channel.
TPCANStatus CAN_Write (TPCANHandle Channel, TPCANMsg *MessageBuffer)
 Transmits a CAN message.
TPCANStatus CAN_WriteFD (TPCANHandle Channel, TPCANMsgFD *MessageBuffer)
 Transmits a CAN message over a FD capable PCAN Channel.
TPCANStatus CAN_FilterMessages (TPCANHandle Channel, DWORD FromID, DWORD ToID, TPCANMode Mode)
 Configures the reception filter.
TPCANStatus CAN_GetValue (TPCANHandle Channel, TPCANParameter Parameter, void *Buffer, DWORD BufferLength)
 Retrieves a PCAN Channel value.
TPCANStatus CAN_SetValue (TPCANHandle Channel, TPCANParameter Parameter, void *Buffer, DWORD BufferLength)
 Configures or sets a PCAN Channel value.
TPCANStatus CAN_GetErrorText (TPCANStatus Error, WORD Language, LPSTR Buffer)
 Returns a descriptive text of a given TPCANStatus error code, in any desired language.
TPCANStatus CAN_LookUpChannel (LPSTR Parameters, TPCANHandle *FoundChannel)
 Finds a PCAN-Basic channel that matches with the given parameters.

Define Documentation

#define _DEF_ARG

Device supports a delay between sending frames (FPGA based USB devices)

Device supports flexible data-rate (CAN-FD)

Device supports I/O functionality for electronic circuits (USB-Chip devices)

Logs all possible information within the PCAN-Basic API functions.

Logs system exceptions / errors.

Logs the entries to the PCAN-Basic API functions.

Logs the exits from the PCAN-Basic API functions.

Logs the parameters passed to the PCAN-Basic API functions.

Logs the CAN messages received within the CAN_Read function.

Logs the CAN messages passed to the CAN_Write function.

Lookup channel by CAN controller 0-based index.

Lookup channel by device id.

Lookup channel by Device type (see PCAN devices e.g. PCAN_USB)

Lookup channel by IP address (LAN channels only)

Maximum length of the name of a device: 32 characters + terminator.

Maximum length of a version string: 17 characters + terminator.

5-Volt power parameter

Filter over code and mask patterns for 11-Bit messages.

Filter over code and mask patterns for 29-Bit messages.

Echo messages reception status within a PCAN-Channel.

Error messages reception status within a PCAN-Channel.

RTR messages reception status within a PCAN-Channel.

Status messages reception status within a PCAN-Channel.

PCAN-Basic API version parameter.

Get information about PCAN channels attached to a system.

Get the amount of PCAN channels attached to a system.

#define PCAN_BAUD_100K

100 kBit/s

#define PCAN_BAUD_10K

10 kBit/s

#define PCAN_BAUD_125K

125 kBit/s

#define PCAN_BAUD_1M

1 MBit/s

#define PCAN_BAUD_20K

20 kBit/s

#define PCAN_BAUD_250K

250 kBit/s

#define PCAN_BAUD_33K

33,333 kBit/s

#define PCAN_BAUD_47K

47,619 kBit/s

#define PCAN_BAUD_500K

500 kBit/s

#define PCAN_BAUD_50K

50 kBit/s

#define PCAN_BAUD_5K

5 kBit/s

#define PCAN_BAUD_800K

800 kBit/s

#define PCAN_BAUD_83K

83,333 kBit/s

#define PCAN_BAUD_95K

95,238 kBit/s

Using of an existing bit rate (PCAN-View connected to a channel)

Configured bit rate as Btr0Btr1 value.

Configured bit rate as TPCANBitrateFD string.

#define PCAN_BR_CLOCK
#define PCAN_BR_NOM_BRP
#define PCAN_BR_NOM_SJW

PCAN Reset-On-Busoff parameter.

Configured CAN data speed as Bits per seconds.

Configured nominal CAN Bus speed as Bits per seconds.

The PCAN-Channel handle is available to be connected (PnP Hardware: it means furthermore that the hardware is plugged-in)

Availability status of a PCAN-Channel.

Capabilities of a PCAN device (FEATURE_***)

Physical identification of a USB based PCAN-Channel by blinking its associated LED.

The PCAN-Channel handle is valid, and is already being used.

The PCAN-Channel handle is already being used by a PCAN-View application, but is available to connect.

The PCAN-Channel handle is illegal, or its associated hardware is not available.

PCAN device channel version parameter.

CAN-Controller number of a PCAN-Channel.

#define PCAN_DEVICE_ID

Device identifier parameter.

Deprecated parameter. Use PCAN_DEVICE_ID instead.

Get the part number associated to a device.

#define PCAN_DNG

PCAN-Dongle.

Mask for all bus errors.

Bus error: an error counter reached the 'heavy' limit.

Bus error: an error counter reached the 'light' limit.

Bus error: the CAN controller is in bus-off state.

Bus error: the CAN controller is error passive.

Bus error: an error counter reached the 'warning' limit.

An operation was successfully carried out, however, irregularities were registered.

Hardware already in use by a Net.

Client handle is invalid.

Invalid data, function, or action.

Mask for all handle errors.

Hardware handle is invalid.

Driver object state is wrong for the attempted operation.

Net handle is invalid.

Invalid operation [Value was changed from 0x80000 to 0x8000000].

Invalid parameter.

Invalid parameter value.

Channel is not initialized [Value was changed from 0x40000 to 0x4000000].

A Client is already connected to the Net.

Driver not loaded.

#define PCAN_ERROR_OK

No error.

CAN controller was read too late.

Receive queue was read too late.

Receive queue is empty.

Transmit queue is full.

Test of the CAN controller hardware registers failed (no hardware found)

Resource (FIFO, Client, timeout) cannot be created.

Unknown error.

Transmit buffer in CAN controller is full.

UVS: bit-timing register.

UVS: number of error frames.

UVS: version number of the interface firmware.

UVS: Log USB communication (URB buffer <==> CAN messages)

UVS: callback function called on the reception of an URB.

UVS: number of received frames.

UVS: receive queue overrun counter.

UVS: version number of the driver respectively library.

UVS: number of transmitted frames.

The PCAN filter is closed. No messages will be received.

The PCAN filter is custom configured. Only registered messages will be received.

The PCAN filter is fully opened. All messages will be received.

Get the version of the firmware used by the device associated with a PCAN-Channel.

PCAN hardware name parameter.

Delay, in microseconds, between sending frames.

Get value of a single analog input pin.

Clear multiple digital I/O pins to 0.

Output mode of 32 digital I/O pin of a PCAN-USB Chip. 1: Output-Active 0 : Output Inactive.

Value assigned to a 32 digital I/O pins of a PCAN-USB Chip - Multiple digital I/O pins to 1 = High.

Value assigned to a 32 digital I/O pins of a PCAN-USB Chip.

#define PCAN_IP_ADDRESS

Remote address of a LAN channel as string in IPv4 format.

#define PCAN_ISA

PCAN-ISA, PCAN-PC/104, and PCAN-PC/104-Plus.

#define PCAN_LAN

PCAN Gateway devices.

Status of the Virtual PCAN-Gateway Service.

PCAN Listen-Only parameter.

Configuration of the debugged information (LOG_FUNCTION_***)

Directory path for log files.

#define PCAN_LOG_STATUS

Debug-Log activation status.

#define PCAN_LOG_TEXT

Custom insertion of text into the log file.

The PCAN message represents a FD bit rate switch (CAN data at a higher bit rate)

The PCAN message represents an echo CAN Frame.

The PCAN message represents an error frame.

The PCAN message represents a FD error state indicator(CAN FD transmitter was error active)

The PCAN message is a CAN Extended Frame (29-bit identifier)

#define PCAN_MESSAGE_FD

The PCAN message represents a FD frame in terms of CiA Specs.

PCAN message filter parameter.

The PCAN message is a CAN Remote-Transfer-Request Frame.

The PCAN message is a CAN Standard Frame (11-bit identifier)

The PCAN message represents a PCAN status message.

#define PCAN_NONE

Undefined, unknown or not selected PCAN device value.

#define PCAN_NONEBUS

Undefined/default value for a PCAN bus.

The PCAN parameter is not set (inactive)

The PCAN parameter is set (active)

#define PCAN_PCC

PCAN-PC Card.

#define PCAN_PCI

PCAN-PCI, PCAN-cPCI, PCAN-miniPCI, and PCAN-PCI Express.

#define PCAN_PEAKCAN

PCAN Non-PnP devices. NOT USED WITHIN PCAN-Basic API.

PCAN receive event handler parameter.

Message reception status of a PCAN-Channel.

Configuration of the trace file storing mode (TRACE_FILE_***)

Directory path for PCAN trace files.

#define PCAN_TRACE_SIZE

Configuration of the maximum file size of a CAN trace.

CAN tracing activation status.

#define PCAN_USB

PCAN-USB and PCAN-USB Pro.

#define PCAN_USBBUS1

PCAN-USB interface, channel 1.

#define PCAN_USBBUS10

PCAN-USB interface, channel 10.

#define PCAN_USBBUS11

PCAN-USB interface, channel 11.

#define PCAN_USBBUS12

PCAN-USB interface, channel 12.

#define PCAN_USBBUS13

PCAN-USB interface, channel 13.

#define PCAN_USBBUS14

PCAN-USB interface, channel 14.

#define PCAN_USBBUS15

PCAN-USB interface, channel 15.

#define PCAN_USBBUS16

PCAN-USB interface, channel 16.

#define PCAN_USBBUS2

PCAN-USB interface, channel 2.

#define PCAN_USBBUS3

PCAN-USB interface, channel 3.

#define PCAN_USBBUS4

PCAN-USB interface, channel 4.

#define PCAN_USBBUS5

PCAN-USB interface, channel 5.

#define PCAN_USBBUS6

PCAN-USB interface, channel 6.

#define PCAN_USBBUS7

PCAN-USB interface, channel 7.

#define PCAN_USBBUS8

PCAN-USB interface, channel 8.

#define PCAN_USBBUS9

PCAN-USB interface, channel 9.

#define PCAN_VIRTUAL

PCAN Virtual hardware. NOT USED WITHIN PCAN-Basic API.

The service is running.

The service is not running.

#define TPCANBaudrate

PCAN Baud rate register value.

#define TPCANBitrateFD

PCAN-FD bit rate string.

#define TPCANDevice

PCAN device.

#define TPCANHandle

PCAN hardware channel handle.

The type of a PCAN message.

#define TPCANMode

PCAN filter mode.

#define TPCANParameter

PCAN parameter to be read or set.

#define TPCANStatus

PCAN status/error code (ATTENTION: changed from 64-bit to 32-bit)

timestamp of a received PCAN FD message

#define TPCANType

The type of PCAN hardware to be initialized.

#define TRACE_FILE_DATE

Includes the date into the name of the trace file.

Causes the overwriting of available traces (same name)

Traced data is distributed in several files with size PAN_TRACE_SIZE.

A single file is written until it size reaches PAN_TRACE_SIZE.

#define TRACE_FILE_TIME

Includes the start time into the name of the trace file.


Typedef Documentation

Describes an available PCAN channel

typedef struct tagTPCANMsg TPCANMsg

PCAN message

typedef struct tagTPCANMsgFD TPCANMsgFD

PCAN message from a FD capable hardware

Timestamp of a received PCAN message Total Microseconds = micros + 1000 * millis + 0x100000000 * 1000 * millis_overflow


Function Documentation

TPCANStatus CAN_FilterMessages ( TPCANHandle  Channel,
DWORD  FromID,
DWORD  ToID,
TPCANMode  Mode 
)

Configures the reception filter.

Note:
The message filter will be expanded with every call to this function. If it is desired to reset the filter, please use the CAN_SetValue function.
Parameters:
[in]ChannelThe handle of a PCAN Channel.
[in]FromIDThe lowest CAN ID to be received.
[in]ToIDThe highest CAN ID to be received.
[in]ModeMessage type, Standard (11-bit identifier) or Extended (29-bit identifier).
Returns:
A TPCANStatus error code.
TPCANStatus CAN_GetErrorText ( TPCANStatus  Error,
WORD  Language,
LPSTR  Buffer 
)

Returns a descriptive text of a given TPCANStatus error code, in any desired language.

Note:
The current languages available for translation are: Neutral (0x00), German (0x07), English (0x09), Spanish (0x0A), Italian (0x10) and French (0x0C).
Parameters:
[in]ErrorA TPCANStatus error code.
[in]LanguageIndicates a 'Primary language ID'.
[out]BufferBuffer for a null terminated char array.
Returns:
A TPCANStatus error code.

Gets the current status of a PCAN Channel.

Parameters:
[in]ChannelThe handle of a PCAN Channel.
Returns:
A TPCANStatus error code.
TPCANStatus CAN_GetValue ( TPCANHandle  Channel,
TPCANParameter  Parameter,
void *  Buffer,
DWORD  BufferLength 
)

Retrieves a PCAN Channel value.

Note:
Parameters can be present or not according with the kind of Hardware (PCAN Channel) being used. If a parameter is not available, a PCAN_ERROR_ILLPARAMTYPE error will be returned.
Parameters:
[in]ChannelThe handle of a PCAN Channel.
[in]ParameterThe TPCANParameter parameter to get.
[out]BufferBuffer for the parameter value.
[in]BufferLengthSize in bytes of the buffer.
Returns:
A TPCANStatus error code.
TPCANStatus CAN_Initialize ( TPCANHandle  Channel,
TPCANBaudrate  Btr0Btr1,
TPCANType HwType  _DEF_ARG,
DWORD IOPort  _DEF_ARG,
WORD Interrupt  _DEF_ARG 
)

Initializes a PCAN Channel.

Parameters:
[in]ChannelThe handle of a PCAN Channel.
[in]Btr0Btr1The speed for the communication (BTR0BTR1 code).
[in]HwType(not used with PCAN USB devices)
[in]IOPort(not used with PCAN USB devices)
[in]Interrupt(not used with PCAN USB devices)
Returns:
A TPCANStatus error code.

Initializes a FD capable PCAN Channel.

Parameters:
[in]ChannelThe handle of a FD capable PCAN Channel.
[in]BitrateFDThe speed for the communication (FD bit rate string).
Note:
See PCAN_BR_* values
  • Parameter and values must be separated by '='.
  • Couples of Parameter/value must be separated by ','.
  • Following Parameter must be filled out: f_clock, data_brp, data_sjw, data_tseg1, data_tseg2, nom_brp, nom_sjw, nom_tseg1, nom_tseg2.
  • Following Parameters are optional (not used yet): data_ssp_offset, nom_sam.
Example:
 *               f_clock=80000000,nom_brp=10,nom_tseg1=5,nom_tseg2=2,nom_sjw=1,data_brp=4,data_tseg1=7,data_tseg2=2,data_sjw=1
 *  
Returns:
A TPCANStatus error code.
TPCANStatus CAN_LookUpChannel ( LPSTR  Parameters,
TPCANHandle FoundChannel 
)

Finds a PCAN-Basic channel that matches with the given parameters.

Parameters:
[in]ParametersA comma separated string contained pairs of parameter-name/value to be matched within a PCAN-Basic channel
[out]FoundChannelBuffer for returning the PCAN-Basic channel, when found
Returns:
A TPCANStatus error code.
TPCANStatus CAN_Read ( TPCANHandle  Channel,
TPCANMsg MessageBuffer,
TPCANTimestamp TimestampBuffer 
)

Reads a CAN message from the receive queue of a PCAN Channel.

Parameters:
[in]ChannelThe handle of a PCAN Channel.
[out]MessageBufferA TPCANMsg structure buffer to store the CAN message.
[out]TimestampBufferA TPCANTimestamp structure buffer to get the reception time of the message. If this value is not desired, this parameter should be passed as NULL.
Returns:
A TPCANStatus error code.
TPCANStatus CAN_ReadFD ( TPCANHandle  Channel,
TPCANMsgFD MessageBuffer,
TPCANTimestampFD TimestampBuffer 
)

Reads a CAN message from the receive queue of a FD capable PCAN Channel.

Parameters:
[in]ChannelThe handle of a FD capable PCAN Channel.
[out]MessageBufferA TPCANMsgFD structure buffer to store the CAN message.
[out]TimestampBufferA TPCANTimestampFD buffer to get the reception time of the message. If this value is not desired, this parameter should be passed as NULL.
Returns:
A TPCANStatus error code.

Resets the receive and transmit queues of the PCAN Channel.

Note:
A reset of the CAN controller is not performed.
Parameters:
[in]ChannelThe handle of a PCAN Channel.
Returns:
A TPCANStatus error code.
TPCANStatus CAN_SetValue ( TPCANHandle  Channel,
TPCANParameter  Parameter,
void *  Buffer,
DWORD  BufferLength 
)

Configures or sets a PCAN Channel value.

Note:
Parameters can be present or not according with the kind of Hardware (PCAN Channel) being used. If a parameter is not available, a PCAN_ERROR_ILLPARAMTYPE error will be returned.
Parameters:
[in]ChannelThe handle of a PCAN Channel.
[in]ParameterThe TPCANParameter parameter to set.
[in]BufferBuffer with the value to be set.
[in]BufferLengthSize in bytes of the buffer.
Returns:
A TPCANStatus error code.

Uninitializes one or all PCAN Channels initialized by CAN_Initialize.

Note:
Giving the TPCANHandle value "PCAN_NONEBUS" uninitializes all initialized channels.
Parameters:
[in]ChannelThe handle of a PCAN Channel.
Returns:
A TPCANStatus error code.
TPCANStatus CAN_Write ( TPCANHandle  Channel,
TPCANMsg MessageBuffer 
)

Transmits a CAN message.

Parameters:
[in]ChannelThe handle of a PCAN Channel.
[in]MessageBufferA TPCANMsg buffer with the message to be sent.
Returns:
A TPCANStatus error code.
TPCANStatus CAN_WriteFD ( TPCANHandle  Channel,
TPCANMsgFD MessageBuffer 
)

Transmits a CAN message over a FD capable PCAN Channel.

Parameters:
[in]ChannelThe handle of a FD capable PCAN Channel.
[in]MessageBufferA TPCANMsgFD buffer with the message to be sent.
Returns:
A TPCANStatus error code.