Microchip Technology SW006022-2N Data Sheet

Page of 338
MPLAB
®
 XC16 C Compiler User’s Guide
DS52071B-page 130
 2012 Microchip Technology Inc.
7.5
PARALLEL MASTER PORT ACCESS
Some devices contain a Parallel Master Port (PMP) peripheral which allows the con-
nection of various memory and non-memory devices directly to the device. Access to 
the peripheral is controlled via a selection of peripherals. More information about this 
peripheral can be found in the Family Reference Manual or device-specific data sheets.
The peripheral can require a substantial amount of configuration, depending upon the 
type and brand of memory device that is connected. This configuration is not done 
automatically by the compiler.
The extensions presented here allow the definition of a variable as PMP. This means 
that the compiler will communicate with the PMP peripheral to access the variable.
To use this feature:
• Initialize PMP - define the initialization function: void __init_PMP(void)
7.5.1
Initialize PMP
The PMP peripheral requires initialization before any access can be properly pro-
cessed. Consult the appropriate documentation for the device you are interfacing to 
and the data sheet for 16-bit device you are using.
If PMP is used, the toolsuite will call void __init_PMP(void) during normal C 
run-time initialization. If a customized initialization is being used, please ensure that this 
function is called.
This function should make the necessary settings in the PMMODE and PMCON SFRs. 
In particular:
• The peripheral should not be configured to generate interrupts: 
PMMODEbits.IRQM = 0
• The peripheral should not be configured to generate increments:
PMMODEbits.INCM = 0
 
The compiler will modify this setting during run-time as needed.
• The peripheral should be initialized to 16-bit mode:
PMMODEbits.MODE16 = 1
The compiler will modify this setting during run-time as needed.
• The peripheral should be configured for one of the MASTER modes:
PMMODEbits.MODE = 2
 or PMMODEbits.MODE = 3
• Set the wait-states PMMODEbits.WAITB, PMMODEbits.WAITM, and 
PMMODEbits.WAITE
 as appropriate for the device being connected.
• The PMCON SFR should be configured as appropriate making sure that the chip 
select function bits PMCONbits.CSF match the information communicated to the 
compiler when defining memory spaces.
A partial example might be:
  void 
_ _
init_PMP(void) {
    PMMODEbits.IRQM = 0;
    PMMODEbits.INCM = 0;
    PMMODEbits.MODE16 = 1;
    PMMODEbits.MODE = 3;
    /* device specific configuration of PMMODE and PMCCON follows */
  }
Note:
PMP attributes are not supported on devices with EPMP. Use Extended 
Data Space (EDS) instead. See Section 7.7 “Extended Data Space 
Access”
.