E-Book, Englisch, 304 Seiten
Bates Programming 8-bit PIC Microcontrollers in C
1. Auflage 2008
ISBN: 978-0-08-056014-4
Verlag: Elsevier Science & Techn.
Format: EPUB
Kopierschutz: 6 - ePub Watermark
with Interactive Hardware Simulation
E-Book, Englisch, 304 Seiten
ISBN: 978-0-08-056014-4
Verlag: Elsevier Science & Techn.
Format: EPUB
Kopierschutz: 6 - ePub Watermark
Microcontrollers are present in many new and existing electronic products, and the PIC microcontroller is a leading processor in the embedded applications market. Students and development engineers need to be able to design new products using microcontrollers, and this book explains from first principles how to use the universal development language C to create new PIC based systems, as well as the associated hardware interfacing principles. The book includes many source code listings, circuit schematics and hardware block diagrams. It describes the internal hardware of 8-bit PIC microcontroller, outlines the development systems available to write and test C programs, and shows how to use CCS C to create PIC firmware. In addition, simple interfacing principles are explained, a demonstration program for the PIC mechatronics development board provided and some typical applications outlined.*Focuses on the C programming language which is by far the most popular for microcontrollers (MCUs)
*Features Proteus VSMg the most complete microcontroller simulator on the market, along with CCS PCM C compiler, both are highly compatible with Microchip tools
*Extensive downloadable content including fully worked examples
Martin Bates is one of the leading authors specializing in introductory level texts on PIC microcontrollers for the academic, professional and hobby markets, with 20 years' experience of teaching microprocessor systems.
Autoren/Hrsg.
Weitere Infos & Material
1;Front Cover;1
2;Programming 8-bit PIC Microcontrollers in C: with Interactive Hardware Simulation;4
3;Copyright Page;5
4;Contents;6
5;Foreword;12
6;Preface;14
7;Introduction;18
8;Part 1 PIC Microcontroller Systems;22
8.1;1.1 PIC16 Microcontrollers;22
8.1.1;MCU Features;24
8.1.2;Program Execution;24
8.1.3;RAM File Registers;28
8.1.4;Other PIC Chips;28
8.2;1.2 PIC16 MCU Configuration;29
8.2.1;Clock Options;30
8.2.2;Configuration Options;30
8.2.3;Configuration in C;32
8.3;1.3 PIC16 MCU Peripherals;33
8.3.1;Timers;34
8.3.2;A/D Converter;36
8.3.3;Comparator;36
8.3.4;Parallel Slave Port;37
8.3.5;Interrupts;37
8.4;1.4 PIC16 Serial Interfaces;39
8.4.1;USART;40
8.4.2;SPI Bus;42
8.4.3;I[sup(2)]C Bus;42
8.5;1.5 PIC16 MPLAB Projects;43
8.5.1;MPLAB C Project;44
8.5.2;Project Files;46
8.6;1.6 PIC16 Program and Debug;47
8.6.1;Programming;48
8.6.2;Debugging;50
8.6.3;Design Package;51
8.7;Assessment 1;52
8.8;Assignments 1;53
9;Part 2 C Programming Essentials;56
9.1;2.1 PIC16 C Getting Started;56
9.1.1;Simple Program;56
9.1.2;Program Creation;57
9.1.3;Program Testing;58
9.1.4;Program Analysis;59
9.2;2.2 PIC16 C Program Basics;61
9.2.1;Variables;61
9.2.2;Looping;62
9.2.3;Decision Making;63
9.2.4;Loop Control;63
9.2.5;FOR Loop;66
9.2.6;SIREN Program;66
9.2.7;Blank Program;68
9.3;2.3 PIC16 C Data Operations;68
9.3.1;Variable Types;68
9.3.2;Assignment Operations;73
9.3.3;Conditional Operations;75
9.4;2.4 PIC16 C Sequence Control;77
9.4.1;While Loops;77
9.4.2;Break, Continue, and Goto;78
9.4.3;If..Else and Switch..Case;80
9.5;2.5 PIC16 C Functions and Structure;81
9.5.1;Basic Functions;83
9.5.2;Global and Local Variables;84
9.6;2.6 PIC16 C Input and Output;85
9.6.1;Serial LCD;86
9.6.2;Keypad and Calculator;89
9.7;2.7 PIC16 C More Data Types;94
9.7.1;Arrays;95
9.7.2;Indirect Addressing Operators;96
9.7.3;Enumeration;98
9.8;2.8 PIC16 C Compiler Directives;98
9.8.1;Program Directives;99
9.8.2;Header File;99
9.9;2.9 PIC16 C Assembler Routines;107
9.9.1;Program Compilation;108
9.9.2;Assembler Block;109
9.9.3;PIC Assembly Language;113
9.10;Assessment 2;115
9.11;Assignments 2;117
10;Part 3 C Peripheral Interfaces;120
10.1;3.1 PIC16 C Analog Input;120
10.1.1;Analog Setup;120
10.1.2;Voltage Measurement;121
10.2;3.2 PIC16 C Interrupts;125
10.2.1;C Interrupts;125
10.2.2;Interrupt Example;127
10.2.3;Interrupt Statements;128
10.3;3.3 PIC16 C Hardware Timers;129
10.3.1;Counter/Timer Operation;129
10.3.2;PWM Mode;130
10.3.3;Compare Mode;132
10.3.4;Capture Mode;132
10.4;3.4 PIC16 C UART Serial Link;134
10.5;3.5 PIC16 C SPI Serial Bus;137
10.6;3.6 PIC16 C I[sup(2)]C Serial Bus;139
10.7;3.7 PIC16 C Parallel and Serial Interfaces;142
10.7.1;Parallel Slave Port;142
10.7.2;Comparison of Communication Links;144
10.8;3.8 PIC16 C EEPROM Interface;147
10.9;3.9 PIC16 C Analog Output;148
10.10;Assessment 3;153
10.11;Assignments 3;155
11;Part 4 C Mechatronics Applications;158
11.1;4.1 PICDEM Mechatronics Board Overview;158
11.1.1;PICDEM Hardware;158
11.1.2;Motor Drives;159
11.1.3;Test Program;164
11.1.4;Debugging;166
11.2;4.2 PICDEM Liquid Crystal Display;167
11.2.1;LCD Connections;167
11.2.2;LCD Test Program;170
11.2.3;BCD Count Program;173
11.3;4.3 PICDEM DC Motor Test Programs;173
11.3.1;Basic Control;173
11.3.2;Rev Counter;175
11.4;4.4 PICDEM Stepper Motor Control;177
11.4.1;Construction;178
11.4.2;Stepper Motor Test;179
11.4.3;Direction Control;179
11.5;4.5 PICDEM Analog Sensors;183
11.5.1;Light Sensor;183
11.5.2;Temperature Measurement;184
11.6;4.6 PICDEM Temperature Controller;187
11.6.1;Specification;187
11.6.2;I/O Allocation;189
11.6.3;Implementation;189
11.7;4.7 PICDEM Board Simulation;192
11.7.1;Circuit Description;194
11.7.2;Demo Applications;196
11.8;Assessment 4;196
11.9;Assignments 4;198
12;Part 5 PIC16 C Applications and Systems;200
12.1;5.1 PIC16 C Application Design;200
12.1.1;Hardware Design;200
12.1.2;Software Design;201
12.1.3;Application Debugging and Testing;201
12.2;5.2 PIC16 C Temperature Controller;203
12.2.1;System Operation;203
12.2.2;Software Design and Implementation;204
12.3;5.3 PIC16 C Data Logger System;205
12.3.1;BASE Board;207
12.3.2;Program Outline;210
12.4;5.4 PIC16 C Operating Systems;210
12.4.1;Polled I/O;210
12.4.2;Interrupts;211
12.4.3;PC Operating System;212
12.4.4;Real-Time Operating System;213
12.5;5.5 PIC16 C System Design;216
12.5.1;Hardware Selection;216
12.5.2;Microcontrollers;217
12.5.3;Hardware Design;218
12.5.4;Software Design;220
12.6;Assessment 5;221
12.7;Assignments 5;222
13;Appendix A: Hardware Design Using ISIS Schematic Capture;224
13.1;Design Specification;224
13.2;Schematic Circuit;225
13.3;Schematic Edit;226
14;Appendix B: Software Design Using CCS C;230
14.1;BAR1 Source Code;232
14.2;PIC Registers;233
14.3;BAR1 List File;236
15;Appendix C: System Testing Using Proteus VSM;242
15.1;Attaching the Program;242
15.2;Program Debugging;242
15.3;Typical Errors;245
16;Appendix D: C Compiler Comparison;248
16.1;Microchip C18;249
16.2;Hi-Tech PIC C;251
16.3;Mikro C;255
16.4;Matrix C;255
16.5;Summary of C Compilers;257
17;Appendix E: CCS C Programming Syntax Summary;260
17.1;Compiler Directives;260
17.2;Program Blocks;260
17.3;Punctuation;260
17.4;Basic I/O Functions;261
18;Appendix F: CCS C Programming Function Reference;264
19;Answers;278
20;Index;292
20.1;A;292
20.2;B;292
20.3;C;292
20.4;D;293
20.5;E;294
20.6;F;294
20.7;G;294
20.8;H;294
20.9;I;294
20.10;K;295
20.11;L;295
20.12;M;295
20.13;N;295
20.14;O;295
20.15;P;296
20.16;R;298
20.17;S;298
20.18;T;298
20.19;U;299
20.20;V;299
20.21;W;299
20.22;X;299




