# NU32 Book Errata

(Difference between revisions)

Below are errata for the book "Embedded Computing and Mechatronics with the PIC32 Microcontroller," Kevin M. Lynch, Nicholas Marchuk, and Matthew L. Elwin, Newnes/Elsevier 2015. For succinctness, typos or other minor errors that cannot lead to confusion are not reported here.

Throughout the book

• Due to fixed-width fonts chosen for typesetting code, sometimes two consecutive underscores _ _ appear as a single long line, and sometimes two consecutive minus signs -- appear as a single long line. For example, some code listings using the _ _ ISR macro appear to have a single long line before the ISR.

Chapter 3: Software

• page 43: The last line of typeset code should begin `LATFbits.LATF0`, not `LATA5LATFbits.LATF0`.
• page 43: Mention that LATFbits.LATF is non-atomic
• page 47: The description of bit fields near the bottom of the page is misleading. Each named set of bits is a bit field. The `struct`s are collections of bit fields.

Chapter 5: Time and Space

• page 72-74 When discussing SET, INV, CLR registers mention atomicity

Chapter 6: Interrupts

• page 103: The line of code beginning `IPC0bits.INT0IS` sets the interrupt subpriority, not priority.
• page 109, question 9, should mention IFS0bits, too.

Chapter 7: Digital Input and Output

• page 117, description of ODCx: The code line should read TRISDbits.TRISD8 = 0, not TRISbits.TRISD8 = 0.
• page 118, Discussion of INV, CLR, and SET SFRS, should mention that LATxbits.LATxy is non-atomic. Thus, if an interrupt and other code both write to the same LAT register using LATXbits, inconsistent results can occur. This problem can be avoided by using the INV, CLR and SET SFRS, which do perform their actions atomically

• page 151, last line of description of SFR AD1CHS: AD1CHS.CHOSA should be AD1CHS.CH0SA (a zero insted of an "oh").

Chapter 21: Sensors

• The Greek letter psi in the summation block of Figure 21.22 (bottom) should be an uppercase sigma.

Chapter 22: Digital Signal Processing

• page 354, second-to-last sentence: should say "ratio G of their amplitudes"

Chapter 25: Brushed Permanent Magnet DC Motors

• page 416, Figure 25.14: The comment on "mechanical time constant" appears to refer to kt2 but it should be $k_t^2$.

Appendix A: A Crash Course in C

• page 523: `unit8_t` should be `uint8_t`
• page 564: After the gray box with `int sscanf...`, the next line should say "Instead of scanning from the keyboard, `sscanf` ..."

Appendix B: Circuits Review

• page 595: In the first sentence of "Application: Switch debouncing", it should read "clean falling edge from V to GND," not "clean falling edge from GND to V."
• page 602: The sentence after the first set of bullets should say "When IE > 0, the power dissipated by the transistor is IBVBE,on + ICVCE."