Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read a particular arbitration id from CAN bus

Hi All,

 

I want to read a CAN message with arbitration id 700h from CAN bus. There may be more then one CAN message available on the bus. How can i read a CAN message of particular arbitration id from CAN bus.

 

Kindly reply as soon as available.

 

Regards,

0 Kudos
Message 1 of 13
(18,327 Views)

Hi ,

     Check out the following VI. Also refer to the CAN manual: http://www.ni.com/pdf/manuals/370289m.pdf

 

Hope that helps.

 

Kudos are welcome.

Shreyas Hebbare
Shreyas Technologies
India
0 Kudos
Message 2 of 13
(18,311 Views)

Hi,

 

Kindly attached this example in Labview 7.1.

 

 

0 Kudos
Message 3 of 13
(18,309 Views)

Hi,

    I am attaching the screenshot of the VI. Hope it works in 7.1. Else upgrade LabVIEW.

Kudos are welcome

 

block.jpgfront.jpg

Shreyas Hebbare
Shreyas Technologies
India
0 Kudos
Message 4 of 13
(18,307 Views)

Hi All

 

With ncOpen.vi we can set the particular arbitration id that we want to read from the CAN bus. Now if i have to read 3 arbitration id & write 2 arbitration id then can it possible by using one ncOpen.vi function or i have to use ncOpen.vi for every arbitration id ?

 

Kindly reply as soon as possible.

 

/J

0 Kudos
Message 5 of 13
(18,293 Views)

Also let me know what is the use of Mask & Comparator in ncConfigCANNET.vi.  Can it be use for filtering the Arbitration id which we want to read ?

0 Kudos
Message 6 of 13
(18,290 Views)

Hi,

  With ncopen you can only set one arbitration id. Check out the ncreadobjmulti.vi and ncwritemultiobj.vi 

Examples of CAN in Example finder will help you understand it better.

 

 Standard Comparator is the CAN arbitration ID for the standard (11-bit) frame comparator.

 

Standard Mask is the bit mask used in conjunction with the Standard Comparator attribute for filtration of incoming standard (11-bit) CAN frames. If the mask/comparator matches, the frame is stored in the Network Interface queue, otherwise it is discarded. Bits in the mask that are clear are treated as don't-cares. For example, hex 00000700 means to compare only the three upper bits of the 11-bit standard ID.

 

Kindly refer to the following threads and manual for more information:

http://www.ni.com/pdf/manuals/370289k.pdf

http://forums.ni.com/ni/board/message?board.id=30&message.id=505&requireLogin=False

http://forums.ni.com/ni/board/message?board.id=30&requireLogin=False&thread.id=2010

Message Edited by Shreyas on 09-03-2009 12:16 PM
Shreyas Hebbare
Shreyas Technologies
India
0 Kudos
Message 7 of 13
(18,267 Views)

Hi

 

Thank you very much for the useful reply.

 

If i want to read 800h to 805h arbitration id then what will be the Standard Comparator & Standard Mask value ?

 

Thanxs in advance

0 Kudos
Message 8 of 13
(18,263 Views)
i am using PCI-CAN/XS series card with labview 7.1
0 Kudos
Message 9 of 13
(18,259 Views)
The comparators and masks are used to filter which frames are received by the Network Interface Object. Standard and extended refer to the CAN arbitration ID where standard is 11 bits and extended is 29 bits. How you set the comparator dictates which frames will be received.

As an example, consider a CAN network receiving 3 IDs (01, 02, and 03, see the readmultnet.vi example). The combination of the comparator and the mask will determine which frames are received. The tables below describe this behavior (note all values are in Binary).

The Mask is the bitmask used in conjunction with NC_ATTR_CAN_COMP_STD for filtration of incoming standard CAN frames. For each bit set in the mask, NI-CAN checks the corresponding bit in the standard frame comparator for a match. Bits in the mask that are clear (i.e., set to 0) are treated as "don’t cares". For example, hex 000007FF (in the comparator) means to compare all 11 bits of incoming standard CAN frames.

Note:
  1. If you intend to use CAN Objects as the sole means of receiving standard CAN frames from the network, then you should disable all standard frame reception in the CAN Network Interface Object by setting the Standard Comparator Attribute to NC_CAN_ARBID_NONE (CFFFFFFF hex). Hence, if the standard frame comparator is NC_CAN_ARBID_NONE (0xCFFFFFFF), then NI-CAN ignores the mask, and all standard frame reception is disabled in the CAN Network Interface Object.
  2. If you intend to use the Network Interface as the sole means of receiving standard CAN frames from the network, then you should set the Standard Comparator Attribute of the Network Interface Object to 0.

Comparator           11           11                 11              11
Mask 00 01 10 11
Frames Received All 01 (1), 11 (3) 10 (2), 11 (3) 11 (3)


Comparator 00 00 00 00
Mask 00 01 10 11
Frames Received All 10 (2) 01 (1) None


Extended comparators and masks work in exactly the same way. As you can see, it is possible to use complex combinations of these attributes to precisely define which frames will be received.

 

Also suggest you to go through the CAN manual and labview help and check out this forum: http://forums.ni.com/ni/board/message?board.id=30&message.id=2209&requireLogin=False

 

 

Kudos are welcome

 

Shreyas Hebbare
Shreyas Technologies
India
0 Kudos
Message 10 of 13
(18,237 Views)