The following Errata have already been corrected in the Second Print of the First edition:
Page 62: replace
bits 3, 4 and 5 of the status register (SR)
with:
bits 5, 6 and 7 of the status register (SR)
Page 100 and page 101: inside function iReadNVM() and iWriteNVM() the while loop waiting for any work in progress to be completed is checking the content of the memory SR register bits WEN and WIP, but only WIP matters (in fact WEP will be set only later and only in the write function). Replace:
while ( ReadSR() & 0x3) ; // check the two LSb WEN and WIP
with:
while ( ReadSR() & 0x1); // check WIP
Page 111: at the bottom of the page a tab is missing, the last define should read:
#define TRTS TRISFbits.TRISF13 // Tris control for RTS pin
Page 114: at the top of the page inside the function getU2(), the RTS signal is de-asserted after the function return, making the code un-reacheable. The last two lines must be swapped as in:
...
RTS = 1; // de-assert RTS
return U2RXREG; // read the character from the receive buffer
} // getU2
Page 145: in step 4 of the readAD() function example the conversion is started by setting the DONE bit. This is incorrect (old PIC habit) as in the PIC24 the conversion is started by clearing the SAMP bit. Use instead:
AD1CON1bits.SAMP = 0; // 4. Start the conversion
Page 183 and following: the Polling I/O method is described as using the RG15 input pin for the PS2 data line. This code has eventually been modified to use pin RG13 instead to simplify the development of the AV16 board. Note that the Tips and Tricks section (page 198) makes already reference to the new and correct pin selection.
Page 271: at the top of the page inside the function initMedia()
both in part 4. and part 5. when de-selecting the SD card after each command (RESET and INIT) replace SDCS = 1;
with the macro disableSD()
previously defined (page 269), example:
r = sendSDCmd( RESET, 0); disableSD();
Also in the following line:
if ( r) break;
should read instead:
if ( !r) break;
This has been already corrected in the code available on the CDROM.
Page 279: the following lines of code:
// verify each block content
if ( !memcmp( data, buffer, B_SIZE))
should read:
// verify each block content
if ( memcmp( data, buffer, B_SIZE))
otherwise a mismatch would be reported incorrectly when in fact a perfect match is found.