Suchen und Finden
Cover
1
Copyright page
5
Table of contents
6
Introduction
22
Acknowledgements
26
Section 1: Getting Started with Embedded Systems
28
Chapter 1. Tiny computers, hidden control
30
1.1 The main idea – embedded systems in today’s world
30
1.2 Some example embedded systems
31
1.3 Some computer essentials
35
1.4 Microprocessors and microcontrollers
38
1.5 Microchip and the PIC microcontroller
42
1.6 An introduction to PIC microcontrollers using the 12 Series
44
1.7 What others do – a Freescale microcontroller
47
Summary
49
References
49
Section 2: Minimum Systems and the PIC 16F84A
50
Chapter 2. Introducing the PIC 16 Series and the 16F84A
52
2.1 The main idea – the PIC 16 Series family
52
2.2 An architecture overview of the 16F84A
54
2.3 A review of memory technologies
56
2.4 The 16F84A memory
59
2.5 Some issues of timing
64
2.6 Power-up and Reset
65
2.7 What others do – the Atmel AT89C2051
67
2.8 Taking things further – the 16F84A on-chip reset circuit
68
Summary
71
References
71
Chapter 3. Parallel ports, power supply and the clock oscillator
72
3.1 The main idea – parallel input/output
73
3.2 The technical challenge of parallel input/output
73
3.3 Connecting to the parallel port
79
3.4 The PIC 16F84A parallel ports
82
3.5 The clock oscillator
86
3.6 Power supply
88
3.7 The hardware design of the electronic ping-pong
90
Summary
91
References
91
Chapter 4. Starting to program – an introduction to Assembler
92
4.1 The main idea – what programs do and how we develop them
93
4.2 The PIC 16 Series instruction set, with a little more on the ALU
96
4.3 Assemblers and Assembler format
98
4.4 Creating simple programs
100
4.5 Adopting a development environment
103
4.6 An introductory MPLAB tutorial
104
4.7 An introduction to simulation
108
4.8 Downloading the program to a microcontroller
110
4.9 What others do – a brief comparison of CISC and RISC instruction sets
113
4.10 Taking things further – the 16 Series instruction set format
114
Summary
115
References
115
Chapter 5. Building Assembler programs
116
5.1 The main idea – building structured programs
116
5.2 Flow control – branching and subroutines
119
5.3 Generating time delays and intervals
122
5.4 Dealing with data
124
5.5 Introducing logical instructions
128
5.6 Introducing arithmetic instructions and the Carry flag
129
5.7 Taming Assembler complexity
133
5.8 More use of the MPLAB simulator
136
5.9 The ping-pong program
139
5.10 Simulating the ping-pong program – tutorial
143
5.11 What others do – graphical simulators
145
Summary
146
References
146
Chapter 6. Working with time: interrupts, counters and timers
147
6.1 The main idea – interrupts
148
6.2 Working with interrupts
152
6.3 The main idea – counters and timers
158
6.4 Applying the 16F84A Timer 0, with examples using the electronic ping-pong
163
6.5 TheWatchdog Timer
165
6.6 Sleep mode
166
6.7 What others do
167
6.8 Taking things further – interrupt latency
168
Summary
169
Section 3: Larger Systems and the PIC 16F873A
170
Chapter 7. Larger systems and the PIC 16F873A
172
7.1 The main idea – the PIC 16F87XA
173
7.2 The 16F873A block diagram and CPU
173
7.3 16F873A memory and memory maps
177
7.4 ‘Special’ memory operations
182
7.5 The 16F873A interrupts
185
7.6 The 16F873A oscillator, reset and power supply
188
7.7 The 16F873A parallel ports
188
7.8 Test, commission and diagnostic tools
192
7.9 The Microchip in-circuit debugger (ICD 2)
198
7.10 Applying the 16F873A: the Derbot AGV
199
7.11 Downloading, testing and running a simple program with ICD 2
203
7.12 Taking things further – the 16F874A/16F877A Ports D and E
207
Summary
209
References
210
Chapter 8. The human and physical interfaces
211
8.1 The main idea – the human interface
211
8.2 From switches to keypads
214
8.3 LED displays
220
8.4 Liquid crystal displays
226
8.5 The main idea – interfacing to the physical world
230
8.6 Some simple sensors
230
8.7 More on digital input
234
8.8 Actuators: motors and servos
239
8.9 Interfacing to actuators
242
8.10 Building up the Derbot
247
8.11 Applying sensors and actuators – a ‘blind’ navigation Derbot program
249
Summary
250
References
250
Chapter 9. Taking timing further
252
9.1 The main ideas – taking counting and timing further
252
9.2 The 16F87XA Timer 0 and Timer 1
253
9.3 The 16F87XA Timer 2, comparator and PR2 register
259
9.4 The capture/compare/PWM (CCP) modules
262
9.5 Pulse width modulation
264
9.6 Generating PWM in software
271
9.7 PWM used for digital-to-analog conversion
276
9.8 Frequency measurement
279
9.9 Speed control applied to the Derbot
282
9.10 Where there is no timer
285
9.11 Sleep mode
287
9.12 Where do we go from here?
288
9.13 Building up the Derbot
289
Summary
289
Reference
289
Chapter 10. Starting with serial
290
10.1 The main idea – introducing serial
290
10.2 Simple serial links – synchronous data communication
292
10.3 The 16F87XA Master Synchronous Serial Port (MSSP) module in SPI mode
294
10.4 A simple SPI example
300
10.5 The limitations of Microwire and SPI, and of simple synchronous serial transfer
302
10.6 Enhancing synchronous serial, and the Inter-Integrated Circuit bus
302
10.7 The MSSP configured for I2C
304
10.8 I2C applied in the Derbot AGV
313
10.9 Evaluation of synchronous serial data communication and an introduction to asynchronous
320
10.10 The 16F87XA Addressable Universal Synchronous Asynchronous Receiver Transmitter ( USART)
322
10.11 Implementing serial without a serial port – ‘bit banging’
330
10.12 Building up the Derbot
330
Summary
330
References
330
Chapter 11. Data acquisition and manipulation
331
11.1 The main idea – analog and digital quantities, their acquisition and use
331
11.2 The data acquisition system
332
11.3 The PIC 16F87XA ADC module
339
11.4 Applying the ADC in the Derbot light meter program
346
11.5 Some simple data manipulation techniques
348
11.6 The Derbot light-seeking program
353
11.7 The comparator module
354
11.8 Applying the Derbot circuit for measurement purposes
356
11.9 Configuring the Derbot AGV as a light-seeking robot
359
Summary
359
References
359
Section 4: Smarter Systems and the PIC 18FXX2
360
Chapter 12. Smarter systems and the PIC 18FXX2
362
12.1 The main idea – the PIC 18 Series and the 18FXX2
363
12.2 The 18F2X2 block diagram and Status register
364
12.3 The 18 Series instruction set
367
12.4 Data memory and Special Function Registers
372
12.5 Program memory
374
12.6 The Stacks
379
12.7 The interrupts
380
12.8 Power supply and reset
385
12.9 The oscillator sources
387
12.10 Introductory programming with the 18F242
391
Summary
394
References
394
Chapter 13. The PIC 18FXX2 peripherals
395
13.1 The main idea – the 18FXX2 peripherals
395
13.2 The parallel ports
396
13.3 The timers
398
13.4 The capture/compare/PWM (CCP) modules
403
13.5 The serial ports
405
13.6 The analog-to-digital converter (ADC)
407
13.7 Low-voltage detect
407
13.8 Applying the 18 Series in the Derbot-18
409
13.9 The 18F2420 and the extended instruction set
410
Summary
412
Reference
412
Chapter 14. Introducing C
413
14.1 The main idea – why C?
414
14.2 An introduction to C
414
14.3 Compiling the C program
421
14.4 The MPLAB C18 compiler
422
14.5 A C18 tutorial
423
14.6 Simulating a C program
427
14.7 A second C example – the Fibonacci program
428
14.8 The MPLAB C18 libraries
430
14.9 Further reading
433
Summary
434
References
434
Chapter 15. C and the embedded environment
436
15.1 The main idea – adapting C to the embedded environment
436
15.2 Controlling and branching on bit values
436
15.3 More on functions
440
15.4 More branching and looping
442
15.5 Using the timer and PWM peripherals
444
Summary
449
Chapter 16. Acquiring and using data with C
450
16.1 The main idea – using C for data manipulation
450
16.2 Using the 18FXX2 ADC
450
16.3 Pointers, arrays and strings
458
16.4 Using the I2C peripheral
464
16.5 Formatting data for display
467
Summary
470
Chapter 17. More C and the wider C environment
471
17.1 The main idea – more C and the wider C environment
471
17.2 Assembler inserts
472
17.3 Controlling memory allocation
473
17.4 Interrupts
475
17.5 Example with interrupt on overflow – flashing LEDs on the Derbot
476
17.6 Storage classes and their application
480
17.7 Start-up code: c018i.c
483
17.8 Structures, unions and bit-fields
486
17.9 Processor-specific header files
487
17.10 Taking things further – the MPLAB Linker and the . map file
489
Summary
492
References
492
Chapter 18. Multi-tasking and the Real Time Operating System
493
18.1 The main ideas – the challenge of multi-tasking and real time
493
18.2 Achieving multi-tasking with sequential programming
496
18.3 The Real Time Operating System (RTOS)
499
18.4 Scheduling and the scheduler
500
18.5 Developing tasks
504
18.6 Data and resource protection – the semaphore
505
18.7 Where do we go from here?
506
Summary
506
References
506
Chapter 19. The SalvoTM Real Time Operating System
507
19.1 The main idea – Salvo, an example RTOS
507
19.2 Configuring the Salvo application
509
19.3 Writing Salvo programs
510
19.4 A first Salvo example
512
19.5 Using interrupts, delays and semaphores with Salvo
518
19.6 Using Salvo messages and increasing RTOS complexity
526
19.7 A program example with messages
527
19.8 The RTOS overhead
536
Summary
537
References
537
Section 5: Techniques of Connectivity and Networking
538
Chapter 20. Connectivity and networks
540
20.1 The main idea – networking and connectivity
540
20.2 Infrared connectivity
542
20.3 Radio connectivity
543
20.4 Controller Area Network (CAN) and Local Interconnect Network (LIN)
545
20.5 Embedded systems and the Internet
549
20.6 Conclusion
550
Summary
551
References
551
Appendix 1. The PIC 16 Series instruction set
554
Appendix 2. The electronic ping-pong
555
Appendix 3. The Derbot AGV – hardware design details
560
Appendix 4. Some basics of Autonomous Guided Vehicles
564
Appendix 5. PIC 18 Series instruction set (non-extended)
568
Appendix 6. Essentials of C
571
Index
576
Alle Preise verstehen sich inklusive der gesetzlichen MwSt.