Designing
Embedded Systems with PIC Microcontrollers - Principles & Applications
Second Edition
Book Support Page
Home (Embedded Know-How)
This is the support page for the second edition.
Support Page for
the First Edition
Differences from the First Edition Support for
Instructors/Lecturers using this Book |
|
|
Differences from the First Edition
The general structure and approach of the book remains the same, with the
following differences/improvements:
* The PIC 16F87, 16F88, 16F883 and 18F2420 8-bit microcontrollers are
introduced, in addition to the 16F84A and 16F873A. The 18F242 is no longer
considered.
* There are more introductory programming examples, notably in Chapters 4 and 5.
* The PICkit 2 is included as a development tool. MPLAB version 8.10 is used.
* End of chapter questions are included in most chapters (though not those which relate mainly to programming).
* There is more consideration of "advanced" PIC microcontroller features, like nanoWatt technology and clock frequency management.
* Powerpoint slides for instructors are available,
email me for copies.
* Code "snips" are available below; there is
no book CD.
* There is a new final chapter, which is a survey of 16/32-bit PIC microcontrollers.
Buy the Book through the Internet
from
Elsevier Catalogue
from
Amazon (USA)
from
Amazon (Canada)
Support Information, by Chapter
Notes:
All information on building the Derbot AGV appears in the Derbot
site section.
Code snips and errata (except for tiny typos) appear in chapter sections.
Select the chapter you want to go to.
Table of Contents
This correctly shows (page xv), that there is no
Section 13.11 and 13.12. These are just missing! See Chapter 13 below.
Chapter 2
Errata
Table 2.1, page 29. This incorrectly states that the 16F87/88 have two
capture/compare/PWM modules. In fact they have only one (as seen later for the
16F88 in Figure 12.2).
Page 32, Figure 2.2. We believe there is an error in this Microchip Figure,
which is Figure 1.1 in the 16F84A data sheet (2001, doc. no. DS35007B).
Microchip have cautiously admitted to this through their Engineering Support
Team. The 5 bits indicated for the "Direct Addr" in the diagram should be 7
bits, otherwise the memory range of the 16F84A RAM can't be addressed. This 7
bits is shown correctly in Figure 2.3 of the same data sheet. The
Microchip error goes undetected in the book (page 39). To correct matters, on
page 39 final paragraph, the following words should be deleted: ", or only 5
valid bits if direct addressing is used".
Code Snips |
||
Prog. Example 4.4 | Prog. Example 4.5 |
Note that the PICkit 2 only works with the 16F84A microcontroller when accessed through the standalone mode, as shown in the book. The 16F84A is not listed as being supported when you access the PICkit 2 through MPLAB.
Code Snips |
||
Prog. Example 5.2 | Prog. Example 5.3 | Prog. Example 5.6 |
Prog. Example 5.7 | Prog. Example 5.8 |
Code Snips |
||
Prog. Example 6.1 | Prog. Example 6.3 | Prog. Example 6.6 |
Code Snips |
||
Prog. Example 7.1 |
Errata
Page 176 top line: Figure 4.13 should read Figure 4.18.
Program Example 7.1: The type setter gremlin really got at this one. Replace the initialise section with this (which is as it appears in the code snip):
;Initialise
start bsf status,5
;select memory bank 1
movlw B'00000000'
;all port A bits op
movwf trisa
movlw B'00110000'
;microswitches on bits 5 and 4 are only inputs
movwf trisb
;port B bits
movlw B'10000000'
;mode switch on bit 7 is only input
movwf trisc
;port C bits
movlw B'00000110'
movwf adcon1
;set port A for digital function
bcf status,5
;select bank 0
Note that Port A is not used at all in the hardware for this program. Setting Port A to output etc is of limited impact.
Question 5, page 212, should read "Programme Example 7.1 is written for the circuit of Figure 7.22."
Code Snips |
||
Prog. Example 8.1 | Prog. Example 8.2 | Prog. Example 8.4 |
Chapter 9
Note: Program Example 9.4 is the
dbt_pwm_qtr_sinwave program mentioned in the second paragraph of page 281.
Code Snips |
||
Prog. Example 9.1 | Prog. Example 9.3 | Prog. Example 9.4 |
Prog. Example 9.5 | Prog. Example 9.6 | Prog. Example 9.7 |
Full_Sin_Wave |
Code Snips |
||
Prog. Example 10.1 | Prog. Example 10.2 | Prog. Example10.3 |
Prog. Example 10.4 |
Errata
Boolean bars run riot between pages 314 and 324. Wherever you see
, replace it with
. The same goes for any reference to the D/A bit.
Code Snips |
||
Prog. Example 11.1 | Prog. Example 11.3 |
Chapter 13
Errata
Sadly, there is no Section 13.11 and
13.12, the numbering is just wrong. This one missed me, and all proof-readers.
Code Snips |
||
Prog. Example 13.1 | Prog. Example 13.2 |
Program Example 14.1: To see Port B change properly when simulating , it is necessary to set the PBADEN (Port B A/D Enable) configuration bit as shown below. If this is not done, then only the upper three bits of Port B respond to changes in the program. Access this screen in MPLAB by clicking Configure -> Configuration Bits.
Program Example 14.2. To allow this to run freely, disable the Watchdog Timer in the Configuration Bits, accessed as described above. This is shown in the above window as still being enabled.
Code Snips |
||
Prog. Example 14.2 |
Errata
Program Example 15.1, page 469:
//move microswitch states to diag leds loop:
should read:
//move microswitch states to diag leds
loop:
Code Snips |
||
Prog. Example 15.1 | Prog. Example 15.3 |
Note that Program Example 15.3 is written for the "modified" Derbot board, as described on page 629 of the Second Edition. The only difference is that Port B, bit 2 is used as the right motor enable bit, instead of Port A, bit 2. This is now commented in the code snip, at the place where it applies. Make sure you use the right version.
Chapter 16
Program Example 16.2, page 492:
the two braces on the last line should be on consecutive lines.
Code Snips |
||
Prog. Example 16.1 | Prog. Example 16.2 | Prog. Example 16.3 |
Prog. Example 16.4 |
Code Snips |
||
Prog. Example 17.3 |
Code Snips |
||
Prog. Example 19.1 | Prog. Example 19.3 | Prog. Example 19.5 |
Source code | Source code | Source code |
salvocfg.h | salvocfg.h | salvocfg.h |
ISR | ISR |
When programming with Salvo, if you launch two tasks of differing priority, and make them continuously available, then the high priority task will repeatedly execute. This sounds obvious when you say it like this, but can seem less obvious when executing or simulating a program. The lower priority task will only get to execute if, for example, you require the higher priority one to delay, or wait for a message.
Appendix 1
Errata
The type setters chose to write out this Table, rather than just insert the
Microchip Table, as happened in the first Edition. Therefore a number of silly
mistakes have been inserted. Notably, under Mnemonics, MOVW should read MOVWF,
and MOVL should read MOVLW.
Current ping pong parts list, with suppliers.
Code Snips |
||
Prog. Example A2.1 | Pingpong for 16F87 |
This book was written using MPLAB v.8. This was a very stable and successful version. However Microchip have now moved to MPLABX, which has significant differences. These tutorials adapt material from Chapters 14 and 15, and are written for MPLABX.
C Tutorial 1: Introducing MPLABX
C Tutorial 2: Starting Embedded C Programming