Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Changes in Error Codes as of NI-DNET Version 1.4

Primary Software: Driver Software>>NI-DNET
Primary Software Version: 1.4
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: In NI-DNET 1.4, the error codes have changed from previous versions.

When you have a program that evaluates the error code from the error cluster, the program will no longer be able to react appropriately with the newer driver version. It is possible to reprogram the error handling routines by replacing the old error code values with the new ones, but this is not realistic for larger applications.

Solution: As of version 1.4 of NI-DNET, the encoding of error codes returned from all functions was changed.

The new error encoding provides the following benefits:
  • NI-DNET errors are now included in the scheme used for all National Instruments products, and therefore the standard error-handling functions of LabVIEW and LabWindows/CVI now recognize and describe NI-DNET errors.
  • In LabVIEW, the DeviceNet Error Handler should no longer be used, instead LabVIEW's standard Simple Error Handler.vi can be used, which provides complete information on the NI-DNET error.
  • The new encoding allows us to provide a more precise description to assist debugging.

Although the new encoding provides many benefits, you may need to make changes to your existing NI-DNET application.

If you have already deployed executable applications to your customers, and you are concerned that possible upgrades of NI-DNET in the field will break the error handling in your application, NI-DNET 1.4 provides a way to change the error code format back to the old format:
You will find the file nicanopt.ini in the Windows directory (usually C:\Windows or C:\WinNT). In that file is a section called [REVERSESTATUS_OPTION] where REVERSESTATUS is set to OFF. Changing it to ON will change the format of the error code to the legacy format. Make sure that you close all active NI-DNET applications and start them again to see the changed error code format.
This special feature is not guaranteed to be supported in future releases of NI-DNET, so we strongly recommend that when possible, you upgrade your application code to use the new error scheme.

The following instructions detail the steps required to change NI-DNET error handling in your application:

LabVIEW
  1. No change is required regarding your handling of error clusters. The status, code, and source fields of the NI-DNET error cluster still operate in the same manner as previous versions.
  2. If you wish to display a dialog box whenever an error occurs, wire the error output of the last NI-DNET Close VI into LabVIEW's Simple Error Handler.vi. When an error occurs, the resulting dialog will describe the error, and recommend possible solutions.
  3. If you use the Simple Error Handler.vi, you may be able to remove error clusters that you previously displayed on your front panel for NI-DNET debugging.
  4. Check to see if your diagram uses the code field of the NI-DNET error cluster. If you do comparisons or other operations in which you have entered constants for the code, those constants must change. Refer to Table 2 below for assistance in converting legacy status values into new status values.
  5. If you use the NI-DNET Get Attribute VI to get the Object Status, you must change any constants used for error/warning comparisons as in Step 4 above.

C/C++
  1. If you do comparisons of NI-DNET status in your code, the constant names must change. If you used constant names from NIDNET.H for such comparisions, refer to Table 1 below for assistance in converting legacy names into new status names. If you used numeric constants for such comparisions, refer to Table 2 below.
  2. If you use the NI-DNET ncGetAttribute function to get the NC_ATTR_STATUS attribute, you must change any constants used for error/warning comparisons as in Step 2 above.


Table 1: Convert Legacy C/C++ Names to New Name

The original error encoding of NI-DNET (prior to 1.4) used three different bit fields. This use of bit fields was often confusing to interpret.

Each error code now consists of a single, simple numeric value (no bit fields).

The following constants were previously used to access bit fields. These constants are no longer required. Expressions that use these constants should be replaced with a single error constant from the table below.
NC_MK_SEVERITY
NC_MK_QUALIFIER
NC_MK_CODE
NC_STATSEV
NC_STATQUAL
NC_STATCODE
NC_SEV_SUCCESS
NC_SEV_WARNING
NC_SEV_ERROR

