May 18, 2024, 05:10:54 AM

News:

You can now use Vixen to program your Prop-1 and Prop-2 controllers!  Get started quickly and easily, without having to learn PBASIC.  Details in the Library forum.


Long Delays

Started by JonnyMac, April 07, 2012, 08:47:23 AM

Previous topic - Next topic

JonnyMac

In the Prop-1, Prop-2, and Prop-SX we're used to have delays of up to 65.535 seconds using the PAUSE instruction.  This limit is due to 16-bit values in those controllers.  The Propeller uses 32-bit values, but in truth, Spin treats these values as 31-bit signed numbers.  What this means is that a long (native type) variable can hold a value of -2,147,483,648 to +2,147,483,647.  Yes, you read that correctly... negative 2.1 billion (with a B) to positive 2.1 billion.

So... how long can we delay with this?  If we use the pause() method in the template that works out to....

  2,147,483.6 seconds

...which is the same as:

  35,791.4 minutes

...which is the same as:

  596.5 hours

...which is the same as:

  24.85 days.

Yeah, I think we can handle any kind of long delay we might need.  Just remember that pause() stops the program in its tracks for the duration specified. 

 
Jon McPhalen
EFX-TEK Hollywood Office

JackMan

Wow, excellent example of the horsepower this baby's got.  8)

bsnut

April 09, 2012, 01:47:30 AM #2 Last Edit: April 24, 2012, 01:10:23 AM by bsnut
I love your  example too Jon, it really shows the extra 16 bits of horsepower that the Propeller (the brain) of the HC-8+ has over the Basic Stamp. 8)   
William Stefan
The Basic Stamp Nut