09-27-2013 02:03 AM
Just starting labview, so fixing this will probably teach me a lot. Searched and saw lots of posts about things only working in highlight execution mode, but nothing like this. I attached the relevant realtime and FPGA VI's.
The code is supposed to read a motor encoder. When ran regularly, it works very strangely. It will update the counter sporadically every few seconds for only a fraction of a second. When ran in highlight execution mode, it doesn't really appear to update. After highlight execution mode is cancelled, it works perfectly. Can anyone figure out what could be the problem?
Solved! Go to Solution.
09-27-2013 02:14 AM
Hi,
Is is possible for you to re-write to code in an earlier version of LabVIEW, say 2012.
this will then allow me to open your code and suggest a solution.
Thanks
09-27-2013 02:20 AM
I copied the code over and saved it in Labview 2012. Not sure if there are any fundamental differences between versions' code, but I hope that works!
09-27-2013 02:32 AM
Erm, the one VI runs on a Realtime target like cRIO?
And you look on the display of your Windows host machine?
As you only read 2 bytes per iteration from the DMA, i guess that your RT hogs your CPU hard so updates are not sent to your host anymore.
Therefore i recommend you to learn about proper RT/Host communication architectures. Also you should check if your DMA is possibly overflowing.
Norbert
09-27-2013 02:37 AM - edited 09-27-2013 02:57 AM
Right, it's running on a cRIO-9012, and I am watching the results in Windows.
The FIFO overflows when I go into highlight execution mode, but quickly empties when I exit.
So the problem is I only read two bytes at a time? Could you conjecture why it would work fine after starting and stopping highlight execution mode?
09-30-2013 12:55 AM
Ended up fixing it myself. I'm pretty sure the problem was that if there is only one element in the FIFO when it first checks, it discards both elements when the FIFO filled up.
Fixed it by adding a test for the number of elements before and only reading if there were sufficient elements to read. Attached the fixed file for reference.
I still have no idea why it ran after highlight execution mode in the first place. We may never know. Bonus points for the answer =P