11-05-2015 01:33 PM
I work for a company that manufactures and remanufactures Automotive electrical parts. We are attempting to get in the remanufacturing of ECUs, VECUs, Instrument clusters etc. I am in the process of learning how to use LabVIEW to write commands and read data over the CAN bus. I have downloaded the NI-CAN driver. I am currently "playing " with the Transmit Receive same Port.VI in the Frame API Basic folder of the NI example finder. I am not able to send the number in the Data to write array and have it be read by the ncReadNet Mult .vi. When I set the parameter to "Read Entries Pending" the ncGetAttr.vi returns a 0 indicating that there are no frames to be read. As a result, the ncReadNet Mult.vi does not execute.
I don't have any hardware connected, I am using the virtual CAN channel CAN256. Is this the reason I cannot get any data frames into my queue for the ncReadNet Mult.vi to read?
When using the NI-CAN example Transmit Receive same Port; can a Virtual CAN channel (Can's or 257) be used?
Solved! Go to Solution.
11-05-2015 02:08 PM
CAN port 256 and 257 are connected to eachother through software. When you write on 256, you can then read that data on 257, and vise versa. I think the example you mention is a write and read on the same port, but what you want is to probably to make a copy of that VI, so you can run two at once, where one opens 256 and the other opens 257. Then when you write one you'll see it on the other. I think you might be able to use the CAN test panel too to read from one and use the example on the other.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-05-2015 04:56 PM
Thanks, I can transmit from CAN256 to CAN257. Do CAN devices have only one channel? If I were to write commands to a CAN device and then read the resulting data would I use the same CAN channel for TX and RX or would I use channel A for TX and Channel B for RX?
11-05-2015 05:04 PM
Now that I think about it, the computer would be Channel A and the device under test would be Channel B.
11-06-2015 05:54 AM
When you get our real hardware you will have one CAN channel to communicate over.
Now normally, when you wirte a CAN message on a CAN bus, you will not be able to see that message in the receive buffer of the same CAN hardware.
But you can setup a NI-CAN device to transfer any message that you send to the receive buffer also, if you want to read it back. This feature is called echo.
But for the virtual CAN channels, this feature might not be avaible.
You can use the virtual channels to test you application, by simulating your device on one channel and having your application use the other channel. That require you to write a small application that reacts like your real device, but then you can test your application without any hardware.
11-06-2015 01:08 PM
OK, if I'm using a device like an NI 9862, which only has one CAN channel, to send commands from the computer to a device under test and then read the data that results from the command being executed; can I assume that the NI CAN device is one CAN node and the device under test is another CAN node? Does each node require it's own CAN channel, or can one node send and receive messages to/from another node over the same channel?
Based on what I'm reading above and my own experimenting with the virtual channels, the answer is no. If this is the case, do I need a CAN module with >1 channel?
11-06-2015 01:18 PM