Shop OBEX P1 Docs P2 Docs Learn Events
unexpected counter behavior — Parallax Forums

unexpected counter behavior

agfaagfa Posts: 295
edited 2009-05-10 03:12 in Propeller 1
I set up 4 counters.· 2 counters in the first cog set to count positive edges and two counters in the 2nd cog to generate a signal to count.· I expected the counters to count at the same rate, but the values drift apart.

Could someone take a look and explain why?

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2009-05-10 03:05
    agfa said...
    Could someone take a look and explain why?
    FRQA is fed with m0, FRQB with m1. However, m1 is simply m0 + 4. What you actually want is something like:

    loc1    rdlong  frqa, m0               ' read latest frequency setpoint
            rdlong  frqb, m1
    


    Basically you're using the parameter addresses for the increment value instead of the values stored therein.
  • agfaagfa Posts: 295
    edited 2009-05-10 03:12
    Thanks.· That fixed it.
Sign In or Register to comment.