B+[M+1]+E) * TPB ] represents the minimum time to complete an LCD read or write operation, this minimum time must be greater than the LCD enable cycle time, tC, which is specified as 450 ns. For the configuration described above, [(B+[M+1]+E) * TPB] = [(5) * 100 ns] = 500 ns, thereby satisfying the LCD timing specifications. If the cycle time is too short, wait periods can be added to any segment within the allowable ranges. Since the PMP is clocked from the peripheral bus clock, it is likely that the PMP cycle is slower than the core CPU, which means that the PMP also has a busy flag that must be polled before writing or reading the next byte. With the PMP interrupt disabled, the only way to determine if the PMP is ready for the next read or write cycle is to poll the PMP flag. The PMPMasterWrite function provided in the PIC32 Peripheral Library polls the PMP flag to ensure it has been cleared prior to writing. The code for writing to the LCD using the PMP is shown in Listing 7.3. —- ==== Listing 7.3. LCD Write Function Using the PMP ====

void writeLCD( int addr, char c)
{
while( busyLCD());	// Wait for LCD to be ready
} // End of writeLCD
char readLCD( int addr )
} // End of readLCD