Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

error checking using ncWaitForState

I am using Status = ncWaitForState(Objh, NC_FRMTYPE_COMM_ERR, 100, 0); to check for my USB CAN transmit connection. If I am to use ncCreateNotification to do data polling for callback, what other method can I use to do error checking?
0 Kudos
Message 1 of 2
(4,458 Views)
According to Page 534 of the NI-CAN Hardware and Software Manual.pdf on page

ncCreateNotification - Return Value
Status of the function call, returned as a signed 32-bit integer. Zero means the function executed successfully. Negative specifies an error, meaning the function did not perform expected behavior. Positive specifies a warning, meaning the function performed as expected, but a condition arose that might require attention. For more information, refer to ncStatusToString.

Thus if Status is an integer then you can just assign ncCreateNotification's return value to Status.  If Status is a string then you can use ncStatusToString.


As a Side note, also on page 534 there is the warning:
The ncCreateNotification function is not supported by the 847x and 847x with Sync series CAN and LIN interfaces.


Regards,
John E.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 2
(4,446 Views)