08-28-2012 08:15 AM
Hi,
I use a cRIO-9076 with a NI-9476 DO module to switch some valves. Sometimes it is necessary to pulse the valves with a pulse time down to a few ms.
The FPGA VI gets the valve on/off requests, runs some safety logic, and routes the results to the digital outputs. It gets the on/off requests from the VI on the RT target which uses the "Read/write FPGA control" function for programmatic front panel interaction of the FPGA VI. The loop on the RT runs with 1 kHz, no iterations are missed. It means, it should be possible to switch the valves with a resolution of 1 ms.
What I observe on a scope is that the digital outputs are high for multiples of 50 ms, the system fails to pulse the valve for e.g. 80 ms, or pulses shorter than 50 ms. Is there some sort of limitation for calls of "Read/write FPGA control"? I tried both arbitration options but it doesn't help.
Any ideas or better knowledge of the limitation of the cRIO/module/functions? Thank you in advance.
Karsten
Solved! Go to Solution.
08-28-2012 09:21 AM
Hi Karsten
Are you using any timing in your FPGA VI?
It is worth sending your code through as an attachment so that I can have a look at it.
Kind Regards
08-29-2012 03:15 AM
Marshall B,
Thanks a lot, mentioning timing in the FPGA VI was a very useful hint. Since I've always considered FPGA VIs as very fast, I couldn't imagine that this part would be the source of the odd behavior.
I don't use timing in the FPGA VI. To test how fast the FPGA VI runs I tried to negate a boolean in each iteration of the FPGA loop and to route it to one of the spare digital outputs. And, surprise, I got a nice square wave with a period of 102 ms (51 ms high, 51 ms low). Then I had a deeper look into the FPGA part and found that I read an analog input (high resolution mode) from a NI-9207 module in the same loop. A deeper look into the manual: Conversion time 52 ms 🙂
I wasn't aware of that the loop always waits for a new sample. I thought it would just use the most recent one.
So, thanks again. I guess moving the read function of the AI into another loop will solve my problem.
Karsten
08-29-2012 03:30 AM
Hi Karsten
It sounds like you are close to solving your issue.
Let me know how that works out for you or if you need any more help.
Kind Regards
08-29-2012 05:16 AM
Hi again,
The issue is solved. It works fine with two loops separating analog I/O from digital I/O. Thank you for putting me on the right track.
Best regards,
Karsten