06-09-2015 01:18 PM
Hi all,
I want to read a bunch of sensors. I am using a rotary encoder as the counter input. What I want to do is for every time the rotary encoder increments by +1 degree, I would like to pull all measurements from the sensors attached. For every degree I want only ONE measurement, which I will then store in an array.
My issue is how do I actually go about taking a measurement only ONCE when the counter increments and then waits until the next increment occurs to take another measurement.
06-09-2015 03:16 PM
Use a shift register to detect when the encoder changes. You con use the divide with remainder or convert the degrees to an integer. When the current value is not equal that creates your condition to save the samples.
06-09-2015 03:40 PM
the encoder outputs a pulse which increments the DAQMx counter input. I have so it is already in integer format. The count would go up to 360 (+1 integer count for every degree turn, 360 degrees in a rotation).
What I am having issues with is as follows:
while count is, for example, at "5", then it should take only one reading ONCE from the other sensors. Then when the count reaches "6" it should take another reading, again only ONCE.
I am using sample on demand as my "clock" for this system would be the rotary encoder so that if it spins at a varying RPM, the results do not depend on an internal sample clock
06-09-2015 03:48 PM
So where is your code? It is hard to "see the problem" if we can't "see the problem" ... We could guess, I suppose (try moving the 4th wire from the left ...)
Bob Schor
06-09-2015 04:12 PM
I will post it in a few days, currently on another PC.
It is essentially a physical input that the counter block reads that is in a while(true) loop that runs forever.
I want to figure out how to take a reading when the counter increments.
While counting I would like to ouput some logic '1' or '0' value that detects that the counter has incremented so that it can activate a case statement.
06-09-2015 04:17 PM
Can you trigger your DAQ device from the encoder signal? Or use the encoder signal as an external acquisition clock? Some DAQ devices have capability to use external signals for clocks or triggers.
Lynn
06-09-2015 07:09 PM