Shop OBEX P1 Docs P2 Docs Learn Events
[Solved] Wrong Part or Error in Spin? — Parallax Forums

[Solved] Wrong Part or Error in Spin?

Jorge PJorge P Posts: 385
edited 2018-03-31 11:33 in Propeller 1
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.

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

  • No, it's not an error. A quadrature encoder with 600 pulses per revolution will resolve to 2400 pulse edges per revolution. Your program is counting each one. That's a huge plus!

    -Phil
  • No, it's not an error. A quadrature encoder with 600 pulses per revolution will resolve to 2400 pulse edges per revolution. Your program is counting each one. That's a huge plus!

    -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.

Sign In or Register to comment.