The following table is alphabetized according to the name of the legacy code field.
Legacy namesNew name
NC_SUCCESSCanSuccess
NC_ERR_TIMEOUT | NC_QUAL_TIMO_FUNCTION | NC_SEV_ERRORCanErrFunctionTimeout
NC_ERR_TIMEOUT | NC_QUAL_TIMO_WATCHDOG | NC_SEV_ERRORCanErrWatchdogTimeout
NC_ERR_TIMEOUT | NC_QUAL_TIMO_SCHEDULE | NC_SEV_ERRORCanErrScheduleTimeout
NC_ERR_TIMEOUT | NC_QUAL_TIMO_CONNECTION | NC_SEV_ERRORDnetErrConnectionTimeout
NC_ERR_DRIVER | (0x00000000 to 0x7FFF0000) | NC_SEV_ERRORCanErrDriver
NC_ERR_BAD_NAME | NC_SEV_ERRORCanErrBadNameSyntax | CanErrBadIntfName
NC_ERR_BAD_PARAM | NC_QUAL_BAD_UNKNOWN | NC_SEV_ERRORCanErrBadParam
NC_ERR_BAD_PARAM | NC_QUAL_BAD_HANDLE | NC_SEV_ERRORCanErrBadHandle
NC_ERR_ALREADY_OPEN | NC_QUAL_OPEN_UNKNOWN | NC_SEV_ERRORCanErrAlreadyOpen
NC_ERR_ALREADY_OPEN | NC_QUAL_OPEN_INTF_MODE | NC_SEV_ERRORDnetErrOpenIntfMode
NC_ERR_ALREADY_OPEN | NC_QUAL_OPEN_CONNTYPE | NC_SEV_ERRORDnetErrOpenConnType
NC_ERR_NOT_STOPPED | NC_SEV_ERRORCanErrNotStopped
NC_ERR_OLD_DATA | NC_SEV_WARNINGCanWarnOldData
NC_ERR_DEVICE_INIT | NC_QUAL_DEVI_OTHER | NC_SEV_ERRORDnetErrDevInitOther
NC_ERR_DEVICE_INIT | NC_QUAL_DEVI_IO_CONN | NC_SEV_ERRORDnetErrDevInitIoConn
NC_ERR_DEVICE_INIT | NC_QUAL_DEVI_IN_LEN | NC_SEV_ERRORDnetErrDevInitInputLen
NC_ERR_DEVICE_INIT | NC_QUAL_DEVI_OUT_LEN | NC_SEV_ERRORDnetErrDevInitOutputLen
NC_ERR_DEVICE_INIT | NC_QUAL_DEVI_EPR | NC_SEV_ERRORDnetErrDevInitEPR
NC_ERR_DEVICE_INIT | NC_QUAL_DEVI_VENDOR | NC_SEV_ERRORDnetErrDevInitVendor
NC_ERR_DEVICE_INIT | NC_QUAL_DEVI_DEVTYPE | NC_SEV_ERRORDnetErrDevInitDevType
NC_ERR_DEVICE_INIT | NC_QUAL_DEVI_PRODCODE | NC_SEV_ERRORDnetErrDevInitProdCode
NC_ERR_NOT_SUPPORTED | NC_SEV_ERRORCanErrNotSupported
NC_ERR_CAN_COMM | NC_QUAL_CAN_UNKNOWN | NC_SEV_ERRORCanErrComm
NC_ERR_CAN_COMM | NC_QUAL_CAN_STUFF | NC_SEV_ERRORCanErrCommStuff
NC_ERR_CAN_COMM | NC_QUAL_CAN_FORM | NC_SEV_ERRORCanErrCommFormat
NC_ERR_CAN_COMM | NC_QUAL_CAN_ACK | NC_SEV_ERRORCanErrCommNoAck
NC_ERR_CAN_COMM | NC_QUAL_CAN_BIT1 | NC_SEV_ERRORCanErrCommTx1Rx0
NC_ERR_CAN_COMM | NC_QUAL_CAN_BIT0 | NC_SEV_ERRORCanErrCommTx0Rx1
NC_ERR_CAN_COMM | NC_QUAL_CAN_CRC | NC_SEV_ERRORCanErrCommBadCRC
NC_ERR_CAN_COMM | NC_QUAL_CAN_UNKNOWN | NC_SEV_WARNINGCanWarnComm
NC_ERR_CAN_COMM | NC_QUAL_CAN_STUFF | NC_SEV_WARNINGCanWarnCommStuff
NC_ERR_CAN_COMM | NC_QUAL_CAN_FORM | NC_SEV_WARNINGCanWarnCommFormat
NC_ERR_CAN_COMM | NC_QUAL_CAN_ACK | NC_SEV_WARNINGCanWarnCommNoAck
NC_ERR_CAN_COMM | NC_QUAL_CAN_BIT1 | NC_SEV_WARNINGCanWarnCommTx1Rx0
NC_ERR_CAN_COMM | NC_QUAL_CAN_BIT0 | NC_SEV_WARNINGCanWarnCommTx0Rx1
NC_ERR_CAN_COMM | NC_QUAL_CAN_CRC | NC_SEV_WARNINGCanWarnCommBadCRC
NC_ERR_RSRC_LIMITS | NC_QUAL_RSRC_QUEUE_LEN | NC_SEV_WARNINGCanWarnRsrcLimitQueues
NC_ERR_RSRC_LIMITS | NC_QUAL_RSRC_QUEUE_LEN | NC_SEV_ERRORCanErrRsrcLimitQueues
NC_ERR_RSRC_LIMITS | NC_QUAL_RSRC_IO_LEN | NC_SEV_ERRORDnetErrRsrcLimitIO
NC_ERR_RSRC_LIMITS | NC_QUAL_RSRC_WRITE_SRV | NC_SEV_ERRORDnetErrRsrcLimitWriteSrvc
NC_ERR_RSRC_LIMITS | NC_QUAL_RSRC_READ_SRV | NC_SEV_ERRORDnetErrRsrcLimitReadSrvc
NC_ERR_RSRC_LIMITS | NC_QUAL_RSRC_RESP_PENDING | NC_SEV_ERRORDnetErrRsrcLimitRespPending
NC_ERR_READ_NOT_AVAIL | NC_SEV_ERRORDnetErrNoReadAvail
NC_ERR_BAD_NET_ID | NC_SEV_ERRORDnetErrBadMacId
NC_ERR_DEVICE_MISSING | NC_SEV_ERRORDnetErrDeviceMissing
NC_ERR_DEVICE_MISSING | NC_SEV_WARNINGDnetWarnDeviceMissing
NC_ERR_FRAGMENTATION | NC_SEV_ERRORDnetErrFragmentation
NC_ERR_NO_CONFIG | NC_QUAL_NCFG_UNKNOWN | NC_SEV_ERRORDnetErrIntfNotOpen
NC_ERR_NO_CONFIG | NC_QUAL_NCFG_MASTER | NC_SEV_ERRORDnetErrIntfNotOpen
NC_ERR_DNET_ERR_RESP | NC_SEV_ERRORDnetErrErrorResponse
NC_ERR_OVERFLOW | NC_QUAL_OVFL_WRITE | NC_SEV_ERRORCanErrOverflowWrite
NC_ERR_OVERFLOW | NC_QUAL_OVFL_READ | NC_SEV_ERRORCanErrOverflowRead
NC_ERR_OVERFLOW | NC_QUAL_OVFL_CHIP | NC_SEV_ERRORCanErrOverflowChip


