Shop OBEX P1 Docs P2 Docs Learn Events
Too long of a 'waitcnt' step is causing the counter module to sit idle — Parallax Forums

Too long of a 'waitcnt' step is causing the counter module to sit idle

GenRevGenRev Posts: 9
edited 2010-02-26 19:32 in Propeller 1
Hello:

I placed a·'waitcnt' step between two·Repeat loops that utilize the counter module.· If the 'waitcnt' is too long (~ more than 20ms), the counter module in the following Repeat loop does not execute for about 53 seconds, but it does execute·the following·serial terminal 'debug' step.· This seems relelated to the system counter, but I'm not sure why the 'waitcnt' step is affecting the counter module.

Running the attached code with the serial terminal should illustrate the problem I'm having.

Thanks!

Mike

Comments

  • Dave HeinDave Hein Posts: 6,347
    edited 2010-02-26 18:58
    The problem is that "t" contains the cycle count from the first loop.· You should set t := cnt before entering the second loop.
  • GenRevGenRev Posts: 9
    edited 2010-02-26 19:32
    Many thanks!· I love the easy solutions.
Sign In or Register to comment.