04-24-2013 06:45 PM
Ok. I'll give that a try but I guess I was hoping someone could explain how a frame as displayed on say the CAN basic example can be understood in terms of the example.ncd database file. ?how would I structure a frame to match up with the message on the database?
In my understanding a database file tells labview what the messages look like so that when a message matching one of the channels is sent, it will know it was that specific message. Or am I confusing terms? Is a frame just a bunch of channels? Sorry for my low level of CAN knowledge.
04-25-2013 04:36 PM
A CAN frame is the useful portions of a raw CAN packet. There are several fields in a CAN packet that you don't need to worry about - they're computed automatically and used for signaling or verifying data integrity. The parts you do care about are the arbitration ID (11 or 29 bits) and the data itself (up to 8 bytes), and occasionally a few other fields. The CAN database simply defines the data that arrives with a specific arbitration ID. For example, you might have a channel that corresponds to the 2nd and 3rd bytes of a packet arriving with an arbitration ID of 17. It is relatively easy to generate packets that match the database format. You can also use the Frame Channel Conversion library. I don't think you even need a CAN device to play with this, but I haven't used it much. If I'm not mistaken, you can feed data into channels and see how they're converted to frames, and vice versa without sending any packets at all.
04-25-2013 04:47 PM
Would I be able to send packets without a CAN device? Like say having code that generates some randomized packets in accordance to the database? Or would that be something that can be done with the data being fed into the channels?
Thank you for the help so far. You have definitely helped me understand CAN signals a little more.
04-25-2013 05:51 PM
@SRamirez wrote:
Would I be able to send packets without a CAN device? Like say having code that generates some randomized packets in accordance to the database? Or would that be something that can be done with the data being fed into the channels?
I have no idea what you're asking here. You definitely cannot send anything over a CAN network without a CAN device. However, you can read data formatted as CAN packets from some source other than an actual CAN interface (for example a file, or a program that generates CAN frames). What are you trying to do? You could feed channel data into the Frame Channel Conversion Library and get back CAN frames, or vice versa, but I'm not sure if that helps you.
I haven't looked at the actual code for this, but a search on the NI site turned up the the Advanced CAN Frame to Channel Conversion Reference Example; the description says it's a CAN data logger designed to work with the 9853.
04-29-2013 09:50 AM
nathand,
Thank you for all the help. I am currently trying to read in a CAN log file I created from channels I created in NI MAX. For some reason I am getting error 7 at the open file terminal saying it can't find the file. I know the path is good. I don't know what it causing it. Any experience with this?
04-29-2013 09:57 AM
04-29-2013 10:09 AM
I have the file on the c drive so its simply c:\logfile.ncl. I have verified that it is there. In the different vi I am opening a .ncd file in the same location and it doesn't seem to have a problem with it.
04-29-2013 11:06 AM
I moved it to the cRIO and it worked. I keep forgetting that the cRIO acts like a computer itself. Thank you for the help.