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

Go to the source code of this file.

Macros

#define SLEEP()   Sleep()
 Place the processor in sleep mode.
 
#define IDLE()   Idle()
 Place the processor in idle mode.
 
#define CLRWDT()   ClrWdt()
 Clear the watch-dog timer.
 
#define NOP()   Nop()
 Insert a one-cycle nop instruction.
 
#define ENABLEWDT()   (_SWDTEN = 1)
 Enable the watchdog timer.
 
#define DISABLEWDT()   (_SWDTEN = 0)
 Disable the watchdog timer.
 
Peripheral identification
#define NUM_UART_MODS   1
 
#define NUM_I2C_MODS   1
 
#define NUM_SPI_MODS   1
 
#define NUM_ECAN_MODS   1
 
Chip identification

These routines assist in identifying the device and revision of the PIC in use. See checkDeviceAndRevision() for a usage example.

#define DEV_ID_LOCATION   0xFF0000
 
#define REVISION_LOCATION   0xFF0002
 
#define DEV_ID   0x00080a
 
#define DEV_ID_STR   "PIC24HJ12GP201"
 
#define EXPECTED_REVISION1   0x003001
 
#define EXPECTED_REVISION1_STR   "A2"
 
#define EXPECTED_REVISION2   0x003002
 
#define EXPECTED_REVISION2_STR   "A3"
 
#define EXPECTED_REVISION3   0x003003
 
#define EXPECTED_REVISION3_STR   "A4"
 

Detailed Description

This header file includes the correct processor-specific include file. It also provides additional processor-specific information, such as the device ID, revision IDs, and the number of various peripherals.

Definition in file pic24_chip.h.

Macro Definition Documentation

◆ DEV_ID

#define DEV_ID   0x00080a

The device ID for this chip, located in program memory at DEV_ID_LOCATION.

Definition at line 163 of file pic24_chip.h.

Referenced by checkDeviceAndRevision().

◆ DEV_ID_LOCATION

#define DEV_ID_LOCATION   0xFF0000

The location in program memory of the device ID. Revision information is found in the Silicon Errata sheet for the device. The Device ID is contained in the datasheet for the target device.

Definition at line 154 of file pic24_chip.h.

Referenced by checkDeviceAndRevision().

◆ DEV_ID_STR

#define DEV_ID_STR   "PIC24HJ12GP201"

A string to identify this chip, printed by checkDeviceAndRevision().

Definition at line 167 of file pic24_chip.h.

Referenced by checkDeviceAndRevision().

◆ EXPECTED_REVISION1

#define EXPECTED_REVISION1   0x003001

A revision for this device, located in program memory at REVISION_LOCATION. Additional revisions can be defined as EXPECTED_REVISIONn, where n = 1..5.

Definition at line 172 of file pic24_chip.h.

Referenced by checkDeviceAndRevision().

◆ EXPECTED_REVISION1_STR

#define EXPECTED_REVISION1_STR   "A2"

A string to accompany this revision, printed by checkDeviceAndRevision(). Additional revision strings can be defined as EXPECTED_REVISIONn, where n = 1..5.

Definition at line 177 of file pic24_chip.h.

Referenced by checkDeviceAndRevision().

◆ NUM_ECAN_MODS

#define NUM_ECAN_MODS   1

Define the number of ECAN modules supported by this chip. See NUM_UART_MODS for details on this methodology.

Definition at line 135 of file pic24_chip.h.

◆ NUM_I2C_MODS

#define NUM_I2C_MODS   1

Define the number of I2C modules supported by this chip. See NUM_UART_MODS for details on this methodology.

Definition at line 113 of file pic24_chip.h.

◆ NUM_SPI_MODS

#define NUM_SPI_MODS   1

Define the number of SPI modules supported by this chip. See NUM_UART_MODS for details on this methodology.

Definition at line 124 of file pic24_chip.h.

◆ NUM_UART_MODS

#define NUM_UART_MODS   1

Define the number of UART modules supported by this chip. NOTE: this only works when testing #defines, not testing variable. So, don't test UxSTA; instead, test _UxRXIF which is uniquely defined for each UART. (Idea taken from the C30 peripheral library, in uart.h.)

Definition at line 102 of file pic24_chip.h.

◆ REVISION_LOCATION

#define REVISION_LOCATION   0xFF0002

The location in program memory of the revision.

Definition at line 156 of file pic24_chip.h.

Referenced by checkDeviceAndRevision().