|
Re: Recording times from a timer
I'm not too familiar with LabView, so I can't help you with the technical details. However, I do see a potential problem. If (and I may not be thinking correctly here) your program sits there and continues reading the sensor, you could simply count cycles until state change. Problem is, you take up the processor doing this. The way I think you should approach this problem (and it may be beyond your capability) is to use a hardware interrupt to handle the timing. The idea is that every time the sensor causes a hardware interrupt, the interrupt handler stores the time at which the interrupt occurred in a variable and stores the difference between that interrupt and the interrupt before that. So have two vars (prevTime and interval). Every interrupt takes current time, subtracts prevTime from that and sticks that in interval, then sticks the current time in prevTime.
What this does is frees up the board to do other stuff while waiting for reads, instead of sitting there waiting for state changes. Hope this helped.
|