02-04-2025 07:57 AM
Hello,
I have written a simple FPGA VI to write and read cRIO data. Right now, I have a while loop with a loop timer to control the sampling rate of the data. In many FPGA examples, I have seen people use flat sequence structures inside of while loops to perform data collection. What is the main difference between that and what I am doing? I am processing the data at around 1000 hz, so it is quite easy for the FPGA given its high speed. Also, within this code I would like to process the data before sending it to the FIFO and RT VI. All the calculations done are in the RT VI shown in the picture. Again, would the flat sequence structure be more beneficial or should I stay with the while loop? Pictures provided below.
02-04-2025 08:14 AM - edited 02-04-2025 08:19 AM
Hi tpendleton,
@tpendleton18 wrote:
Right now, I have a while loop with a loop timer to control the sampling rate of the data. In many FPGA examples, I have seen people use flat sequence structures inside of while loops to perform data collection. What is the main difference between that and what I am doing?
The difference is: others use a flat sequence, you don't use them…
Flat sequences are recommended to ensure proper timing: have the wait in the first frame, then the IO nodes in the second frame. Doing such stuff in parallel in your FPGA fabric might be less "strictly defined"…
02-04-2025 08:35 AM
So the answer to my question is it doesn't matter? You provided multiple answers to questions I didn't ask. Please keep on topic instead of changing subjects. Also you talk about not running loops in parallel as to keep my VI "strictly defined" then contradict yourself by saying I should run parallel loops for input and output.
02-04-2025 08:42 AM
Hi tpendleton,
@tpendleton18 wrote:
So the answer to my question is it doesn't matter?
No, I didn't say so.
I gave a recommendation and an explanation for that recommendation...
@tpendleton18 wrote:
You provided multiple answers to questions I didn't ask. Please keep on topic instead of changing subjects.
I give comments on your code, expressed as question because you should have a reason to implement your code as it is. Take those comments or don't...
@tpendleton18 wrote:
Also you talk about not running loops in parallel as to keep my VI "strictly defined" then contradict yourself by saying I should run parallel loops for input and output.
Where did I wrote about "not running loops in parallel"?
Right now the AI and AO in your FPGA loop run without any defined execution order (because of THINK DATAFLOW): separating them into two loops will not make any difference in this aspect. IMHO it gives cleaner code when you run multiple loops on your FPGA, one loop for one task...
02-04-2025 10:27 AM
Sequence structures are to force an order of things. You can force an order with wires. Some people like sequence structures from a visual standpoint.