Introduction |
|
xix | |
|
|
1 | (138) |
|
Day 1: The Adventure Begins |
|
|
3 | (22) |
|
|
3 | (1) |
|
|
3 | (3) |
|
|
6 | (2) |
|
|
8 | (2) |
|
|
10 | (1) |
|
Building the First Project |
|
|
11 | (1) |
|
|
12 | (2) |
|
|
14 | (2) |
|
|
16 | (1) |
|
|
17 | (2) |
|
|
19 | (1) |
|
Notes for the Assembly Experts |
|
|
20 | (2) |
|
Notes for the PIC MCU Experts |
|
|
22 | (1) |
|
|
22 | (1) |
|
|
22 | (1) |
|
|
23 | (1) |
|
|
24 | (1) |
|
|
24 | (1) |
|
Day 2: Walking in Circles |
|
|
25 | (18) |
|
|
25 | (1) |
|
|
25 | (2) |
|
|
27 | (1) |
|
|
28 | (3) |
|
|
31 | (4) |
|
|
35 | (2) |
|
|
37 | (1) |
|
Notes for the Assembly Experts |
|
|
38 | (1) |
|
Notes for the 8-Bit PIC Microcontroller Experts |
|
|
38 | (1) |
|
Notes for the 16-Bit PIC Microcontroller Experts |
|
|
38 | (1) |
|
|
39 | (1) |
|
Notes for the MIPS Experts |
|
|
39 | (1) |
|
|
39 | (1) |
|
Notes on Using the Peripheral Libraries |
|
|
40 | (2) |
|
|
42 | (1) |
|
|
42 | (1) |
|
|
42 | (1) |
|
Day 3: Message in a Bottle |
|
|
43 | (18) |
|
|
43 | (1) |
|
|
43 | (1) |
|
|
43 | (1) |
|
|
44 | (1) |
|
|
45 | (2) |
|
|
47 | (1) |
|
|
48 | (1) |
|
|
49 | (1) |
|
|
50 | (3) |
|
Testing with the Logic Analyzer |
|
|
53 | (1) |
|
Testing with the Explorer 16 Demonstration Board |
|
|
54 | (1) |
|
Testing with the PIC32 Starter Kit |
|
|
55 | (2) |
|
|
57 | (1) |
|
Notes for the Assembly Experts |
|
|
57 | (1) |
|
Notes for the PIC Microcontroller Experts |
|
|
58 | (1) |
|
|
58 | (1) |
|
|
59 | (1) |
|
|
60 | (1) |
|
|
60 | (1) |
|
|
60 | (1) |
|
|
61 | (20) |
|
|
61 | (1) |
|
|
61 | (1) |
|
|
61 | (3) |
|
On Optimizations (or Lack Thereof) |
|
|
64 | (1) |
|
|
64 | (1) |
|
|
65 | (2) |
|
|
67 | (2) |
|
|
69 | (1) |
|
|
70 | (3) |
|
|
73 | (1) |
|
Notes for the Assembly Experts |
|
|
73 | (2) |
|
Notes for the 8-Bit PIC® Microcontroller Experts |
|
|
75 | (1) |
|
Notes for the 16-Bit PIC and dsPIC® Microcontroller Experts |
|
|
76 | (1) |
|
|
77 | (1) |
|
|
78 | (1) |
|
|
79 | (1) |
|
|
79 | (2) |
|
|
81 | (34) |
|
|
81 | (1) |
|
|
81 | (1) |
|
|
81 | (1) |
|
Interrupts and Exceptions |
|
|
82 | (2) |
|
|
84 | (1) |
|
|
85 | (3) |
|
Interrupt Handlers Declaration |
|
|
88 | (2) |
|
The Interrupt Management Library |
|
|
90 | (1) |
|
Single Vector Interrupt Management |
|
|
90 | (5) |
|
Managing Multiple Interrupts |
|
|
95 | (3) |
|
Multivectored Interrupt Management |
|
|
98 | (5) |
|
|
103 | (5) |
|
|
108 | (1) |
|
The Real-Time Clock Calendar (RTCC) |
|
|
109 | (2) |
|
|
111 | (1) |
|
Notes for the PIC Microcontroller Experts |
|
|
111 | (1) |
|
|
112 | (1) |
|
|
113 | (1) |
|
|
113 | (1) |
|
|
113 | (2) |
|
|
115 | (24) |
|
|
115 | (1) |
|
|
115 | (1) |
|
|
116 | (2) |
|
|
118 | (5) |
|
|
123 | (4) |
|
|
127 | (1) |
|
|
128 | (1) |
|
|
129 | (1) |
|
|
130 | (4) |
|
The Embedded-Control Memory Map |
|
|
134 | (1) |
|
|
135 | (1) |
|
|
135 | (1) |
|
Notes for the Assembly Experts |
|
|
136 | (1) |
|
Notes for the PIC Microcontroller Experts |
|
|
136 | (1) |
|
|
137 | (1) |
|
|
137 | (1) |
|
|
138 | (1) |
|
|
138 | (1) |
|
|
139 | (130) |
|
|
141 | (32) |
|
|
141 | (1) |
|
|
141 | (1) |
|
|
142 | (2) |
|
Performance vs. Power Consumption |
|
|
144 | (2) |
|
The Primary Oscillator Clock Chain |
|
|
146 | (1) |
|
|
147 | (1) |
|
Initial Device Configuration |
|
|
148 | (2) |
|
Setting Configuration Bits in Code |
|
|
150 | (2) |
|
|
152 | (6) |
|
|
158 | (2) |
|
Fine-Tuning the PIC32: Configuring Flash Wait States |
|
|
160 | (3) |
|
Fine-Tuning the PIC32: Enabling the Instruction and Data Cache |
|
|
163 | (1) |
|
Fine-Tuning the PIC32: Enabling the Instruction Pre-Fetch |
|
|
164 | (1) |
|
Fine-Tuning the PIC32: Final Notes |
|
|
165 | (2) |
|
|
167 | (1) |
|
Notes for the Assembly Experts |
|
|
167 | (1) |
|
Notes for the PIC® Microcontroller Experts |
|
|
167 | (1) |
|
|
168 | (3) |
|
|
171 | (1) |
|
|
171 | (1) |
|
|
171 | (2) |
|
|
173 | (24) |
|
|
173 | (1) |
|
|
173 | (1) |
|
|
174 | (1) |
|
Synchronous Serial Interfaces |
|
|
174 | (2) |
|
Asynchronous Serial Interfaces |
|
|
176 | (1) |
|
|
177 | (1) |
|
Synchronous Communication Using the SPI Modules |
|
|
178 | (4) |
|
Testing the Read Status Register Command |
|
|
182 | (4) |
|
Writing Data to the EEPROM |
|
|
186 | (1) |
|
Reading the Memory Contents |
|
|
187 | (1) |
|
A 32-bit Serial EEPROM Library |
|
|
187 | (4) |
|
Testing the New SEE Library |
|
|
191 | (2) |
|
|
193 | (1) |
|
|
193 | (1) |
|
Notes for the Explorer 16 Experts |
|
|
193 | (1) |
|
Notes for the PIC24 Experts |
|
|
194 | (1) |
|
|
194 | (1) |
|
|
195 | (1) |
|
|
196 | (1) |
|
|
196 | (1) |
|
Day 9: Asynchronous Communication |
|
|
197 | (22) |
|
|
197 | (1) |
|
|
197 | (1) |
|
|
197 | (3) |
|
|
200 | (2) |
|
Sending and Receiving Data |
|
|
202 | (2) |
|
Testing the Serial Communication Routines |
|
|
204 | (2) |
|
Building a Simple Console Library |
|
|
206 | (3) |
|
|
209 | (2) |
|
The Serial Port as a Debugging Tool |
|
|
211 | (1) |
|
|
211 | (3) |
|
|
214 | (1) |
|
|
214 | (1) |
|
Notes for the PIC® Microcontroller Experts |
|
|
215 | (1) |
|
|
215 | (1) |
|
|
216 | (1) |
|
|
216 | (1) |
|
|
217 | (2) |
|
|
219 | (30) |
|
|
219 | (1) |
|
|
219 | (1) |
|
|
219 | (2) |
|
HD44780 Controller Compatibility |
|
|
221 | (2) |
|
|
223 | (1) |
|
Configuring the PMP for LCD Module Control |
|
|
224 | (1) |
|
A Small Library of Functions to Access an LCD Display |
|
|
225 | (6) |
|
Building an LCD Library and Using the PMP Library |
|
|
231 | (6) |
|
Creating the include and lib Directories |
|
|
237 | (3) |
|
|
240 | (1) |
|
|
241 | (4) |
|
|
245 | (1) |
|
Notes for the PIC24 Experts |
|
|
245 | (1) |
|
|
246 | (1) |
|
|
246 | (1) |
|
|
247 | (1) |
|
|
247 | (2) |
|
Day 11: It's an Analog World |
|
|
249 | (20) |
|
|
249 | (1) |
|
|
249 | (1) |
|
|
249 | (4) |
|
|
253 | (1) |
|
Automating Sampling Timing |
|
|
254 | (1) |
|
|
255 | (2) |
|
Creating Our Own Mini ADC Library |
|
|
257 | (1) |
|
|
258 | (3) |
|
|
261 | (5) |
|
|
266 | (1) |
|
Notes for the PIC24 Experts |
|
|
266 | (1) |
|
|
267 | (1) |
|
|
267 | (1) |
|
|
268 | (1) |
|
|
268 | (1) |
|
|
269 | (250) |
|
Day 12: Capturing User Inputs |
|
|
271 | (62) |
|
|
271 | (1) |
|
|
271 | (1) |
|
Buttons and Mechanical Switches |
|
|
272 | (3) |
|
|
275 | (2) |
|
|
277 | (3) |
|
|
280 | (3) |
|
Interrupt-Driven Rotary Encoder Input |
|
|
283 | (5) |
|
|
288 | (1) |
|
|
288 | (1) |
|
The PS/2 Communication Protocol |
|
|
289 | (1) |
|
Interfacing the PIC32 to the PS/2 |
|
|
290 | (1) |
|
|
290 | (6) |
|
Testing Using a Stimulus Scripts |
|
|
296 | (5) |
|
|
301 | (1) |
|
|
302 | (6) |
|
|
308 | (1) |
|
|
309 | (5) |
|
Testing the I/O Polling Method |
|
|
314 | (3) |
|
Cost and Efficiency Considerations |
|
|
317 | (2) |
|
|
319 | (5) |
|
|
324 | (4) |
|
|
328 | (1) |
|
Notes for the PIC24 Experts |
|
|
329 | (1) |
|
|
329 | (1) |
|
|
330 | (1) |
|
|
330 | (1) |
|
|
331 | (2) |
|
|
333 | (70) |
|
|
333 | (1) |
|
|
333 | (1) |
|
|
334 | (3) |
|
Generating the Composite Video Signal |
|
|
337 | (5) |
|
The Output Compare Modules |
|
|
342 | (3) |
|
|
345 | (1) |
|
Serialization, DMA, and Synchronization |
|
|
346 | (7) |
|
Completing a Video Library |
|
|
353 | (4) |
|
Testing the Composite Video |
|
|
357 | (3) |
|
|
360 | (1) |
|
|
360 | (2) |
|
|
362 | (2) |
|
|
364 | (2) |
|
|
366 | (2) |
|
|
368 | (2) |
|
|
370 | (3) |
|
|
373 | (3) |
|
Two-Dimensional Function Visualization |
|
|
376 | (5) |
|
|
381 | (8) |
|
|
389 | (2) |
|
|
391 | (3) |
|
|
394 | (1) |
|
|
395 | (3) |
|
|
398 | (1) |
|
Notes for the PIC24 Experts |
|
|
399 | (1) |
|
|
399 | (2) |
|
|
401 | (1) |
|
|
402 | (1) |
|
|
402 | (1) |
|
|
403 | (24) |
|
|
403 | (1) |
|
|
403 | (1) |
|
|
404 | (1) |
|
|
405 | (1) |
|
Interfacing to the Explorer 16 Board |
|
|
406 | (1) |
|
|
407 | (1) |
|
Selecting the SPI Mode of Operation |
|
|
408 | (1) |
|
Sending Commands in SPI Mode |
|
|
408 | (3) |
|
Completing the SD Card Initialization |
|
|
411 | (2) |
|
Reading Data from an SD/MMC Card |
|
|
413 | (3) |
|
Writing Data to an SD/MMC Card |
|
|
416 | (3) |
|
Testing the SD/MMC Interface |
|
|
419 | (5) |
|
|
424 | (1) |
|
|
425 | (1) |
|
|
426 | (1) |
|
|
426 | (1) |
|
|
426 | (1) |
|
|
427 | (58) |
|
|
427 | (1) |
|
|
427 | (1) |
|
|
428 | (1) |
|
|
428 | (1) |
|
The File Allocation Table |
|
|
429 | (1) |
|
|
430 | (3) |
|
|
433 | (11) |
|
|
444 | (10) |
|
|
454 | (5) |
|
|
459 | (1) |
|
|
460 | (3) |
|
Testing fopenM () and freadM () |
|
|
463 | (2) |
|
|
465 | (6) |
|
|
471 | (2) |
|
|
473 | (3) |
|
Testing the Complete Fileio Module |
|
|
476 | (4) |
|
|
480 | (1) |
|
|
481 | (1) |
|
|
481 | (1) |
|
|
482 | (1) |
|
|
482 | (1) |
|
|
483 | (2) |
|
|
485 | (34) |
|
|
485 | (1) |
|
|
485 | (1) |
|
|
486 | (2) |
|
|
488 | (2) |
|
Testing the PWM as a D/A Converter |
|
|
490 | (2) |
|
Producing Analog Waveforms |
|
|
492 | (5) |
|
Reproducing Voice Messages |
|
|
497 | (1) |
|
|
498 | (2) |
|
|
500 | (1) |
|
|
501 | (9) |
|
|
510 | (3) |
|
A Simple WAVE File Player |
|
|
513 | (2) |
|
|
515 | (1) |
|
|
516 | (1) |
|
|
516 | (1) |
|
|
516 | (1) |
|
|
517 | (1) |
|
|
517 | (1) |
|
Final Note for the Experts |
|
|
517 | (2) |
Index |
|
519 | |