From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

Search PCI-CAN description command

I would like to know if a PCI-CAN description command exist. (an command wich return the type of card : CAN XS or CAN LS/2 ....)
0 Kudos
Message 1 of 2
(3,238 Views)
Greeetings,

I think you can only query the current transceiver type for a given CAN card, thus you would only see what the tranceiver of an XS card is currently set to. However, you can try to set the 'Transceiver Type' and if that succeeds, you know that it's an XS card.

Here's some pseudo-code for this:

;;=====================================================
;; make sure, that the CAN interface is not yet running, otherwise the
;; ncSetAttribute(Transceiver Type) fails because of the interface being active.
ncGetHardwareInfo(Number of Cards)
FOR all cards DO
ncGetHardwareInfo(Form Factor)
IF (Form Factor == 0) "PCI-CAN"
IF (Form Factor == 1) "PXI-CAN"
IF (Form Factor == 2) "PCMCIA-CAN"
IF (Form Factor == 3) "AT-CAN"

nc
GetHardwareInfo(Number of Ports)
IF (Number of Ports == 0) "CAN"
IF (Number of Ports == 1) "CAN/2"

ncGetHardwareInfo(Series)
IF (Number of Ports == 0) "Series 1"
IF (Number of Ports == 1) "Series 2"

;; now try changing the transceiver type
ncGetHardwareInfo(Interface Number)
ncConfig(Interface Number)
ncOpen(CANInterface Number)
status = ncSetAttribute(Transceiver Type)
IF (status != error)
;; card is "XS" type
ELSE
ncGetHardwareInfo(Transceiver Type)
IF (Transceiver Type == 0) "High-Speed"
IF (Transceiver Type == 1) "Low-Speed"
IF (Transceiver Type == 2) "Single Wire"
ncClose(Port Handle)

;;=====================================================

Hope this helps,

-B2k
Message 2 of 2
(3,238 Views)