TPCANStatus

PCAN-Basic

PCAN-Basic Documentation
Home
PreviousUpNext
TPCANStatus

Represents a PCAN status/error code. According with the programming language, this type can be a group of defined values or an enumeration.

Syntax
#define TPCANStatus DWORD

#define PCAN_ERROR_OK 0x00000
#define PCAN_ERROR_XMTFULL 0x00001
#define PCAN_ERROR_OVERRUN 0x00002
#define PCAN_ERROR_BUSLIGHT 0x00004
#define PCAN_ERROR_BUSHEAVY 0x00008
#define PCAN_ERROR_BUSWARNING  PCAN_ERROR_BUSHEAVY
#define PCAN_ERROR_BUSPASSIVE 0x40000
#define PCAN_ERROR_BUSOFF 0x00010
#define PCAN_ERROR_ANYBUSERR (PCAN_ERROR_BUSWARNING | PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY | PCAN_ERROR_BUSOFF | PCAN_ERROR_BUSPASSIVE)
#define PCAN_ERROR_QRCVEMPTY 0x00020
#define PCAN_ERROR_QOVERRUN 0x00040
#define PCAN_ERROR_QXMTFULL 0x00080
#define PCAN_ERROR_REGTEST 0x00100
#define PCAN_ERROR_NODRIVER 0x00200
#define PCAN_ERROR_HWINUSE 0x00400
#define PCAN_ERROR_NETINUSE 0x00800
#define PCAN_ERROR_ILLHW 0x01400
#define PCAN_ERROR_ILLNET 0x01800
#define PCAN_ERROR_ILLCLIENT 0x01C00
#define PCAN_ERROR_ILLHANDLE (PCAN_ERROR_ILLHW | PCAN_ERROR_ILLNET | PCAN_ERROR_ILLCLIENT)
#define PCAN_ERROR_RESOURCE 0x02000
#define PCAN_ERROR_ILLPARAMTYPE 0x04000
#define PCAN_ERROR_ILLPARAMVAL 0x08000
#define PCAN_ERROR_UNKNOWN 0x10000
#define PCAN_ERROR_ILLDATA 0x20000
#define PCAN_ERROR_CAUTION 0x2000000
#define PCAN_ERROR_INITIALIZE 0x4000000
#define PCAN_ERROR_ILLOPERATION 0x8000000
{$Z4}
TPCANStatus = (
    PCAN_ERROR_OK = $00000,
    PCAN_ERROR_XMTFULL = $00001,
    PCAN_ERROR_OVERRUN = $00002,
    PCAN_ERROR_BUSLIGHT = $00004,
    PCAN_ERROR_BUSHEAVY = $00008,
    PCAN_ERROR_BUSHWARNING  = Byte(PCAN_ERROR_BUSHEAVY),
    PCAN_ERROR_BUSPASSIVE = $40000,
    PCAN_ERROR_BUSOFF = $00010,
    PCAN_ERROR_ANYBUSERR = Byte(PCAN_ERROR_BUSHWARNING) Or Byte(PCAN_ERROR_BUSLIGHT) Or Byte(PCAN_ERROR_BUSHEAVY) Or Byte(PCAN_ERROR_BUSOFF) Or Byte(PCAN_ERROR_BUSPASSIVE),
    PCAN_ERROR_QRCVEMPTY = $00020,
    PCAN_ERROR_QOVERRUN  = $00040,
    PCAN_ERROR_QXMTFULL = $00080,
    PCAN_ERROR_REGTEST = $00100,
    PCAN_ERROR_NODRIVER = $00200,
    PCAN_ERROR_HWINUSE = $00400,
    PCAN_ERROR_NETINUSE = $00800,
    PCAN_ERROR_ILLHW = $01400,
    PCAN_ERROR_ILLNET = $01800,
    PCAN_ERROR_ILLCLIENT = $01C00,
    PCAN_ERROR_ILLHANDLE = Byte(PCAN_ERROR_ILLHW) Or Byte(PCAN_ERROR_ILLNET) Or Byte(PCAN_ERROR_ILLCLIENT),
    PCAN_ERROR_RESOURCE = $02000,
    PCAN_ERROR_ILLPARAMTYPE = $04000,
    PCAN_ERROR_ILLPARAMVAL = $08000,
    PCAN_ERROR_UNKNOWN = $10000,
    PCAN_ERROR_ILLDATA = $20000,
    PCAN_ERROR_CAUTION = $2000000,
    PCAN_ERROR_INITIALIZE = $4000000,
    PCAN_ERROR_ILLOPERATION = $8000000
);
[Flags]
public enum TPCANStatus : uint
{
    PCAN_ERROR_OK = 0x00000,
    PCAN_ERROR_XMTFULL = 0x00001,
    PCAN_ERROR_OVERRUN = 0x00002,
    PCAN_ERROR_BUSLIGHT = 0x00004,
    PCAN_ERROR_BUSHEAVY = 0x00008,
    PCAN_ERROR_BUSWARNING   = PCAN_ERROR_BUSHEAVY,
    PCAN_ERROR_BUSPASSIVE   = 0x40000,
    PCAN_ERROR_BUSOFF = 0x00010,
    PCAN_ERROR_ANYBUSERR = (PCAN_ERROR_BUSWARNING | PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY | PCAN_ERROR_BUSOFF | PCAN_ERROR_BUSPASSIVE),
    PCAN_ERROR_QRCVEMPTY = 0x00020,
    PCAN_ERROR_QOVERRUN = 0x00040,
    PCAN_ERROR_QXMTFULL = 0x00080,
    PCAN_ERROR_REGTEST = 0x00100,
    PCAN_ERROR_NODRIVER = 0x00200,
    PCAN_ERROR_HWINUSE = 0x00400,
    PCAN_ERROR_NETINUSE = 0x00800,
    PCAN_ERROR_ILLHW = 0x01400,
    PCAN_ERROR_ILLNET = 0x01800,
    PCAN_ERROR_ILLCLIENT = 0x01C00,
    PCAN_ERROR_ILLHANDLE = (PCAN_ERROR_ILLHW | PCAN_ERROR_ILLNET | PCAN_ERROR_ILLCLIENT),
    PCAN_ERROR_RESOURCE = 0x02000,
    PCAN_ERROR_ILLPARAMTYPE = 0x04000,
    PCAN_ERROR_ILLPARAMVAL = 0x08000,
    PCAN_ERROR_UNKNOWN = 0x10000,
    PCAN_ERROR_ILLDATA = 0x20000,
    PCAN_ERROR_CAUTION = 0x2000000,
    PCAN_ERROR_INITIALIZE = 0x4000000,
    PCAN_ERROR_ILLOPERATION = 0x8000000,
}
[Flags]
public enum class TPCANStatus : UInt32
{
    PCAN_ERROR_OK = 0x00000,
    PCAN_ERROR_XMTFULL = 0x00001,
    PCAN_ERROR_OVERRUN = 0x00002,
    PCAN_ERROR_BUSLIGHT = 0x00004,
    PCAN_ERROR_BUSHEAVY = 0x00008,
    PCAN_ERROR_BUSWARNING   = PCAN_ERROR_BUSHEAVY,
    PCAN_ERROR_BUSPASSIVE = 0x40000,
    PCAN_ERROR_BUSOFF = 0x00010,
    PCAN_ERROR_ANYBUSERR = (PCAN_ERROR_BUSWARNING | PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY | PCAN_ERROR_BUSOFF | PCAN_ERROR_BUSPASSIVE),
    PCAN_ERROR_QRCVEMPTY = 0x00020,
    PCAN_ERROR_QOVERRUN = 0x00040,
    PCAN_ERROR_QXMTFULL = 0x00080,
    PCAN_ERROR_REGTEST = 0x00100,
    PCAN_ERROR_NODRIVER = 0x00200,
    PCAN_ERROR_HWINUSE = 0x00400,
    PCAN_ERROR_NETINUSE = 0x00800,
    PCAN_ERROR_ILLHW = 0x01400,
    PCAN_ERROR_ILLNET = 0x01800,
    PCAN_ERROR_ILLCLIENT = 0x01C00,
    PCAN_ERROR_ILLHANDLE = (PCAN_ERROR_ILLHW | PCAN_ERROR_ILLNET | PCAN_ERROR_ILLCLIENT),
    PCAN_ERROR_RESOURCE = 0x02000,
    PCAN_ERROR_ILLPARAMTYPE = 0x04000,
    PCAN_ERROR_ILLPARAMVAL = 0x08000,
    PCAN_ERROR_UNKNOWN = 0x10000,
    PCAN_ERROR_ILLDATA = 0x20000,
    PCAN_ERROR_CAUTION = 0x2000000,
    PCAN_ERROR_INITIALIZE = 0x4000000,
    PCAN_ERROR_ILLOPERATION = 0x8000000,
}
<Flags()> _
Public Enum TPCANStatus As UInt32
    PCAN_ERROR_OK = &H0
    PCAN_ERROR_XMTFULL = &H1
    PCAN_ERROR_OVERRUN = &H2
    PCAN_ERROR_BUSLIGHT = &H4
    PCAN_ERROR_BUSHEAVY = &H8
    PCAN_ERROR_BUSWARNING = PCAN_ERROR_BUSHEAVY
    PCAN_ERROR_BUSPASSIVE = &H40000
    PCAN_ERROR_BUSOFF = &H10
    PCAN_ERROR_ANYBUSERR = (PCAN_ERROR_BUSWARNING Or PCAN_ERROR_BUSLIGHT Or PCAN_ERROR_BUSHEAVY Or PCAN_ERROR_BUSOFF Or PCAN_ERROR_BUSPASSIVE)
    PCAN_ERROR_QRCVEMPTY = &H20
    PCAN_ERROR_QOVERRUN = &H40
    PCAN_ERROR_QXMTFULL = &H80
    PCAN_ERROR_REGTEST = &H100
    PCAN_ERROR_NODRIVER = &H200
    PCAN_ERROR_HWINUSE = &H400
    PCAN_ERROR_NETINUSE = &H800
    PCAN_ERROR_ILLHW = &H1400
    PCAN_ERROR_ILLNET = &H1800
    PCAN_ERROR_ILLCLIENT = &H1C00
    PCAN_ERROR_ILLHANDLE = (PCAN_ERROR_ILLHW Or PCAN_ERROR_ILLNET Or PCAN_ERROR_ILLCLIENT)
    PCAN_ERROR_RESOURCE = &H2000
    PCAN_ERROR_ILLPARAMTYPE = &H4000
    PCAN_ERROR_ILLPARAMVAL = &H8000
    PCAN_ERROR_UNKNOWN = &H10000
    PCAN_ERROR_ILLDATA = &H20000
    PCAN_ERROR_CAUTION = &H2000000
    PCAN_ERROR_INITIALIZE = &H4000000
    PCAN_ERROR_ILLOPERATION = &H8000000
