did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9781401837488

Embedded C Programming and the Microchip PIC

by ; ;
  • ISBN13:

    9781401837488

  • ISBN10:

    1401837484

  • Edition: CD
  • Format: Paperback
  • Copyright: 2003-11-03
  • Publisher: Delmar Cengage Learning

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $250.95 Save up to $24.47
  • Rent Book $226.48
    Add to Cart Free Shipping Icon Free Shipping

    TERM
    PRICE
    DUE
    USUALLY SHIPS IN 24-48 HOURS
    *This item is part of an exclusive publisher rental program and requires an additional convenience fee. This fee will be reflected in the shopping cart.

Supplemental Materials

What is included with this book?

Summary

This new book is carefully designed to teach C language programming as it applies to embedded microcontrollers and to fuel knowledge in the application of the Microchip® family of PIC® microcontrollers. Coverage begins with a step-by-step exploration of the C language showing readers how to create C language programs to solve problems. PIC processors are then studied, from basic architecture to all of the standard peripheral devices included in the microcontrollers. Numerous worked-out example programs demonstrate common uses for each of the peripherals. Readers are subsequently introduced to the built-in functions available in C, to help speed their programming and problem solving. Finally, readers are taken through use of the C Compiler, and learn to efficiently develop custom projects.

Table of Contents

