English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (460/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
PIC32MX3XX/4XX
EXAMPLE 20-3: POLLING THE BUSY FLAG AND SOFTWARE CONTROLLED CHIP SELECT
/* An generic C example PMP write function
utilizing PORTD.RD1 as an active low
Chip Select and the BUSY bit.
*/
pmpWrite(unsigned int value)
{
PORTDCLR = 0x0002; //CS enabled
while(PMMODE & 0x8000); // PMP busy?
PMDIN = value; //perform write
while(PMMODE & 0x8000); //wait for PMP
PORTDSET = 0x0002; //CS disabled
}
/* An MPLAB C32 example PMP write function
utilizing PORTD.RD1 as an active low
Chip Select and the BUSY bit.
*/
pmpWrite(unsigned int value)
{
PORTDCLR = 0x0002; //CS enabled
while(PMMODEbits.BUSY); // PMP busy?
PMDIN = value; // perform write
while(PMMODEbits.BUSY); // wait for PMP
PORTDSET = 0x0002; //CS disabled
}
DS61143E-page 458
Preliminary
© 2008 Microchip Technology Inc.