Example Code

CAN Frame Channel Conversion Library - USBCANBasicOutput - Extended Arbitration ID

Code and Documents

Attachment

Introduction

To use the CAN Frame Channel conversion Library with Extended Arbitration IDs it is necessary to modify the Arbitration ID that is sent to the Frame ncWriteNetMulti.VI.  The ARB ID must be modified so that the Frame API can handle the extended arbitration ID.  Also it is important to note that the Convert Channel to Frame.VI handles extended arbitration IDs in the same matter as the Channel API.  It is therefore important to pass "different" arbitration IDs to different parts of the code to experience proper performance.

Steps to Complete

To use extended Arbitration IDs with the frame API it is necessary to perform some boolean arithmatic.  It this case it is necessary to OR the extended ARB ID - coming for the channel API - with 0x20000000.  This ends up flipping the 32nd bit from a 0 to 1 indicating to the CAN driver that it needs to handle an extended arbitration ID.

USBCANBasicOutput- Extended ARB ID_Snippet.png

Additional information

This change must be undone when reading CAN frames from the bus and then converting to a Channel.

Charley Dahan

Global Account Manager

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
tigermm
Member
Member
on

I'm confused, doesnt this flip the 30th bit to a 1? Not the 32nd?

http://digital.ni.com/public.nsf/allkb/312582CBED6BDD0586256F2400698947?OpenDocument


Contributors