End Enum
TPCANStatus = int

PCAN_ERROR_OK = TPCANStatus(0x00000)
PCAN_ERROR_XMTFULL = TPCANStatus(0x00001)
PCAN_ERROR_OVERRUN = TPCANStatus(0x00002
PCAN_ERROR_BUSLIGHT = TPCANStatus(0x00004)
PCAN_ERROR_BUSHEAVY = TPCANStatus(0x00008)
PCAN_ERROR_BUSWARNING = TPCANStatus(PCAN_ERROR_BUSHEAVY)
PCAN_ERROR_BUSPASSIVE = TPCANStatus(0x40000)
PCAN_ERROR_BUSOFF = TPCANStatus(0x00010)
PCAN_ERROR_ANYBUSERR = TPCANStatus(PCAN_ERROR_BUSWARNING | PCAN_ERROR_BUSLIGHT | PCAN_ERROR_BUSHEAVY | PCAN_ERROR_BUSOFF | PCAN_ERROR_BUSPASSIVE)
PCAN_ERROR_QRCVEMPTY = TPCANStatus(0x00020)
PCAN_ERROR_QOVERRUN = TPCANStatus(0x00040)
PCAN_ERROR_QXMTFULL = TPCANStatus(0x00080)
PCAN_ERROR_REGTEST = TPCANStatus(0x00100)
PCAN_ERROR_NODRIVER = TPCANStatus(0x00200)
PCAN_ERROR_HWINUSE = TPCANStatus(0x00400)
PCAN_ERROR_NETINUSE = TPCANStatus(0x00800)
PCAN_ERROR_ILLHW = TPCANStatus(0x01400)
PCAN_ERROR_ILLNET = TPCANStatus(0x01800)
PCAN_ERROR_ILLCLIENT = TPCANStatus(0x01C00)
PCAN_ERROR_ILLHANDLE = TPCANStatus(PCAN_ERROR_ILLHW | PCAN_ERROR_ILLNET | PCAN_ERROR_ILLCLIENT)
PCAN_ERROR_RESOURCE = TPCANStatus(0x02000)
PCAN_ERROR_ILLPARAMTYPE = TPCANStatus(0x04000)
PCAN_ERROR_ILLPARAMVAL = TPCANStatus(0x08000)
PCAN_ERROR_UNKNOWN = TPCANStatus(0x10000)
PCAN_ERROR_ILLDATA = TPCANStatus(0x20000)
PCAN_ERROR_CAUTION = TPCANStatus(0x2000000)
PCAN_ERROR_INITIALIZE = TPCANStatus(0x4000000)
PCAN_ERROR_ILLOPERATION = TPCANStatus(0x8000000)

Note that the values of the different PCAN-Status definitions are able to be bitwise combined. In some cases it is possible to get more than one error code as result of calling a function. 

*Note that the values of PCAN_ERROR_INITIALIZE and PCAN_ERROR_ILLOPERATION were changed! 

PCAN_ERROR_INITIALIZE changed from 0x40000 to 0x4000000 

PCAN_ERROR_ILLOPERATION changed from 0x80000 to 0x8000000

Name 
Value 
Description 
PCAN_ERROR_OK 
0x00000 (000000) 
No error. Success. 
PCAN_ERROR_XMTFULL 
0x00001 (000001) 
Transmit buffer in CAN controller is full. 
PCAN_ERROR_OVERRUN 
0x00002 (000002) 
CAN controller was read too late. 
PCAN_ERROR_BUSLIGHT 
0x00004 (000004) 
Bus error: an error counter reached the 'light' limit. 
PCAN_ERROR_BUSHEAVY 
0x00008 (000008) 
Bus error: an error counter reached the 'heavy' limit. 
PCAN_ERROR_BUSWARNING 
0x00008 (000008) 
Bus error: an error counter reached the 'warning' limit. 
PCAN_ERROR_BUSPASSIVE 
0x40000 (262144) 
Bus error: the CAN controller is error passive. 
PCAN_ERROR_BUSOFF 
0x00010 (000016) 
Bus error: the CAN controller is in bus-off state. 
PCAN_ERROR_ANYBUSERR 
0x4001C (262172) 
Mask for all bus errors. 
PCAN_ERROR_QRCVEMPTY 
0x00020 (000032) 
Receive queue is empty. 
PCAN_ERROR_QOVERRUN 
0x00040 (000064) 
Receive queue was read too late. 
PCAN_ERROR_QXMTFULL 
0x00080 (000128) 
Transmit queue is full. 
PCAN_ERROR_REGTEST 
0x00100 (000256) 
Test of the CAN controller hardware registers failed (no hardware found). 
PCAN_ERROR_NODRIVER 
0x00200 (000512) 
Driver not loaded. 
PCAN_ERROR_HWINUSE 
0x00400 (001024) 
PCAN-Hardware already in use by a PCAN-Net. 
PCAN_ERROR_NETINUSE 
0x00800 (002048) 
A PCAN-Client is already connected to the PCAN-Net. 
PCAN_ERROR_ILLHW 
0x01400 (005120) 
PCAN-Hardware handle is invalid. 
PCAN_ERROR_ILLNET 
0x01800 (006144) 
PCAN-Net handle is invalid. 
PCAN_ERROR_ILLCLIENT 
0x01C00 (007168) 
PCAN-Client handle is invalid. 
PCAN_ERROR_ILLHANDLE 
0x01C00 (007168) 
Mask for all handle errors. 
PCAN_ERROR_RESOURCE 
0x02000 (008192) 
Resource (FIFO, Client, timeout) cannot be created. 
PCAN_ERROR_ILLPARAMTYPE 
0x04000 (016384) 
Invalid parameter. 
PCAN_ERROR_ILLPARAMVAL 
0x08000 (032768) 
Invalid parameter value. 
PCAN_ERROR_UNKNOWN 
0x10000 (065536) 
Unknown error 
PCAN_ERROR_ILLDATA 
0x20000 (131072) 
Invalid data, function, or action. 
PCAN_ERROR_CAUTION 
0x2000000 (33554432) 
Operation succeeded but with irregularities. 
PCAN_ERROR_INITIALIZE* 
0x4000000 (67108864) 
Channel is not initialized. 
PCAN_ERROR_ILLOPERATION* 
0x8000000 (134217728) 
Invalid operation. 
Copyright © 2017. PEAK-System Technik GmbH. All rights reserved.
Send feedback to this documentation