Discussion:
How can I read/write individual bits from/to CAN when using Channel API functions?
(too old to reply)
zelba
2008-08-05 15:10:11 UTC
Permalink
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?
PaulFS
2008-08-08 13:40:10 UTC
Permalink
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.RegardsPaul
zelba
2008-08-08 13:40:10 UTC
Permalink
Thank you, Paul. I feared that this might be the answer....
DirkW
2008-08-11 14:10:12 UTC
Permalink
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


Single Sample Event Output_byte.vi:
http://forums.ni.com/attachments/ni/30/3686/1/Single Sample Event Output_byte.vi
Loading...