Hi Haugan,
From your description (the card says that it supports both high-speed and low-speed CAN), I assume that you have a PCMCIA card. ncGetHardwareInfo(NC_ATTR_TRANSCEIVER_TYPE) is not supported on the PCMCIA form factor, which explains your return value of 0xFF.
Further more, all NI-CAN/NI-DNET function calls return a status, so all calls should be execute like this:
status = ncGetHardwareInfo(card, 1, NC_ATTR_TRANSCEIVER_TYPE, &type)
IF (status <> 0)
PRINT ("ncGetHardwareInfo returned error code %d", status)
That way, you know if the function even executed successfully. Here's the modified code (however, it doesn't check the status to make it more readable).
status = ncGetHardwareInfo(1, 1, NC_ATTR_NUM_CARDS, 4, &number_of_cards)
FOR card=1 TO number_of_cards {
// make sure, it’s a Series 1 CAN card,
// as NI-DNET does not work with Series 2 NI CAN hardware
status = ncGetHardwareInfo(card, 1, NC_ATTR_HW_SERIES, 4, &series)
IF (series == NC_HW_SERIES_1) {
// check, if it's a PCMCIA card, as we can't
// query the transceiver type for this form factor
status = ncGetHardwareInfo(card, 1, NC_ATTR_HW_FORMFACTOR, 4, &formfactor)
IF (formfactor <> NC_HW_FORMFACTOR_PCMCIA) {
// make sure, it’s a high-speed CAN card,
// as NI-DNET does not work with low-speed CAN hardware
status = ncGetHardwareInfo(card, 1, NC_ATTR_TRANSCEIVER_TYPE, &type)
IF (type == 0) {
status = ncGetHardwareInfo(card, 1, NC_ATTR_INTERFACE_NUM, &interface)
PRINT ("DNET%d, ", interface)
}
}
}
}Again, if you only have 'real' NI-DNET hardware (1-port, series 1, high-speed NI CAN cards), you don't need the blue portion of the code.
-B2k