include/pic24_delay.h File Reference

#include "pic24_util.h"
#include <libpic30.h>

Go to the source code of this file.

Defines

#define DEBOUNCE_DLY   15
#define CYCLES_PER_MS   ((uint32)(FCY * 0.001))
#define CYCLES_PER_US   ((uint32)(FCY * 0.000001))
#define DELAY_MS(ms)   delayAndUpdateHeartbeatCount(CYCLES_PER_MS * ((uint32) ms));
#define DELAY_US(us)   delayAndUpdateHeartbeatCount(CYCLES_PER_US * ((uint32) us));

Functions

static void delayAndUpdateHeartbeatCount (uint32 u32_cyc)


Detailed Description

To do.

Definition in file pic24_delay.h.


Define Documentation

#define CYCLES_PER_MS   ((uint32)(FCY * 0.001))

A constant which gives the number of processor clock cycles in 1 millisecond. This value is cast to a uint32.

Definition at line 51 of file pic24_delay.h.

#define CYCLES_PER_US   ((uint32)(FCY * 0.000001))

A constant which gives the number of processor clock cycles in 1 microsecond. This value is cast to a uint32.

Definition at line 57 of file pic24_delay.h.

#define DEBOUNCE_DLY   15

Define a debounce delay for use in reading pushbutton switches. The value is specified in milliseconds.

Definition at line 44 of file pic24_delay.h.

#define DELAY_MS ( ms   )     delayAndUpdateHeartbeatCount(CYCLES_PER_MS * ((uint32) ms));

A macro to delay the given number of milliseconds. The maximum delay is ~ 100+ seconds when FCY = 40 MHz, because the underlying function delayAndUpdateHeartbeatCount uses a uint32 value for the number of processor clocks to delay.

Parameters:
ms The number of milliseconds to delay.

Definition at line 86 of file pic24_delay.h.

#define DELAY_US ( us   )     delayAndUpdateHeartbeatCount(CYCLES_PER_US * ((uint32) us));

A macro to delay the given number of microseconds.

See also:
DELAY_MS for additional information.
Parameters:
us The number of microseconds to delay.

Definition at line 92 of file pic24_delay.h.


Function Documentation

static void delayAndUpdateHeartbeatCount ( uint32  u32_cyc  )  [inline, static]

Delay the given number of processor clock cycles, then notify the heartbeat that time passed. Scale the time added to the heartbeat because we are not incurring the same overhead as if we repeatedly called doHeartbeat().

Parameters:
u32_cyc Number of processor clock cycles to delay.

Definition at line 71 of file pic24_delay.h.


Generated on Sun Mar 15 11:14:22 2009 for PIC24 Support Libraries by  doxygen 1.5.8