English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (458/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
PIC32MX3XX/4XX
20.3.2 MASTER PORT INITIALIZATION
The Master mode initialization properly prepares the
PMP port for communicating with an external device.
The following steps should be performed to properly
configure the PMP port:
1. If interrupts are used, disable the PMP interrupt
by clearing the interrupt enable bit PMPIE
(IEC1<2>) = 0.
2. Stop and reset the PMP module by clearing the
control bit ON (PMCON<15>) = 0.
3. Configure the desired settings in the PMCON,
PMMODE and PMAEN control registers.
4. If interrupts are used:
a) Clear interrupt flag bit PMPIF
(IFS1<2>) = 0.
b) Configure the PMP interrupt priority bits
PMPIP<2:0> (IPC7<4:2>) and interrupt sub
priority bits PMPIS (IPC7<1:0>.
c) Enable PMP interrupt by setting interrupt
enable bit PMPIE = 1.
5. Enable the PMP master port by setting control
bit ON = 1.
EXAMPLE 20-1: PARALLEL MASTER PORT INITIALIZATION
IEC1CLR = 0x0004;
//Disable PMP int
PMCON = 0x0BC0;
PMMODE = 0x2A04;
//Stop and Configure
//Config PMMODE reg
PMAEN = 0xFF00;
IPC7SET = 0x001C;
//Config PMAEN reg
//Priority level=7
IPC7SET = 0x0003;
IFS1CLR = 0x0004;
IEC1SET = 0x0004;
PMCONSET = 0x8000;
PMADDR = 0x4000;
PMDIN = 0x1234;
...
//subpriority=3
//Same as..
//IPC7SET=0x001F
//Clear PMP flag
//Enable PMP int
//Enable PMP
//Set external address
//Write to device
20.3.3 READ OPERATION
To perform a read on the parallel bus, the user reads
the PMDIN register. The effect of reading the PMDIN
register retrieves the current value and causes the
PMP to activate the Chip Select lines and the address
bus. The read line PMRD is strobed and the new data
is latched into the PMDIN register, making it available
for the next time the PMDIN register is read.
Note:
The read data obtained from the PMDIN
register is actually the read value from the
previous read operation. Hence, the first
user read will be a dummy read to initiate
the first bus read and fill the read register.
Also, the requested read value will not be
ready until after the BUSY bit is observed
low. Therefore, in a back-to-back read
operation, the data read from the register
will be the same for both reads. The next
read of the register will yield the new
value.
Refer to the PIC32MX3XX/4XX Reference Manual for
a detailed description of the read operation and illus-
trated example.
DS61143E-page 456
Preliminary
© 2008 Microchip Technology Inc.