05-21-2012 10:43 AM
Hello,
in a pretty complex VI, I want to generate a continuous pulse train in order to drive a stepper motor.
Next, I want to stop the pulse train when the stepper motor reached a certain position. Therefore, I want to measure the position of the stepper motor using an angular encounter.
To minimize the probability of software errors, I used the example for angular position measurements to post it here, as I have the same problem as in my program:
When I run the pulse train very slowly (around 1 Hz), the "data-indicator" alternates between 0 and 0.75 each step: 0 0.75 0 0.75 0 ...
From my understanding, I should be getting an increasing number, as the angular position increases with every step by (in my case) 15 degr.
I cannot really understand the alternation.
Thanks for any help.
05-21-2012 11:42 AM
Let's ignore the pulse train for a moment. Can you connect the encoder on its own and test it out, rotating the shaft by hand? When you do this, does it read properly?
05-22-2012 05:15 AM
Thanks for the answer.
Now I just used the "measure angular position" example, and turned the motor by hand.
Here the results for the different decoding types:
X1: nothing (stays at 0)
X2: nothing (stays at 0)
X4: the result described before: alternating between 0 and 0.75
2 pulse counting: the values decrease continuously... So I get negative values for both directions! One full rotation gives me something like -6xx in either direction.
Really confusing. I wired channel A and B to PFI0 and PFI1 on my USB 6211.
Thankful for any hints.
05-22-2012 10:26 AM
I tried the same thing with the MAX. Creating the task, running the test. Same results.
I don't understand where my mistake might be. I turn the motor by hand, I checked the wiring.
05-22-2012 10:29 AM
If you have not already read "Encoder Measurements: How-To Guide" you may find it helpful as a starting point. Sounds to me like a wiring problem, or possibly a bad encoder. I assume you are not using the Z index, and that in addition to the A and B channels you've connect a ground reference. I would check the A and B channels independently. You could do this by setting up a simple DAQmx counter task for each channel and see if it counts up as you rotate the shaft. You might also catch the pulses with an oscilloscope, or with a multimeter if you rotate the shaft slowly.
05-22-2012 10:43 AM
Thanks,
I tried the independant counting before:
Using channel B - I can count probably,
however, channel A does not work.
From my understanding it sould do the same just 90 degr out of phase as opposed to channel B (?). If that is correct, I think a faulty encounter is the only way I can explain the issue...