JAL manual - library - interval

previous up next

This library does not yet support the Scenix SX18 and SX28 targets.

The interval library provides interval delay routines, based on tmr0 timer interrupts.

First the required interval T must be prepared by calling one of the init_interval procedures. The interval time T which is initialized is equal to the time indicated by the name of the procedure multiplied by the argument value.

Now an interval expires at each multiple of T after the init_interval call.

A call to next_interval will return at the next interval expiration. The first interval after the init_interval call can take slightly longer than T. When a call to next_interval occurs when the interval has already elapsed the call can take the time equivalent to an argument of 255 to the corresponding init_interval call.

The interval delay library uses an interrupt routine, the timer tmr0 and (for most intervals) the prescaler. The one-time overhead is 17 instructions, 5 file registers and 1 stack entry.

The clock frequency must be either 10MHz or 4MHz.

The following routines are provided:

   procedure init_interval_1uS( byte in n = 1 )
   procedure init_interval_2uS( byte in n = 1 )
   procedure init_interval_5uS( byte in n = 1 )
   procedure init_interval_10uS( byte in n = 1 )
   procedure init_interval_20uS( byte in n = 1 )
   procedure init_interval_50uS( byte in n = 1 )
   procedure init_interval_100uS( byte in n = 1 )
   procedure init_interval_200uS( byte in n = 1 )
   procedure init_interval_500uS( byte in n = 1 )
   procedure init_interval_1mS( byte in n = 1 )
   procedure init_interval_2mS( byte in n = 1 )
   procedure init_interval_5mS( byte in n = 1 )
   procedure init_interval_10mS( byte in n = 1 )
   procedure init_interval_20mS( byte in n = 1 )
   procedure init_interval_50mS( byte in n = 1 )
   procedure init_interval_100mS( byte in n = 1 )
   procedure init_interval_200mS( byte in n = 1 )
   procedure init_interval_500mS( byte in n = 1 )
   procedure init_interval_1S( byte in n = 1 )
   procedure next_interval

previous up next