09-22-2016 03:44 PM - edited 09-22-2016 03:47 PM
Hi all,
I had this strange behaviour of Wait VI and I really wonder why I'm facing this.
I use three frames in FPGA. Code in second frame causes a delay (which is simulated in attached VI). I'm able to calculate the difference between first and second frame by using Tick Count VIs. Then calculated delay is subtracted from a control called "Desired Loop Rate" at third frame where that strange behaviour appears. (The idea is to subtract the delay from desired rate. By this way, desired rate is always compansated.) Result of that subtraction is connected to Wait VI. After compilation and run, VI freezes. I guess VI runs only once and it hangs. If I disconnect that output of the subtract operation and connect a control or a constant, everything is normal. Correct delay can be seen from "Delay caused by second frame" indicator. But when I connect the output of subraction it hangs.
By the way, I created the same VI for Windows and it works exactly the way I expected. Am I missing something about the usage of Wait VI in FPGA? (I tried in sbRIO-9636 and cRIO-9030 and there is no difference.)
Thanks in advance,
Best regards,
Emre
09-22-2016 04:02 PM
09-22-2016 04:17 PM - edited 09-22-2016 04:18 PM
Actually, it is not equal to zero. I forgot to change because I prepared this VI for posting. Default value for "# of iterations" is 10 and "Desired Loop Rate" is 40000 ticks. I initialize both of them in host VI.
Thanks,
Emre
09-22-2016 04:31 PM - edited 09-22-2016 04:31 PM
Desired Loop rate (40,000)-(no.of iterations(10)*Simulation time(12,500)) gives me negative value!!!
-Did i miss anything?
09-22-2016 04:39 PM
Normally, I have a delay which is around 1000 and 2500 ticks in that loop. I tried the 1 iteration and 10000 tick as default after your message it still hangs. Do you think that loop hangs because there is a probability for output of subtraction to be negative? If so, this may explain why it works in Windows and not in FPGA.
Thanks,
Emre
09-22-2016 04:41 PM
By the way it can't be negative because it is U32. 🙂
09-22-2016 05:06 PM
09-22-2016 05:15 PM
Thanks udka, I'll read that post.
When I say it hangs, I mean loop is not running. I created an indicator to look at the loop iteration whether it is changing or not. It remains 0 although loop seems to be running.
Thanks,
Emre
09-22-2016 05:21 PM
09-22-2016 05:27 PM
I already did what you're suggesting but there is a huge number (I guess it is max. of U32 can get) and it does not change later.
I guess I have to think more about the part you pointed. There may be a problem during compilation, not a fatal error, just a logic error about the rollover situation.
Thanks,
Emre