MikeEbb Posted December 19, 2008 Report Posted December 19, 2008 First post, here she goes... Using LabVIEW 8.2.1, I built an application using the CAN Channel API, which works well. A colleague has recently asked me to log the raw CAN traffic on the bus for him at the same time as my program is running. I looked into using the channel API, and as I understand it, the Channel API looks for specific CAN messages and decodes them, making the channel API unsuitable for this task. I found an example in the labview examples that uses the Frame API, "CAN receive error frames.vi" which did the trick, but the Channel and Frame APIs can't be used at the same time. Looking at the documentation, From the NI-CAN manual: For example, if you have one application that uses the Channel API and another application that uses the Frame API, you cannot use CAN0 with both at the same time. As an alternative, you can connect CAN0 and CAN1 to the same network, then use CAN0 with one application and CAN1 with the other, if you have a 2-port CAN card. As another alternative, you can use CAN0 in both applications, but run each application at a different time (not simultaneously). So as I understand it, my options are either: Drop $1800 on an additional CAN card, or Rewrite my application using the frame API. Does anyone have any ideas how to work around this problem? Thanks in advance. Mike Quote
ned Posted December 19, 2008 Report Posted December 19, 2008 NI-CAN offers two "virtual" ports, CAN256 and CAN257, which are internally linked to each other (anything sent over one is received on the other). You can configure one of those ports with frames and the other with channels. Change your existing configuration to receive frames and log them to disk. Whenever you receive a frame, re-send it over one of the virtual port. Use the other virtual channel, configured in channel mode, to read your data just like you do already. This allows you to add an intermediate layer for logging raw CAN data with only minor changes to your existing code. If that isn't enough of an explanation let me know and I'll try to make it clearer. I've used the virtual ports for a similar task - converting between NI-CAN and another CAN vendor's interface. By receiving the raw data on the other vendor's CAN interface and relaying it through the virtual ports I was able to read channel data through NI-CAN even though I wasn't using an NI card. Alternatively you might look into the CAN Frame Conversion Library, although I don't see the code actually linked on that page, just documentation. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.