Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I know when CAN Read returns valid data?

I ran into a situation today where I initialized a task for input and then read the task prior to the channel data being present on CAN.  The CAN Read completed without any errors and returned a value of 0 for the channel data.  If I didn't know any better, it would appear as though the channel data I was attempting to read had a value of 0.  Is there a way to allow a CAN Read to occur only if there has been a received message which contained the channel in the channel list?
thanks.
0 Kudos
Message 1 of 2
(3,711 Views)

Hi,

 

You could use the timestamped input, to get only the frames really arriving on the bus. In this case the sample rate input will be ignored.

Or you could define a value different from zero for the channel default value, so you will know that it is the default value.

DirkW

 

0 Kudos
Message 2 of 2
(3,700 Views)