LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift register value always same as previous value

Solved!
Go to solution

Hi all. I've been banging my head against the wall for a while on this and hoping someone can help me.

 

I'm using a USB-6008 daq device to read a rotary encoder. I pulled the basics of the attached VI from the forums, but I modified it to work with an encoder with an index. All I'm trying to do is reset the "degrees' value to zero whenever the counter value (encoder index) increases by one. I figured I was good using the shift register since it should hold the value from the previous iteration (right before the index passed). The problem I'm having is that the two values going into the "Less than" function always seem to be the same, so my "degrees" value never resets. What am I missing???

 

Thanks!

 

PS - I need to use the counter (instead of just another digital line) because it is critical that the index value is never missed. And I know using a software based counter like this tends to miss a digital input signal here and there.

0 Kudos
Message 1 of 3
(2,322 Views)
Solution
Accepted by topic author nckeeley

Suppose your encoder is turning at 1 rpm = 1 index pulse per second. You are spinning your loop at 1000 times per second. It is not clear that the 6008 can read both the DI line and the counter that fast. The software timed AO update rate is 150 Hz, maximum. If it does read that fast, you get 999 readings of 0 and one reading of 1. For 1 millisecond the Degrees indicator will show 0.  On the next iteration of the loop the < comparison will be true again and the shift register value will be displayed again.  What you need to do is to reset the value going into the Count Register to zero, not the display.  One simple wiring change should fix it.

 

Reset Count Register.png

 

Lynn

Message 2 of 3
(2,311 Views)

Thanks!

0 Kudos
Message 3 of 3
(2,285 Views)