PREFACE xiii
INTENDED AUDIENCE xiii
PREREQUISITES xiv
ORGANIZATION xiv
CHAPTER CONTENTS SUMMARY xiv
RATIONALE xv
HARDWARE USED xvi
CD-ROM CONTENTS AND SOFTWARE USED IN THE TEXTBOOK xvi
ACKNOWLEDGMENTS xvii
AUTHOR-SPECIFIC ACKNOWLEDGMENTS xviii
INTRODUCTION xix
CHAPTER 1 EMBEDDED C LANGUAGE TUTORIAL
1.1 OBJECTIVES
1.2 INTRODUCTION
1(1)
1.3 BEGINNING CONCEPTS
2(2)
1.4 VARIABLES AND CONSTANTS
4(7)
1.4.1 Variable Types
4(2)
1.4.2 Variable Scope
6(1)
Local Variables
6(1)
Global Variables
6(1)
1.4.3 Constants
7(1)
Numeric Constants
7(1)
Character Constants
8(1)
1.4.4 Enumerations and Definitions
8(1)
1.4.5 Storage Classes
9(1)
Automatic
10(1)
Static
10(1)
Register
10(1)
1.4.6 Type Casting
10(1)
1.5 I/O OPERATIONS
11(1)
1.6 OPERATORS AND EXPRESSIONS
12(8)
1.6.1 Assignment and Arithmetic Operators
12(4)
Bitwise Operators
13(3)
1.6.2 Logical and Relational Operators
16(1)
Logical Operators
16(1)
Relational Operators
16(1)
1.6.3 Increment, Decrement, and Compound Assignment
17(1)
Increment Operators
17(1)
Decrement Operators
18(1)
Compound Assignment Operators
18(1)
1.6.4 The Conditional Expression
18(1)
1.6.5 Operator Precedence
19(1)
1.7 CONTROL STATEMENTS
20(15)
1.7.1 While Loop
20(2)
1.7.2 Do/While Loop
22(1)
1.7.3 For Loop
23(2)
1.7.4 If/Else
25(3)
If Statement
25(1)
If/Else Statement
25(3)
Conditional Expression
28(1)
1.7.5 Switch/Case
28(2)
1.7.6 Break, Continue, and Goto
30(5)
Continue
31(4)
1.8 FUNCTIONS
35(8)
1.8.1 Prototyping and Function Organization
36(2)
1.8.2 Functions that Return Values
38(2)
1.8.3 Recursion
40(3)
1.9 POINTERS AND ARRAYS
43(14)
1.9.1 Pointers
44(3)
1.9.2 Arrays
47(3)
1.9.3 Multidimensional Arrays
50(2)
1.9.4 Pointers to Functions
52(5)
1.10 STRUCTURES AND UNION
57(10)
1.10.1 Structures
57(2)
1.10.2 Arrays of Structures
59(1)
1.10.3 Pointers to Structures
60(2)
1.10.4 Unions
62(2)
1.10.5 Typedef Operator
64(1)
1.10.6 Bits and Bitfields
65(1)
1.10.7 Sizeof Operator
66(1)
1.11 MEMORYTYPES
67(7)
1.11.1 Constants and Variables
67(4)
1.11.2 Register Variables
71(3)
#bit and #byte
72(2)
1.12 REAL-TIME METHODS
74(10)
1.12.1 Using Interrupts
75(3)
1.12.2 State Machines
78(6)
CHAPTER SUMMARY
84(1)
1.14 EXERCISES
85(2)
1.15 LABORATORY ACTIVITIES
87(2)
CHAPTER 2 PIC MICROCONTROLLER HARDWARE
2.1 OBJECTIVES
89(1)
2.2 INTRODUCTION
89(1)
2.3 ARCHITECTURAL OVERVIEW
90(2)
2.4 MEMORY ORGANIZATION
92(2)
2.4.1 Data Memory
92(1)
2.4.2 FLASH Memory
92(1)
2.4.3 Return Address Stack
93(1)
2.5 INTERRUPTS AND RESET
94(3)
2.5.1 Reset
97(1)
2.6 I/O PORTS
97(5)
2.6.1 Parallel Slave Port Mode
100(2)
2.7 TIMERS
102(26)
2.7.1 General
104(4)
2.7.1.1 Timers as "Ticks"
104(1)
2.7.1.2 Timers Measuring Pulse Widths or Frequencies
105(1)
2.7.1.3 Timers as Output Devices
106(2)
2.7.2 Timer 0
108(3)
2.7.3 Timer 1
111(10)
2.7.3.1 Capture and Compare Modules
113(8)
2.7.4 Timer2
121(6)
2.7.5 Watchdog Timer
127(1)
2.8 Serial I/O
128(21)
2.8.1 Asynchronous Serial Port (USART)
129(8)
One-Second Recording Interval Using Timer0
134(1)
Engine rpm Measurement Using Capture/Compare Module 1
135(2)
2.8.2 CAN Bus Module
137(1)
2.8.3 Synchronous Serial Port (MSSP)
138(11)
2.8.3.1 SPI Bus
138(6)
2.8.3.2 12C Bus
144(5)
2.9 ANALOG TO DIGITAL I/O
149
2.9.1 Analog to Digital Background
149(1)
2.9.2 Analog to Digital Module
150(24)
Measuring Engine Measurement Using the AID Converter (ADC)
154
2.11 ASSEMBLY LANGUAGE
57(3)
2.12 CHAPTER SUMMARY
60(4)
2.13 WRITTEN EXERCISES
64(101)
2.14 LABORATORY EXERCISES
165(2)
CHAPTER 3 STANDARD I/O AND PREPROCESSOR DIRECTIVES
3.1 OB ECTIVES
167(1)
3.2 INTRODUCTION
167(1)
3.3 CHARACTER INPUT/OUTPUT FUNCTIONS - GETCHARO AND PUTCHARO
168(6)
3.4 STANDARD OUTPUT FUNCTIONS
174(3)
3.4.1 Put String, puts(), and File Put String, fputs()
174(1)
3.4.2 Print Formatted, printf(), and File Print Formatted, fprintf()
175(2)
3.5 STANDARD INPUT FUNCTIONS
177(3)
3.5.1 Get String Functions - gets() and fgets()
178(1)
3.5.2 Get String Function - get string()
179(1)
3.6 STANDARD PREPROCESSOR DIRECTIVES
180(10)
3.6.1 The #include Directive
181(1)
3.6.2 The #define Directive
181(3)
3.6.3 The #ifdef, #ifndef, #else, and #endif Directives
184(5)
3.6.4 The #error Directive
189(1)
3.6.5 The #pragma Directive
190(1)
3.7 CCS-PICC FUNCTION-QUALIFYING DIRECTIVES
190(2)
3.7.1 The #inline and #separate Directives
190(1)
3.7.2 The #int default, #intglobal, and #int xxx Directives
191(1)
3.8 CCS-PICC PREDEFINED IDENTIFIERS
192(1)
3.9 CCS-PICC DEVICE SPECIFICATION DIRECTIVES
193(3)
3.9.1 The #device Directive
193(1)
3.9.2 The #fuse Directive
194(1)
3.9.3 The #id Directive
195(1)
3.10 CCS-PICC BUILT-IN LIBRARY PREPROCESSOR DIRECTIVES
196(4)
3.10.1 The #use delay Directive
196(1)
3.10.2 The #use fast_io, #use fixed_io, and #use standard_io Directives
196(2)
3.10.3 The #use i2c Directive
198(1)
3.10.4 The #use rs232 Directive
199(1)
3.11 CCS-PICC MEMORY CONTROL PREPROCESSOR DIRECTIVES
200(5)
3.11.1 The #type Directive
200(1)
3.11.2 The #bit Directive
201(1)
3.11.3 The #byte Directive
201(1)
3.11.4 The #locate Directive
202(1)
3.11.5 The #reserve Directive
202(1)
3.11.6 The #zero_ram Directive
202(1)
3.11.7 The #rom Directive
203(1)
3.11.8 The #org Directive
203(1)
3.11.9 The #asm and #endasm Directives
204(1)
3.12 CCS-PICC COMPILER CONTROL PREPROCESSOR DIRECTIVES
205(1)
3.12.1 The #case Directive
205(1)
3.12.2 The #opt Directive
205(1)
3.12.3 The #priority Directive
206(1)
3.13 CHAPTER SUMMARY
206(1)
3.14 EXERCISES
207(1)
3.15 LABORATORY ACTIVITIES
208(1)
CHAPTER 4 THE CCS-PICC C COMPILERAND IDE
4.1 OB ECTIVES
209(1)
4.2 INTRODUCTION
209(1)
4.3 INTEGRATED DEVELOPMENT ENVIRONMENT
210(1)
4.4 PROJECTS
210(4)
4.4.1 Open Existing Projects
211(1)
4.4.2 Create New Projects
211(1)
4.4.3 Setting the Include Directories for a Project
212(1)
4.4.4 Compile Projects
212(2)
4.4.5 Close Projects
214(1)
4.5 PIC WIZARD CODE GENERATOR
214(10)
4.5.1 General Tab
216(1)
4.5.2 Communications Tab
217(1)
4.5.3 SPI and LCD Tab
218(1)
4.5.4 Timers Tab
218(2)
4.5.5 Analog Tab
220(1)
4.5.6 Interrupts Tab
220(1)
4.5.7 Drivers Tab
220(2)
4.5.8 I/O Pins Tab
222(1)
4.5.9 Generated Project
222(2)
4.6 SOURCE FILES
224(1)
4.6.1 Open an Existing Source File
225(1)
4.6.2 Create a New Source File
225(1)
4.6.3 Changing the Main Source File for a Project
225(1)
4.7 EDITOR OPERATION
225(2)
4.7.1 Bookmarks
225(1)
4.7.2 Indentation and Tabs
226(1)
4.7.3 Brace Matching
227(1)
4.7.4 Syntax Highlighting
227(1)
4.7.5 Other Editor Options
227(1)
4.8 VIEW MENU
227(5)
4.8.1 C/ASM List
228(1)
4.8.2 Symbol Map
228(1)
4.8.3 Call Tree
229(1)
4.8.4 Statistics
230(1)
4.8.5 Compiler Messages
230(1)
4.8.6 Data Sheet
230(1)
4.8.7 Valid Fuses
230(1)
4.8.8 Valid Interrupts
230(1)
4.8.9 Binary File
230(2)
4.8.10 COD Debug File
232(1)
4.9 PROGRAM THE TARGET DEVICE
232(1)
4.10 TOOL MENU
232(4)
4.10.1 Device Editor
232(1)
4.10.2 Device Selector
233(1)
4.10.3 File Compare
233(1)
4.10.4 Numeric Converter
234(1)
4.10.5 Serial Port Monitor
234(2)
4.11 MICROCHIP MPLAB
236(6)
4.11.1 Launch MPLAB from CCS-PICC
236(1)
4.11.2 MPLAB Workspace and Project
237(1)
4.11.3 Simulator Development Mode
238(1)
4.11.4 Compiling under MPLAB
238(1)
4.11.5 Source File and Program Memory Windows
238(1)
4.11.6 Execution Speed
239(1)
4.11.7 Debugging Commands
239(1)
4.11.8 Set and Clear Breakpoints
239(1)
4.11.9 Run to Cursor
240(1)
4.11.10 Watch
240(1)
4.11.11 File Registers (RAM)Window
241(1)
4.11.12 Modify Memory
241(1)
4.11.13 View and Modify the Machine State
241(1)
4.12 CHAPTER SUMMARY
242(1)
4.13 EXERCISES
243(1)
4.14 LABORATORY ACTIVITIES
244(3)
CHAPTER 5 PROJECT DEVELOPMENT
5.1 OB ECTIVES
247(1)
5.2 INTRODUCTION
247(1)
5.3 CONCEPT DEVELOPMENT PHASE
247(1)
5.4 PROJECT DEVELOPMENT PROCESS STEPS
247(6)
5.4.1 Definition Phase
248(2)
5.4.2 Design Phase
250(1)
5.4.3 Test Definition Phase
251(1)
5.4.4 Build and Test the Prototype Hardware Phase
252(1)
5.4.5 System Integration and Software Development Phase
252(1)
5.4.6 System Test Phase
253(1)
5.4.7 Celebration Phase
253(1)
5.5 PROJECT DEVELOPMENT PROCESS SUMMARY
253(1)
5.6 EXAMPLE PROJECT: AN ELECTRONIC SCOOTER
253(82)
5.6.1 Concept Phase
253(1)
5.6.2 Definition Phase
254(5)
5.6.2.1 Preliminary Product Specification
255(1)
5.6.2.2 Operational Specification
256(1)
5.6.2.3 Basic Block Diagrams
257(2)
5.6.3 System Considerations for the Design
259(10)
5.6.3.1 Drive Requirements (According to Newton)
259(4)
5.6.3.2 Motor Selection
263(2)
5.6.3.3 Vehicle Speed Measurement
265(1)
5.6.3.4 Battery Health Measurement
266(1)
5.6.3.5 Motor Current Measurement
266(1)
5.6.3.6 Brake Control Measurement
267(1)
5.6.3.7 Electronic Braking
268(1)
5.6.4 Hardware Design - Drive Unit
269(6)
Speed Input
269(2)
Braking Input
271(1)
Motor Current Monitoring
271(1)
Motor Power Control
272(1)
Electronic Brake
272(1)
CAN Interface
273(1)
Power Supply
274(1)
Battery Selection
274(1)
5.6.5 Software Design - Drive Unit
275(3)
5.6.6 Hardware Design - Display Unit
278(4)
LCD Interface
278(3)
Buttons, Lights, and Sound
281(1)
5.6.7 Software Design - Display Unit
282(3)
5.6.8 Test Definition Phase
285(1)
Braking Input
285(1)
Vehicle Speed
285(1)
Battery Health
285(1)
Motor Current
285(1)
System Test for the Complete Project
285(1)
5.6.9 Build and Test Prototype Hardware Phase
286(6)
Drive Unit Checkout
286(3)
Display Unit Checkout
289(3)
5.6.10 System Integration and Software Development Phase, Drive Unit
292(29)
Vehicle Speed
293(4)
Battery Health and Motor Current Monitoring
297(1)
Cruise and Brake Control
298(1)
CAN Communications
298(23)
5.6.11 System Integration and Software Development Phase, Display Unit
321(8)
The Collection and Conversion of the CAN Data
321(3)
The Buttons, Beeper, and Indicators
324(5)
Driving the LCD
329(1)
5.6.12 System Test Phase
329(6)
5.7 CHALLENGES
335(1)
5.8 CHAPTER SUMMARY
336(1)
5.9 EXERCISES
336(1)
5.10 LABORATORY ACTIVITY
337(2)
APPENDIX A LIBRARY FUNCTIONS REFERENCE 339(98)
APPENDIX B PROGRAMMING THE PIC MICROCONTROLLERS 437(4)
APPENDIX C CCS ICD-S SERIAL IN-SYSTEM PROGRAMMER/DEBUGGER 441(2)
APPENDIX D MICROCHIP ICD 2 SERIAL IN-SYSTEM PROGRAMMER/DEBUGGER 443(4)
APPENDIX E THE "FLASH PIC-DEV" DEVELOPMENT BOARD 447(6)
APPENDIX F ASCII TABLE 453(6)
APPENDIX G PIC 16F877 INSTRUCTION SET SUMMARY 459(10)
APPENDIX H PIC 18F458 INSTRUCTION SET SUMMARY 469(8)
APPENDIX I ANSWERSTO SELECTED QUESTIONS (BY CHAPTER) 477(8)
INDEX 485

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program