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

Provides simple software delays. They are not cycle-accurate, however. These routines are integrated with a heartbeat LED, so the heartbeat count is updated during a delay.

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 52 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 58 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 45 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 88 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 94 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 72 of file pic24_delay.h.


Generated on Mon Oct 18 07:40:48 2010 for Python-on-a-chip by  doxygen 1.5.9