[Solved] Wrong Part or Error in Spin?
Jorge P
Posts: 385
Hi all, I just received this rotary encoder that states it 600 pulses per rotation but after writing some spin to use "Quadrature Encoder.spin" from the Propeller tool library, I am getting 2,400 pulses per rotation. Am I doing something wrong or did I get a better part than what I ordered? I don't think "Quadrature Encoder.spin" is faulty or it would have been fixed years ago... I tested if it was just counting by four but I am able to increment/decrement by one and two if I am careful and go extremely slow.
Edit: Changed title to solved.
CON _clkmode = xtal1 + pll16x 'Standard clock mode * crystal frequency = 80 MHz _xinfreq = 5_000_000 VAR long pos[2] OBJ qe : "Quadrature Encoder" pst : "Parallax Serial Terminal" PUB Main pst.Start(115200) pst.clear qe.Start(0,1,1,@pos) repeat pst.Dec(pos) pst.Str(string(" --- ")) pst.Dec( qe.ReadDelta(0)) pst.Newline
Edit: Changed title to solved.
Comments
-Phil
Thanks for the information, I was suspecting that it was counting the edges of the pulses due to the fact that I could count by one with it.