LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulating a CAN (Controller Area Network) network in LabVIEW

Hello. I'm thinking about simulating a CAN network in LV as a school project but I'm not exactly sure where to begin or how to do it. I would really appreciate if someone could point me to some articles/resources to help me. Don't get me wrong, I'm not looking for the code or anything, just trying to gather some information on how I could do it.

I have some experience using LV and I have used CAN at my work to communicate between a micro and PC but this project is for a Digital Communication class and I have to simulate the actual network and how the information is send from one device to another using the CAN protocol.

Thank You.

0 Kudos
Message 1 of 5
(6,434 Views)

What exactly are you trying to simulate? Is this just bits on the screen, or you'll actually have a connection between the computer and a device? It's not clear what you're hoping to accomplish. With more detail we can probably provide more help.

0 Kudos
Message 2 of 5
(6,412 Views)

Do you have the CAN drivers?  If so, check out the examples in LabVIEW's example finder  (Help...Find Examples...Hardware...CAN).

 

If you want to simulate an entirely virtual loopback system, you can use CAN256 and CAN257.  Those are 2 virtual CAN buses that are looped back to each other.  You don't need any actual CAN hardware.  It's pretty cool.  🙂

 

So if you wanted to simulate a CAN system, you would write a total of two VIs: one that accesses the CAN256 resource and another that accesses the CAN257 resource.  You could have one as a transmitter and one as a receiver, or you could have them both transmit and receive.  Look at the examples that install when you install the CAN drivers...specifically at "CAN Transmit Receive same port.vi".  It's a single VI, but it'll show you how you could write a VI that both transmits and receives.

 

You'll also find a "CAN Transmit" VI and a "CAN Receive" VI in the examples, that you can play with.

 

Hopefully that gets you started?

0 Kudos
Message 3 of 5
(6,402 Views)

@DianeS wrote:

Do you have the CAN drivers?  


By CAN Drivers I believe DianeS is refering to NI-CAN.  Note that there is a much improved CAN API for newer hardware known as NI-XNET, but it does not have the virtual CAN ports like NI-CAN does.  Not sure why that feature was dropped in the new API.

 

EDIT:  You may also find more help on the Automotive subforum.

 

http://forums.ni.com/t5/Automotive-and-Embedded-Networks/bd-p/30

0 Kudos
Message 4 of 5
(6,339 Views)

Sorry for the late reply. I actually didn't realize there was replies. I was looking to actually simulate a CAN network (not communicate with other devices). This project was going to be for a digital communication course but I have choosen to do a different project. I might still do this project for fun in the future.

 

What I was looking to do is simulate a CAN network where in LV there would be fields for input data and there would be a simulated CAN bus and the it would show the output data as well. Using the software you could see how the CAN bus works (the data that is sending to the bus and what not). Espically simulating all the different CAN layers and parameters that goes into actually communicating via CAN. I don't think I'm doing a good job of explaning it. But basically a software where it's a simulation of two devices talking using CAN.

 

I have used (still am actually) LabVIEW to create software to talk to different CAN devices. I didn't use NI hardware but used the Econtrols ECOM cable (it's much cheaper) to do that.

0 Kudos
Message 5 of 5
(6,327 Views)