From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

How can I read/write individual bits from/to CAN when using Channel API functions?

I want to read several CAN channels and write to a CAN channel by using NI-CAN Channel API functions. Some channels consist of one byte of 8 bit length, where every individual bit represents a status bit that has to be read or set (i.e. 1000 0000 or 0100 0000 ...). How can I specify the individual bits?
0 Kudos
Message 1 of 4
(6,171 Views)
Hello Zelba,

cannot specify individual bits in that way since the data type of the channel API is DBL.
They only way would be to specify a own channel for every bit.

Regards
Paul
0 Kudos
Message 2 of 4
(6,150 Views)
Thank you, Paul.
I feared that this might be the answer....
0 Kudos
Message 3 of 4
(6,146 Views)

Well the trick is to just crate or have in your case a unsigned 8 bit channel. You can then use a 8 bit unsigned integer datatype to write your bit pattern. See the attached VI. If you are using a C language it should be even easier.

DirkW

0 Kudos
Message 4 of 4
(6,127 Views)