Pages created and updated by Terry Sturtevant Date Posted: November 13, 2013

CP316: Microprocessor Systems and Interfacing

Errors in PIC Microcontroller: An Introduction to Software and Hardware Interfacing by Huang

Page #
Location Error
Chapter 1
3rd line from bottom of page decf    fp_cnt,F,A    should be    decf    lp_cnt,F,A
immediately above 1.5.1 heading replace special function with file "... 0x10 refers to the file register at address 0x10."
Figure 1.4 figure is an approximate memory map; in particular, the access bank composition varies according to processor as explained in the 3rd paragraph on the next page
paragraph 3, line 3 replace PIC18F452 with PIC18F458 "... the PIC18F458 has 1536 [six banks] bytes..."
bottom of table missing reference notation on last line, should be: (1) Note. This is not a physical register
paragraph 2, sentence 2 access bank composition varies according to the processor. For the PIC18F452, the access bank consists of lowest 128 GPRs and the highest 128 SFRs.
Chapter 2
section 2.4 - bad typesetting; headings are improperly spaced; many are widowed/orphaned items in bold are headings and because of the bad typesetting could be misleading. e.g. end at the bottom of page 41 should be the heading on the following page but appears to be the 3rd line in a code snippet
under radix hex, dee, or oct. should be hex, decimal, or octal.
Table 2.2 more useful if directives were sorted according to memory type; missing DE
Table 2.3 oetal_digits should be octal_digits
Table 2.3 - table title MPASMD should be MPASM
Table 2.3 swap location of table with cblock ... endc construct
second cblock double 1:2 should be double1:2
data directive - 1st sentence "The data directive can also be written as da. " However, the data examples given (string, address, constant) are not consistent with the DA entry in table 2.2 which implies that DA is string only.
last line ox20 should be 0x20
program variable convention n1_1 and m1_1 should be n1_l and m1_l to indicate low word
section 2.9.1 - case 1 - if you exit out of the loop, then by definition it is not an infinite loop. Confuses case 1 and case 4. Remove the sentence "In some applications, the user may add .... to get out of the infinite loop."
bottom of page and 1st paragraph of page 71

For bn -10 and bn 10:

  1. The operand for the branch instructions is actually a label. Therefore, bn 10 would branch to location 0x10 in memory and bn -10 will not compile. Use labels!
  2. Also, the '10' is hex not decimal. If 10 was an offset, the statements 'branch backward nine words' and 'branch forward 11 words' would consequently not be correct.
  3. If you really, truly wanted to use an offset, the syntax is not correct to use an offset in lieu of a label. The instructions should be bn $-10 and bn $+10 where the $ indicates the current address and is used with the offset (which is still hex) to specify a label.

Program should be rewritten for readability and efficiency. At minimum, remove the redundant code:

         goto      replace      ;no
          goto      next_i       ;yes
replace   movwf     arr_max,A    ;no, update the array max
next_i    incf      i,F,A        ;yes
Chapter 3
111 Figure 3.24 title Diable should be Disable
Chapter 4
Chapter 5
omit chapter from reading
Chapter 6
249 section 6.4, line 2 the number of edge triggered interrupts depends on the PIC18 model, the PIC18F452 only has 3
249 section 6.4.2 the PIC18F452 does not have PIR3, PIE3, IPR3
250 section 6.4.4, paragraph 1, last line "because its request appears in both the high-priority and low-priority logic circuit" "because its request appears in the high-priority logic circuit"
252 Figure 6.2b, Note 2 add PIC18F452 does not have INTEDG3 or INT3IP.
252 Figure 6.2c, Notes Note 1 is not accurate as PIC18Fxx2 includes the 452 which has an INT2.
Note 2 add: PIC18F452 does not have INT3 enable and flag bits.
254 Figure 6.3b PIC18F452 does not have a CMIF flag
i.e. Note 2 from Figure Figure 6.4b should be here as well.
254 Figures 6.3c, 6.3d PIC18F452 does not have a PIR3 register
257 Figures 6.4c, 6.4d PIC18F452 does not have a PIE3 register
260 Figures 6.5c, 6.5d PIC18F452 does not have a IPR3 register
263 section 6.5.5, line 2 TMROH should be TMR0H
263 section 6.5.5, line 3 TMROL should be TMR0L
263 section 6.5.5, line 5 TOCKI should be T0CKI
263 section 6.5.5, line 6 TOCON should be T0CON
263 section 6.5.6 Comparator interrupt should be Comparator interrupt (not all PIC18 devices have this interrupt)
265 Figure 6.6, title INTO should be INT0
265 program, line 7 "retfie" after "goto int0_ISR" is not required
266 example 6.1 program, lines 2-7 replace lines 2-7 with:
    incf    count,F    ;increment count
    btfsc  count,4    ;was count 15?
    clrf    count       ; yes, then clear count
or simply with:
    incf    count,F    ; increment count
266 example 6.2 program 1. align #include with column 1; first bracket should be "<".
2. "retfie" after "goto tmr1_ISR" is not required
3. initialize TMR1H before TMR1L in mainline
267 example 6.2 program 1. ISR could be modified similar to example 6.1 shown above
2. initialize TMR1H before TMR1L in tmr1_ISR
267 example 6.2 program program in text does not match program on CD
271 last line service routine, The  should be  service routine. The
Chapter 7
277 paragraph 2, line 1 can be proceeded should be can proceed
277 section 7.3 weak should explain memory mapped I/O vs isolated I/O [aka direct I/O or peripheral I/O]
288 paragraph 1, line 1 Example 5.3 demonstrates should be Example 6.1 demonstrates [5.3 doesn't exist; not sure if 6.1 is the correct reference?]
288 paragraph 1, line 1 Example 6.6 provides should be Example 6.3 provides [6.6 doesn't exist; not sure if 6.3 is the correct reference?]
293 paragraph 4, line 5 darken should be darker
303 last paragraph, line 1 Question on page 300 said 2 x 20 LCD display not the 4 x 20 discussed in this sentence.
  7.8 onward TBA  
Chapter 8
338 Figure 8.3 pin label T13CKI should be T1CKI
345 Figure 8.7 pin label T13CKI should be T1CKI
345 Section 8.3.4 replace all references to T13CKI with T1CKI ; note this a problem in the Timer3 section of the datasheet as well
  8.4 onward TBA  
Chapter 10
446 Not an error per se, but also see page 515 (bullet points)  
448 Not an error per se, but also see page 516 (SSPCON1) Look at SSPM3:SSPM0
455 Duplicate Section 10.3! Second one should be 10.4
Chapter 11
515 Not an error per se, but also see page 446 (bullet points)  
516 Not an error per se, but also see page 448 (SSPCON1) Look at SSPM3:SSPM0
Creative Commons License

Information on this site which is produced by Terry Sturtevant is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.


To view pdf documents, you can download Adobe Acrobat Reader .
get Acrobat Reader
If you need to update a browser, you might try Firefox which is Get Firefox!
Since this page uses cascading style sheets for its layout, it will look best with a browser which supports the specifications as fully as possible.

If you are looking for an office package, with a word processor, spreadsheet, etc., you might try LibreOffice which is Get LibreOffice!

Go to the main page for the Department of Physics and Computer Science.

Valid XHTML 1.1

Valid CSS!

(Level AA)

Wilfrid Laurier University