Table 2: Convert Legacy Value To New Value

The following table is sorted according to the value of the legacy code field (low 16 bits).

Legacy valueNew nameNew value
0CanSuccess0 (same)
0x80000001CanErrFunctionTimeout0xBFF62001
0x80010001CanErrWatchdogTimeout0xBFF62021
0x80020001DnetErrConnectionTimeout0xBFF62041
0x80050001CanErrScheduleTimeout0xBFF620A1
0x80000002 | (0 to 0x7FFF000)CanErrDriver0xBFF62002
0x80000003CanErrBadNameSyntax | CanErrBadIntfName0xBFF62023 | 0xBFF62003
0x80000004CanErrBadParam0xBFF62004
0x81000004CanErrBadHandle0xBFF62024
0x80000005CanErrBadAttributeValue0xBFF62005
0x40000006CanWarnAlreadyOpen0x3FF62006
0x80000006CanErrAlreadyOpen0xBFF62006
0x80010006DnetErrOpenIntfMode0xBFF62026
0x80020006DnetErrOpenConnType0xBFF62046
0x80000007CanErrNotStopped0xBFF62007
0x80000008CanErrOverflowWrite0xBFF62008
0x80010008CanErrOverflowCard0xBFF62028
0x80020008CanErrOverflowChip0xBFF62048
0x00000009CanWarnOldData0xBFF62009
0x0000000ACanErrNotSupported0xBFF6200A
0x4000000BCanWarnComm0x3FF6200B
0x8000000BCanErrComm0xBFF6200B
0x4001000BCan
WarnCommStuff
0x3FF6202B
0x8001000BCanErrCommStuff0xBFF6202B
0x4002000BCanWarnCommFormat0x3FF6204B
0x8002000BCanErrCommFormat0xBFF6204B
0x4003000BCanWarnCommNoAck0x3FF6206B
0x8003000BCanErrCommNoAck0xBFF6206B
0x4004000BCanWarnCommTx1Rx00x3FF6208B
0x8004000BCanErrCommTx1Rx00xBFF6208B
0x4005000BCanWarnCommTx0Rx10x3FF620AB
0x8005000BCanErrCommTx0Rx10xBFF620AB
0x4006000BCanWarnCommBadCRC0x3FF620CB
0x8006000BCanErrCommBadCRC0xBFF620CB
0x4001000DCanWarnRsrcLimitQueues0x3FF6202D
0x8001000DCanErrRsrcLimitQueues0xBFF6202D
0x8002000DDnetErrRsrcLimitIO0xBFF6204D
0x8003000DDnetErrRsrcLimitWriteSrvc0xBFF6206D
0x8004000DDnetErrRsrcLimitReadSrvc0xBFF6208D
0x8005000DDnetErrRsrcLimitRespPending0xBFF620AD
0x8000000EDnetErrNoReadAvail0xBFF6200E
0x8000000FDnetErrBadMacId0xBFF6200F
0x80000010DnetErrDevInitOther0xBFF62010
0x80010010DnetErrDevInitIoConn0xBFF62030
0x80020010DnetErrDevInitInputLen0xBFF62050
0x80030010DnetErrDevInitOutputLen0xBFF62070
0x80040010DnetErrDevInitEPR 0xBFF62090
0x80050010DnetErrDevInitVendor0xBFF620B0
0x80060010DnetErrDevInitDevType0xBFF620D0
0x80070010DnetErrDevInitProdCode0xBFF620F0
0x40000011DnetWarnDeviceMissing0x3FF62011
0x80000011DnetErrDeviceMissing0xBFF62011
0x80000012DnetErrFragmentation0xBFF62012
0x80010013DnetErrIntfNotOpen0xBFF62033
0x80000014DnetErrErrorResponse0xBFF62014
0x80000015CanWarnNotificationPending0xBFF62015


Related Links:

Attachments:





Report Date: 06/03/2004
Last Updated: 06/28/2004
Document ID: 3A2E8THR

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit