PIC24 Support Libraries
pic24_libconfig.h File Reference
#include <xc.h>

Go to the source code of this file.

Macros

Supported hardware platforms

This library supports the following hardware platforms. More can easily be added.

Note: Do NOT #define MY_HARDWARE_PLATFORM (0). If the user then tries -D HARDWARE_PLATFORM=FOO, FOO will evaluate to 0, making it an accidentally default choice.

#define EXPLORER16_100P   (-1)
 
#define DANGEROUS_WEB   (1)
 
#define STARTER_BOARD_28P   (2)
 
#define DEFAULT_DESIGN   (3)
 
#define HARDMAPPED_UART   (4)
 
#define MICROSTICK2   (5)
 
#define EMBEDDED_C1   (472313)
 
#define EMBEDDED_F14   (472314)
 
#define HARDWARE_PLATFORM   DEFAULT_DESIGN
 
Defines configuring pic24_clockfreq.h
#define CLOCK_CONFIG   FRCPLL_FCY40MHz
 
Defines configuring pic24_delay.h
#define DEBOUNCE_DLY   (15)
 
outString() end-of-line behavior in pic24_serial.h
#define SERIAL_EOL_CR_LF   (0)
 
#define SERIAL_EOL_CR   (1)
 
#define SERIAL_EOL_LF   (2)
 
#define SERIAL_EOL_DEFAULT   SERIAL_EOL_LF
 
Defines from pic24_serial.h
#define DEFAULT_UART   (1)
 
#define DEFAULT_BAUDRATE   (230400)
 
#define DEFAULT_BRGH   (0)
 
Defines configuring pic24_util.h
#define USE_CLOCK_TIMEOUT   (1)
 
#define USE_HEARTBEAT   (1)
 
#define HB_LED   (_LATB15)
 
#define CONFIG_HB_LED()   CONFIG_RB15_AS_DIG_OUTPUT()
 

Detailed Description

This file consolidates all the user-configurable #defines scattered throughout the PIC24 support library. These may be changed by editing the #defines below, or by defining them via passing a -Dname=value flag to the compiler.

Definition in file pic24_libconfig.h.

Macro Definition Documentation

◆ CLOCK_CONFIG

#define CLOCK_CONFIG   FRCPLL_FCY40MHz

Clock configuration for the PIC24 - set CLOCK_CONFIG to one of the following. Naming convention is OSCTYPE_[PRIFREQ]_FCYFREQ where OSCTYPE gives the oscillator type (see FNOSC_SEL for details), the optional PRIFREQ specifies primary oscillator frequency, and FCYFREQ determiens the processor clock (FCY) frequency. The "#defines for CLOCK_CONFIG" section gives the definition of the values below.

Name uP
SIM_CLOCK (simulator) any
FRCPLL_FCY16MHz PIC24F, PIC24FK
FRC_FCY4MHz PIC24F, PIC24FK
PRI_NO_PLL_7372KHzCrystal PIC24F, PIC24FK, PIC24H, dsPIC33F
FRC_FCY3685KHz PIC24H, dsPIC33F, PIC24E, dsPIC33E
FRCPLL_FCY40MHz PIC24H, dsPIC33F
PRIPLL_7372KHzCrystal_40MHzFCY PIC24H, dsPIC33F
PRIPLL_8MHzCrystal_40MHzFCY PIC24H, dsPIC33F, PIC24E, dsPIC33E
PRIPLL_8MHzCrystal_16MHzFCY PIC24F, PIC24FK
PRI_8MHzCrystal_4MHzFCY PIC24F, PIC24FK, PIC24H, dsPIC33F
FRCPLL_FCY60MHz PIC24E, dsPIC33E
FRCPLL_FCY70MHz PIC24E, dsPIC33E (limited temp. range)

Definition at line 199 of file pic24_libconfig.h.

◆ CONFIG_HB_LED

#define CONFIG_HB_LED ( )    CONFIG_RB15_AS_DIG_OUTPUT()

Define a config function for the heartbeat pin.

Definition at line 381 of file pic24_libconfig.h.

Referenced by configHeartbeat().

◆ DANGEROUS_WEB

#define DANGEROUS_WEB   (1)

The Dangerous Prototypes web platform. See http://dangerousprototypes.com/docs/Web_platform_hardware_design

Definition at line 63 of file pic24_libconfig.h.

◆ DEBOUNCE_DLY

#define DEBOUNCE_DLY   (15)

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

Definition at line 223 of file pic24_libconfig.h.

◆ DEFAULT_BAUDRATE

#define DEFAULT_BAUDRATE   (230400)

Default baud rate used by configBasic() to configure the DEFAULT_UART.

Definition at line 306 of file pic24_libconfig.h.

Referenced by configBasic().

◆ DEFAULT_BRGH

#define DEFAULT_BRGH   (0)

Default BRGH value used by configUART1 to 4 when configuring a UART. This value may be overridden on a per-UART basis by #defineing DEFAULT_BRGHn (where n = the UART to override) to the values given below. Allowed values:

  • BRGH = 0 - the baud rate divisor is 16
  • BRGH = 1 - the baud rate divisor is 4

Definition at line 319 of file pic24_libconfig.h.

◆ DEFAULT_DESIGN

#define DEFAULT_DESIGN   (3)

Any of three targets, which share the same hardware configuration:

  1. The schematic on pg. 255 of the book "Microcontrollers: From Assembly Language to C Using the PIC24 Family"
  2. The Microchip Microstik for dsPIC33F and PIC24H Development Board, part number DM330013.
  3. The Sparkfun Breakout Board for PIC24HJ32 - mini-Bully sku: BOB-08787

Definition at line 82 of file pic24_libconfig.h.

◆ DEFAULT_UART

#define DEFAULT_UART   (1)

Defines the default UART which the configUART() function initializes and which serial I/O is directed to until the _C30_UART variable is changed.

Definition at line 280 of file pic24_libconfig.h.

Referenced by configDefaultUART().

◆ EMBEDDED_C1

#define EMBEDDED_C1   (472313)

The CAN2 rev C1 board used for Embedded Systems, ECE 4723, at Mississippi State University (Fall 2013)

Definition at line 103 of file pic24_libconfig.h.

◆ EMBEDDED_F14

#define EMBEDDED_F14   (472314)

The CAN2 rev C1 board used for Embedded Systems, ECE 4723, at Mississippi State University (Fall 2014)

Definition at line 106 of file pic24_libconfig.h.

◆ EXPLORER16_100P

#define EXPLORER16_100P   (-1)

The Microchip Explorer 16 Development Board with a 100-pin plug-in module, part number DM240001.

Definition at line 58 of file pic24_libconfig.h.

◆ HARDMAPPED_UART

#define HARDMAPPED_UART   (4)

A device with hard-mapped pins for UART TX and RX.

Definition at line 85 of file pic24_libconfig.h.

◆ HARDWARE_PLATFORM

#define HARDWARE_PLATFORM   DEFAULT_DESIGN

Select one of the hardware platform above to compile for.

Definition at line 110 of file pic24_libconfig.h.

◆ HB_LED

#define HB_LED   (_LATB15)

Choose a pin for the heartbeat. If USE_HEARTBEAT is false, the heartbeat is disabled.

Definition at line 372 of file pic24_libconfig.h.

Referenced by configHeartbeat(), and toggleHeartbeat().

◆ MICROSTICK2

#define MICROSTICK2   (5)

Microchip part number: dm330013-2

Microstick II delivers a complete development hardware platform for Microchip’s 16-bit and 32-bit microcontrollers and digital signal controllers. It’s the perfect solution to those looking for a low-cost, easy-to-use development platform. The USB-powered kit includes an on-board debugger/programmer, a DUT socket for easy device swapping, a user LED and reset button. It is designed for insertion into a standard prototyping board for easy connection to additional circuitry. The kit is extremely portable as well and is still about the size of a stick of gum!

Supported Parts: All 3.3V PIC24FJ, PIC24E, PIC24H, dsPIC33, and PIC32 28-pin SPDIP packaged devices.

Definition at line 100 of file pic24_libconfig.h.

◆ SERIAL_EOL_CR

#define SERIAL_EOL_CR   (1)

Set SERIAL_EOL_DEFAULT to this value to send a carriage return only ("\r") to end a line.

Definition at line 243 of file pic24_libconfig.h.

◆ SERIAL_EOL_CR_LF

#define SERIAL_EOL_CR_LF   (0)

Set SERIAL_EOL_DEFAULT to this value to send a CR with every LF in outString. PuTTY uses this, expects "\n\r".

Definition at line 238 of file pic24_libconfig.h.

◆ SERIAL_EOL_DEFAULT

#define SERIAL_EOL_DEFAULT   SERIAL_EOL_LF

This macro defines end-of-line output behavior when the outString() function is passed a new line ("\n"). Set this to either SERIAL_EOL_CR_LF, SERIAL_EOL_CR, or SERIAL_EOL_LF.

Definition at line 258 of file pic24_libconfig.h.

◆ SERIAL_EOL_LF

#define SERIAL_EOL_LF   (2)

Set SERIAL_EOL_DEFAULT to this value to sends a new line only ("\n"). This works for Bully Bootloader, MPLAB SIM, TeraTerm, RealTerm.

Definition at line 250 of file pic24_libconfig.h.

◆ STARTER_BOARD_28P

#define STARTER_BOARD_28P   (2)

The Microchip 16-bit 28-pin Starter Board, Part number DM300027. Thanks to István for contributing this!

Note: When you use a Microchip 16-bit 28-pin Starter Board with this library collection or just try out the example programs of the texbook, the SW2 switch shoud be set in the USB/debug state.

Definition at line 72 of file pic24_libconfig.h.

◆ USE_CLOCK_TIMEOUT

#define USE_CLOCK_TIMEOUT   (1)

When set to 1, verify that calls to switchClock() do successfully switch the clock, reporting an error message on failure. See also checkClockTimeout().

Definition at line 340 of file pic24_libconfig.h.

◆ USE_HEARTBEAT

#define USE_HEARTBEAT   (1)

If this macro is true, heartbeat functionality is enabled. If false, heartbeat is disabled.

Definition at line 354 of file pic24_libconfig.h.