07-28-2009 07:44 PM
So I currently have a program that reads at 1000 samples per second. The program attached works to read two signals: one for blood pressure and one for blood flow. It reads 1000 samples, takes an average of each and stores it into an array to eventually be written to an excel file. This seems to work fine and a proper conversion of voltage to meaningful values has been established.
I am, however, having problems getting a heart rate. We are experimenting with rats and mice and the heart rate should never be below about 400 bpm. This means that there should be at least 6 peaks in any 1000 samples The while loop at the bottom right of the block diagram is where I have attempted to do this. I figured that I would set it up so that a "False" boolean constant is passed until it drops below [max - ((max-min)*50%)] at which point it is set to "True". Then, if the boolean is "True" and the value is above [max-((max-min)*20%)], the threshold, a counter is incremented by 1 and the boolean is set back to "False".
Thus, basically, if it's above 80% and it hasn't already been incremented, it will increase by 1. And it isn't reset until it drops below 75%.
I tried it with both an animal and now a function generator, and am unable to get good results. It seems like it isn't responding to the frequency of the function generator at all...Could somebody recommend a better way or find the error? Thanks very much for any assistance.
07-28-2009 07:45 PM
07-28-2009 07:47 PM
Also, the lower threshold is [max-((max-min)*50%)]
Sorry
07-29-2009 10:54 AM - edited 07-29-2009 10:56 AM
Hello PieterKreuk,
Thank you for using NI forums. What device are you using and what pins on the device are your inputs? The bottom (nested) while loop seems alright, but I'm not really certain what's going on with the rest of the code. Have you used probes on your lines to see what values you're getting, because the equations you have set look exactly like how you explained. Also, you can try implementing the nested while loop on a smaller scale just to verify that portion of your code works.
Regards,