02-06-2007 04:08 PM
02-08-2007 03:27 PM
02-08-2007 04:40 PM
I can understand Windows causing >20ms times, but when I do a trace from PCAN Explorer, I'm seeing times between transmissions of anywhere from 0.6ms to 47.6ms. Shouldn't LabVIEW make sure that the minimum time between execution is at least 20ms?
I also tried the same code set to 500ms, and a trace showed times of 497.4ms to 505.6ms.
Is it possible it is the way my code is written? One of the ways I tried it is attached...
02-13-2007 12:16 PM
02-13-2007 01:10 PM
02-13-2007 02:14 PM
02-13-2007 02:35 PM
02-13-2007 03:06 PM
Parkerfly,
You should be able to use a while loop with a "wait until next millisecond multiple" to get more accurate timing than you are seeing for a 20ms loop rate. I'm referring to a loop architecture without a sequence structure.
To debug the timing issues, I would suggest looking at one software component at a time. I see LabVIEW as one component and the PCAN drivers from KDI as the other. Ultimately the PCAN explorer will be the final timing test, but let's start out just looking at LabVIEW timing without the CAN calls.
I would suggest creating a LabVIEW app that simply has a while loop without the CAN VIs. You can create a loop time indicator by using a shift register and the Tick Count VI from the timing pallet. Wire 20 ms into the "wait until next millisecond multiple". Run the VI and notice that you only get a slight 1-2 ms jitter on the indicator. This jitter is due to Windows. Leave this loop time indicator in the code even after you add the CAN calls.
Now add the CAN VIs into the loop. What do you see on the loop time indicator? Hopefully the CAN VIs aren't taking more than 20ms to execute. They shouldn't unless there is some resource conflict occurring. Also use LabVIEW's profiling capabilities to see how long the CAN VIs are taking to execute. You can find this under "Tools >> Profile >> Performance and Memory". This will tell you how long it takes each VI in your loop to execute.
Check the timing on your PCAN Explorer. Is it consistent with the loop timing on the indicator. If no then there may be an issue with the rate at which the CAN VIs can be called. If yes then we have some more debugging to do. Let me know.
Thanks,
Todd Holthaus
From a debugging perspective, I would recommend looking at one component at a time to see what is causing the problem. Ultimately the PCAN Explorer is the