Simpletools pause() function

I am starting to work with Propeller C and found that the pause() function can be tripped up with large values.

May I suggest it be recoded like this:
void pause(int time)                          // pause function definition
{ // If st_pauseTicks not initialized, set it up to 1 ms.
  // if(!st_pauseTicks) set_pause_dt(CLKFREQ/1000);
  
  long t0 = CNT;
  
  while (time--) {
    waitcnt(t0 += st_pauseTicks);
  }  
}
Jon McPhalen
Hollywood, CA
It's Jon or JonnyMac -- please do not call me Jonny.

Comments

  • Andy has been reasonably responsive to issues reported to GitHub, and even more responsive to pull requests. If you're not familiar (or simply don't have an account), I'd be happy to submit such a simple pull request on your behalf.

    https://github.com/parallaxinc/Simple-Libraries/issues
    David
    PropWare: C++ HAL (Hardware Abstraction Layer) for PropGCC; Robust build system using CMake; Integrated Simple Library, libpropeller, and libPropelleruino (Arduino port); Instructions for Eclipse and JetBrain's CLion; Example projects; Doxygen documentation
    CI Server: https://ci.zemon.name?guest=1
  • Thank you, David. The entire C ecosystem is new to me. I understand the language, but not how to deploy it (as easily as I can Spin) on the Propeller. I'm wanting to find out if CMM gives me more speed with same code space use as Spin as has been reported. I just finished a big project that has 3K lines of libraries, and three program files: one with 3K lines, two with 1.5K lines each. If I can make it run faster I am willing to try.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • Sounds like a worthy goal for sure. Let me know if I can help! The simple libraries are meant to be simple though, not fast or efficient. Your own custom libraries, libpropeller, or PropWare will probably suit your professional needs more.
    David
    PropWare: C++ HAL (Hardware Abstraction Layer) for PropGCC; Robust build system using CMake; Integrated Simple Library, libpropeller, and libPropelleruino (Arduino port); Instructions for Eclipse and JetBrain's CLion; Example projects; Doxygen documentation
    CI Server: https://ci.zemon.name?guest=1
  • I have every intention of porting my personal libraries from Spin to C; it will aid the learning process and make converting apps a bit easier, too.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
  • Thanks Jon - nice find. Could you record the issue here please https://github.com/parallaxinc/SimpleIDE/issues?

    And slow down, as I'm still trying to understand the Real Time Clock app that you built in Blockly!

    Ken Gracey
  • Done.
    Jon McPhalen
    Hollywood, CA
    It's Jon or JonnyMac -- please do not call me Jonny.
Sign In or Register to comment.