02-09-2010 03:25 PM
I was playing around with the new NI XNET drivers to read CAN data and I need some expert advise on it. In Frame API, I remember being able to check if there is any data on the Read Queue before reading it, with Xnet I did not find such option. Xnet uses the Read function which will read the entire Queue regardless if data is present.
This is causing me a problem, because I am constantly calling the Read function in a loop, the data will be written to an array of frames, then the array will be empty at the next iteration because the read queue was empty at the second Read cycle.
How can I continuously read data from the Read queue without overwritting my output array ?
I tried the Enque/Deque method, but it didn't work well for me. Can someone please tell me what is the best practice for continuously reading CAN data and processing it using XNET drivers ?
Thanks,
Sam
Solved! Go to Solution.
02-10-2010 02:25 PM - edited 02-10-2010 02:26 PM
Sounds like you want to use shift registers with your arrays. Check out this subVI that is part of the NI-XNET shipping examples. You can find the examples from the Example Finder under Help>>Find Examples.
Aside from converting the frame into a string, the loop Appends the string to an array and uses shift registers to pass the array throughout the iterations of the loop.
Was this what you were looking for?
02-12-2010 07:20 AM
That is not what I was looking for exactly, but I figured I do not need to save my data as it comes in, because the Read VI gets all the data on the buffer.
Your example was also useful in processing the data.
Thanks,
Sam
06-27-2011 04:50 PM
I'm very new to Labview and I'm at my wits end with this program. I'm using Xnet and simply trying to read a file from the CAN database and have been completely unable to do it. The CAN is carrying thermocouple data and I need to pull it out of there so I can put it into Matlab and process it. It seems like it should be easy enough, but after three days I have nothing working. I've downloaded the example given earlier in this thread and have searched throughout the forum and looked through numerous other examples but still have nothing that interfaces properly. I know that the CAN is communicating with the computer and we are getting information from the thermocouple, but I just can't get that into Labview. Any help would be greatly appreciated.
06-27-2011 06:22 PM
Can you upload your VI, or provide more detail than "can't get that into LabVIEW"? Otherwise it will be almost impossible to help you. Also, you may want to start a new thread for your question. While it is often good etiquette to add to an existing discussion, this thread is a year old and was already marked solved, so many forum readers may skip over it.