Chapter 2
Developing Your Application
©
National Instruments Corporation
2-11
Qualifier
The qualifier bits hold a qualifier for the warning or error code. It is specific
to individual values for the code field, and provides additional information
useful for detailed debugging. For example, if the status code indicates an
invalid function parameter, the qualifier holds a number that indicates the
exact parameter that is invalid (one for the first parameter, two for the
second, and so on). If no qualifier exists, this field has the value
NC_QUAL_NONE
(0).
For descriptions of the NI-CAN status codes and their qualifiers, refer to
the
NI-CAN Programmer Reference Manual
.
Checking Status in LabVIEW
For applications written in G (LabVIEW), status checking is basically
handled automatically. For all of the NI-CAN functions, the lower left and
right terminals provide status information using LabVIEW Error Clusters.
LabVIEW Error Clusters are designed so that status information flows
from one function to the next, and function execution stops when an error
occurs. For more information, refer to the
Error Handling
section in the
LabVIEW Online Reference.
In NI-CAN’s implementation of Error Clusters, the
status
parameter is
set to true when an error occurs, and is set to false when a warning or
success occurs. The
code
parameter of the Error Cluster contains the code
and qualifier fields of the NI-CAN status. If the
code
parameter of the
Error Cluster is not zero, then a warning or error was detected. When the
status
parameter is true, the
source
parameter of the Error Cluster
provides the name of the NI-CAN function in which the error occurred.
Within your LabVIEW Block Diagram, wire the
Error in
and
Error
out
terminals of all NI-CAN functions together in succession. When an
error is detected in any NI-CAN function (
status
parameter true), all
subsequent NI-CAN functions are skipped except for
ncClose
. The
ncClose
function executes regardless of whether the incoming
status
is
true or false. This ensures that all NI-CAN objects are closed properly when
execution stops due to an error.
When a warning occurs in an NI-CAN function, execution proceeds
normally. To detect suspected warnings in your application, you can write
code in your Block Diagram to examine the
code
parameter, or you can use
the
Probe Data
tool on an
Error out
terminal during execution.