LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI 9853 signal test

Hi,

 

I have a cRIO 9024 with an NI 9853 CAN module.  I am trying to make a simple VI that will read in a CAN signal and write to a TDMS file.  I am using the example.ncd file as a database of CAN channels.  Eventually I am going to be given a different database but the example.ncd file will do for now.  The CAN ports are not currently connected to a real device but rather I have them set up in a loop.  I have powered the second port and I know about the basic CAN example vi.  What I am trying to understand is how I can log any data that makes any sense without a source.  I think maybe a simple counter for every time a signal is read in will suffice for now but how do I know a signal is even read in.  I apologize if my question is unclear.  I'm a bit confused and new to CAN signals.  Thank you.

0 Kudos
Message 1 of 6
(2,655 Views)

Hi SRamirez,

 

It sounds like what you are hoping to do is a CAN Loopback test.  For the 9853, you can connect a CAN cable to transmit data from one of your CAN ports and receives it directly in the other port.  Then, in LabVIEW you can run the CAN Basic.lvproj example to transmit the frame and receive it on the other.

 

The data you receive and log may not "make sense" in the traditional sense, it will just be the same frame that you transmit.  If you are not receiving any data at all when you run this example, then there is some troubleshooting you might need to go through.  In the CAN Basic (FPGA).vi, which is a part of the example project I refer to above, you would know whether you were receiving data or not by seeing the "Total Received" indicator increasing, as well as the Recent Receive indicators updating to reflect the most recent message transmitted.

Andrew T.
National Instruments
0 Kudos
Message 2 of 6
(2,630 Views)

Andrew,

 

I am awarde of the example you mentioned.  What I am attempting to understand is how I can even transmit a frame without any source of it.  Where does the frame come from?  Thank you.

0 Kudos
Message 3 of 6
(2,627 Views)

Hi SRamirez,

 

In the case of this example, your FPGA will actually be generating the frame, so the cRIO is really the "source" of the frame.  You specify what Arbitration ID, data bits, etc (in other words, all of the individual components that make up a frame) you want to send, and LabVIEW packages it into a CAN frame (organizing the data into the correct format, generating the checksum, etc.) and transmits it to the bus.  This is the same type of operation that an actual "source" like a car component would go through to create and send a frame, its just that with LabVIEW and the FPGA we have much more freedom in what we want our frames to look like.  

 

Please let me know if I am not understanding your question correctly, but hopefully this helps clarify things a little bit.

Andrew T.
National Instruments
0 Kudos
Message 4 of 6
(2,615 Views)

thibber,

 

Thank you for explaining that.  I didn't know that the cRIO is the source of the frame.  I guess I was hoping to create a VI that would take a signal sent from an actual source without me having that source at the moment.  As I mentioned (I think) I won't be having the actual source and signals for some time but I wanted to have the VI ready.  Correct me if I'm wrong, but are CAN signals, messages, and frames the same thing?  Also, does a CAN signal/message/frame consist of multiple channels in which the data is transfered?  From my understanding CAN messages can be sent simultaneously but only one can be recieved at a time, right?.  So then if say I have two messages/frames with two channels each would I be able to make something that would send these at the same time and, based on the arbitration ID, determine which to take?

 

The vi I currenlty have seems to log data but It doesn't make any sense to me.  I guess what I want is something that generates multiple frames according to a set CAN database, sends it through one port and listens to the other one on the NI 9853 and logs the data.  And I want the generation of the frames to be autonomous such that it simulates an actual source that would be continuously sending and recieving CAN signals.  Is that at all possible or am I asking for too much.  This application will eventually be deployed on a vehicle and also be used in a hardware in the loop system.  I hope that makes sense.

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

Hi SRamirez,

 

You can certainly have a VI which receives the same type of messages that would be sent by your source.  In order to get the VI ready, you would need the database file that contains the information on the types of frames, signals, etc that your source will eventually be sending.  From there, you can create a VI that is configured properly to receive those signals (the CAN Signals Receive.lvproj example from the NI Example Finder should be sufficient).  In order to test it in the meantime, before your actual "source" is available, you will need to simulate the source by implementing one on your cRIO, which is similar to what you have set up now.

 

The terminology can be a bit confusing sometimes, but CAN Frames consist of a single arbitration ID.  A Frame can contain many different signals, depending on how your database is set up.  Sometimes these signals are differentiated by a Multiplexor bit.  Messages, from what I can tell, are the same as frames, but the word seems to be used loosely.

 

I think that this document will helpful in getting started with the 9853 and CAN communications on your cRIO:

 

http://www.ni.com/white-paper/6628/en

 

The document explains the difference between frames and channels, how to set up a simple application, and the related links at the bottom go into further details on specifics.

 

Andrew T.
National Instruments
0 Kudos
Message 6 of 6
(2,592 Views)