Errata and FAQ

Should you notice a conflict between my narration and the official Microchip documentation, ALWAYS refer to the latter. However please send me an email if a conflict arises.

If you find a problem that is not covered in the list below, please check the Updates page as well. Changes in tools and software products (after the book was published) required a few modifications to the code in the book.


  • Page 14, the PIC32MX datasheet covers I/O Ports in Chapter 12.
  • Page 18, the final text paragraph, just above the code listing, refers to the AD1PCGF  SFR. This should be AD1PCFG.
  • Page 32, Figure 2.1: 16-bit Timer1 module block diagram contains a typo, replace:
    TGATE (T1CON<6>)
    TGATE (T1CON<7>)
  • Page 33, the formulat for Tdelay contains a typo. Replace:
    Tdelay = (Fpb) * 256 * DELAY
    Tdelay = (1/Fpb) * 256 * DELAY
  • Page 41, third paragraph, I state that the OpenTimer1() library function does not clear the TMR1 register.
    This is not true anymore, the library has been updated to include this feature.
  • Page 44, in the second do loop example, a semicolon is missing, replace:
    } while (1)
    } while (1);
  • Page 75, the example of access to a bit field contains a typo, replace
    T1CONbits.ON = 1;
    T1CONbits.TON = 1;
  • Page 95, in the definition of the InterruptHandler function, replace:
    void __ISR( 0, IPL1) InterruptHandler( void)
    void __ISR_SINGLE() InterruptHandler( void)
    See the Updates page for a complete explanation.
  • Page 128, replace the statement:
    for( i=0, p=a; i < 10; i++)
    for( i=0, pi=a; i < 10; i++)
  • Page 200, in Equation 9.1 the generic peripheral register UxBRG has been incorrectly spelled as a product of two terms: U x BRG.
  • Page 201, in the calculation of the baud rate error, replace % with x 100 to clarify how to obtain the correct value.
  • Page 202, replace the statement:
    #define U_TX 0x0400 // enable tx, clear all flags
    #define U_TX 0x1400 // enable tx & rx, clear all flags
    So that both RX and TX are enabled, which is necessary for the following demo to work.
  • Page 210, replace the statement:
    #define home()  putsU2( “\x1b[1,1H”)
    #define home()  putsU2( “\x1b[1;1H”)
    Notice the comma separating the two “1” digits is changed in a semicolon.
  • Page 226, replace the code segment:
    void LCDinit( void)
        // PMP initialization
        PMPEN = 0x0001


    void initLCD( void)
        // PMP initialization
        PMAEN = 0x0001

    Further down on the same page replace:
    #define PMDATA PMDIN1
    #define PMDATA PMDIN

  • Page 230, replace the statement:
    #define putLCD( d) LCDwrite( LCDDATA, (d))
    #define putLCD( d) writeLCD( LCDDATA, (d))
  • Page 252, replace the statement:
    #define AINPUTS 0xffef  // Analog inputs POT, TSENS
    #define AINPUTS 0xffcf  // Analog inputs POT, TSENS
  • Page 254 and 255, function readADC() must clear the DONE flag before returning:
       while( !AD1CON1bits.DONE); // 3. wait for conversion to complete
       AD1CON1bits.DONE = 0;      // 4. clear the flag
       return  ADC1BUF0;          // 5. read conversion result
  • Page 392, in function putcV() replace the statement:
    const char *pf;
    const unsigned char *pf;
  • Page 422, The expression used to compute the sector number:
    if ( !readSECTOR( addr+i*j, buffer) )
    should be replaced with:
    if ( !readSECTOR( addr+i+j*N_BLOCKS, buffer))
    in order to produce a linear sequence
  • Page 431, In figure 15.4: the File Size item is incorrectly reported as:
    long integer ( 132-bit)
    replace with:
    long integer (32-bit)
  • Page 503, The code segment where the WAVE struct is defined (first three lines) reads:
    typedef struct {
        // data chunk
        unsigned int dlength; // actual data size

    replace with:

    typedef struct {
        // data chunk
        unsigned int dlength; // actual data size
        char data[4];

    Notice the added space between char and data.


  • If you are using a PIC32MX7 PIM on the Explorer 16 demonstration board you might notice that the potentiometer input is not working in the demo project of  Day 10 (page 75). In reality on the PIC32MX7 pin RB5 (AN5) is multiplexed with a USB function and the designers of the PIC32MX7 PIM have decided to remap it to a different pin so that USB operation are possible without conflict. You will find that AN2, is connected instead to the potentiometer input of the EXplorer 16 board. For a complete pin mapping of the PIC32MX7 PIM please refer to the related official documentation (51949A.pdf).