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: 

CAN Channel Monitor

Is there a way to monitor number of messages received using channel API?
I want to check if the data on the CAN bus is ready updated or not without have to use frame API.
 
Thank you
 
0 Kudos
Message 1 of 5
(4,042 Views)
I don't think there's a way to monitor the number of messages received when using channel API.

You can run the bus monitor on your channel that's going to receive messages and see if the data value changed or not. Even though it's channel API you should still be able to see the hex values for your data input change. We tested this here by running a channel API example program to output values from the CAN 0 port of our CAN card while running bus monitor on the CAN 1 port. We could see the values change in the data columb when we adjusted the values we were writing with our example program.

Hope this helps,
Matt S.

LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
0 Kudos
Message 2 of 5
(4,034 Views)
Hi,

There is actually a LabVIEW example for this use case that ships with the NI-CAN driver software:
Open the NI ExampleFinder and navigate to:
Hardware Input and Output » CAN » Channel API » Advanced » Channel Monitor.vi

If you are not using LabVIEW, you can initialize the receiving task in the 'nctModeTimestampedInput' mode. The nctReadTimestamped() function does return the 'NumberOfSamplesReturned' and as 'samples' are only taken from actual CAN frames/messages in time stamped mode, the value of 'NumberOfSamplesReturned' matches the number of messages for that particular ID. Please note, that the channels in 'ChannelList' must be contained in a single message, thus you need to initialize a task for each ID you want to monitor.

-B2k

Message Edited by biker2000 on 08-31-2005 07:43 PM

0 Kudos
Message 3 of 5
(4,026 Views)
We actually study the Channel Monitor.vi example from the labVIEW (Hardware Input and Output » CAN » Channel API » Advanced » Channel Monitor.vi) and  try to undertand how the  "Num Rx" variable gets its value from the subVIs. Can anybody explain how?
If there are no way we can monitor number of messages received using channel API, is there any indicator to know if we get a valid (most updated) message on the bus?
Thank you
 
0 Kudos
Message 4 of 5
(4,013 Views)
Hi Bus Monitor,

Taking a look at the block diagram for the Channel Monitor, I've found that the number of samples returned are produced by the "CAN Read.vi" inside the for loop that runs 1000 times (see screen shot below).

Regards,
Matt S.



LabVIEW Integration Engineer with experience in LabVIEW Real-Time, LabVIEW FPGA, DAQ, Machine Vision, as well as C/C++. CLAD, working on CLD and CLA.
Message 5 of 5
(3,985 Views)