Programming 16-Bit PIC Microcontrollers in C -  Lucio Di Jasio

Programming 16-Bit PIC Microcontrollers in C (eBook)

Learning to Fly the PIC 24
eBook Download: PDF | EPUB
2011 | 2. Auflage
416 Seiten
Elsevier Science (Verlag)
978-1-85617-871-6 (ISBN)
Systemvoraussetzungen
Systemvoraussetzungen
45,95 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

New in the second edition:

* MPLAB X support and MPLAB C for the PIC24F v3 and later libraries

* I2C? interface

* 100% assembly free solutions

* Improved video, PAL/NTSC

* Improved audio, RIFF files decoding

* PIC24F GA1, GA2, GB1 and GB2 support

Most readers will associate Microchip's name with the ubiquitous 8-bit PIC microcontrollers but it is the new 16-bit PIC24F family that is truly stealing the scene. Orders of magnitude increases of performance, memory size and the rich peripheral set make programming these devices in C a must. This new guide by Microchip insider Lucio Di Jasio teaches readers everything they need to know about the architecture of these new chips: How to program them, how to test them, and how to debug them. Di Jasio's common-sense, practical, hands-on approach starts out with basic functions and guides the reader step-by-step through even the most sophisticated programming scenarios. Experienced PIC users, including embedded engineers, programmers, designers, and SW and HW engineers, and new comers alike will benefit from the text's many thorough examples, which demonstrate how to nimbly sidestep common obstacles and take full advantage of the many new features.

!


* A Microchip insider introduces you to 16-bit PIC programming the easy way! * Condenses typical introductory 'fluff' focusing instead on examples and exercises that show how to solve common, real-world design problems quickly * Includes handy checklists to help readers perform the most common programming and debugging tasks


New in the second edition: MPLAB X support and MPLAB C for the PIC24F v3 and later libraries I2C(TM) interface 100% assembly free solutions Improved video, PAL/NTSC Improved audio, RIFF files decoding PIC24F GA1, GA2, GB1 and GB2 support Most readers will associate Microchip's name with the ubiquitous 8-bit PIC microcontrollers but it is the new 16-bit PIC24F family that is truly stealing the scene. Orders of magnitude increases of performance, memory size and the rich peripheral set make programming these devices in C a must. This new guide by Microchip insider Lucio Di Jasio teaches readers everything they need to know about the architecture of these new chips: How to program them, how to test them, and how to debug them. Di Jasio's common-sense, practical, hands-on approach starts out with basic functions and guides the reader step-by-step through even the most sophisticated programming scenarios. Experienced PIC users, including embedded engineers, programmers, designers, and SW and HW engineers, and new comers alike will benefit from the text's many thorough examples, which demonstrate how to nimbly sidestep common obstacles and take full advantage of the many new features. ! A Microchip insider introduces you to 16-bit PIC programming the easy way! Condenses typical introductory "e;fluff"e; focusing instead on examples and exercises that show how to solve common, real-world design problems quickly Includes handy checklists to help readers perform the most common programming and debugging tasks

Front Cover 1
Programming 16-Bit PIC Microcontrollers in C 4
Copyright Page 5
Contents 8
Preface 16
Introduction to the Second Edition 18
Introduction 20
Who Should Read this Book? 20
Structure of the Book 21
What This Book Is Not 22
Checklists 23
I: First Flights 28
1: The First Flight 30
Flight Plan 30
Preflight Checklist 31
The Flight 31
Compiling and Linking 34
Debugging the First Project 36
Port Initialization 38
Re-Testing PortA 39
Configuring the PIC24 40
Testing PortB 42
Analog vs Digital Pin Control 44
Post-Flight Briefing 46
Notes for the Assembly Experts 46
Notes for the PIC Microcontroller Experts 48
Notes for the C Experts 48
Tips & Tricks
Exercises 49
Books 49
Links 49
2: A Loop in the Pattern 50
Flight Plan 50
Preflight Checklist 50
The Flight 51
While Loops 53
Animation 56
Not So Fast, Please! 57
Post-Flight Briefing 60
Notes for the Assembly Experts 60
Notes for the PIC® Microcontroller Experts 61
Notes for the C Experts 61
Tips & Tricks
Exercises 61
Books 62
Links 62
3: More Pattern Work, More Loops 64
Flight Plan 64
Preflight Checklist 64
The Flight 65
do Loops 65
Variable Declarations 66
for Loops 67
More Loop Examples 68
Arrays 68
Sending a Message 69
Post-Flight Briefing 72
Notes for the Assembly Experts 72
Notes for the PIC® Microcontroller Experts 73
Notes for the C Experts 73
Tips & Tricks
Notes for PIC24 GA1 and GB1 Users 73
Exercises 78
Books 78
Links 78
4: Numb3rs 80
Flight Plan 80
Preflight Checklist 81
The Flight 81
Going Long 83
Long Long Multiplications 84
Floating Point 85
Notes for the C Experts 85
Measuring Performance 87
Post-Flight Briefing 89
Notes for the Assembly Experts 89
Notes for the PIC® Microcontroller Experts 91
Tips & Tricks
Math Libraries 91
Complex Data Types 91
Exercises 92
Books 92
Links 92
5: Interrupts 94
Flight Plan 94
Preflight Checklist 94
The Flight 95
Nesting of Interrupts 98
Traps 99
Trap Vector Details 99
A Template and an Example for a Timer1 Interrupt 99
A Real Example with Timer1 101
Testing the Timer1 Interrupt 103
The Secondary Oscillator 105
The Real-Time Clock Calendar (RTCC) 107
Managing Multiple Interrupts 108
Post-Flight Briefing 109
Notes for the C Experts 109
Notes for the Assembly Experts 109
Notes for the PIC Microcontroller Experts 110
Tips & Tricks
Exercises 112
Books 112
Links 113
6: Taking a Look Under the Hood 114
Flight Plan 114
Preflight Checklist 114
The Flight 114
Memory Space Allocation 116
Program Space Visibility 117
Investigating Memory Allocation 119
Looking at the Map 121
Pointers 124
The Heap 125
MPLAB C Memory Models 126
Post-Flight Briefing 127
Notes for the C Experts 127
Notes for the Assembly Experts 127
Notes for the PIC Microcontroller Experts 127
Tips & Tricks
Exercises 128
Books 129
Links 129
II: Flying “Solo” 130
7: Synchronous Communication 132
Flight Plan 132
Preflight Checklist 132
The Flight 132
Synchronous Serial Interfaces 133
Asynchronous Serial Interfaces 134
Synchronous Communication Using the SPI Modules 136
Testing the Read Status Register Command 139
Writing to the EEPROM 141
Reading the Memory Contents 142
A Non-Volatile Storage Library 142
Testing the New SEE Library Module 145
The I2C Interface 147
I2C Data Transfer Rules 149
I2C Serial EEPROMs 150
Talking to I2C Serial EEPROMs 151
Forming Commands 152
The SEE Grammar 153
Reading and Writing 16-Bit Values 154
The iWriteSEE() Function 157
The iReadSEE() Function 159
The Big I2C SEE Table 161
Post-Flight Briefing 163
Notes for the C Experts 163
Notes for the Experts 164
Notes for the PIC Microcontroller Experts 164
Tips & Tricks
Exercises 165
Books 166
Links 166
8: Asynchronous Communication 168
Flight Plan 168
Preflight Checklist 168
The Flight 169
UART Configuration 170
Sending and Receiving Data 172
Testing the Serial Communication Routines 173
Building a Simple Console Library 175
Testing a VT100 Terminal 177
Using the Serial Port as a Debugging Tool 179
The Matrix 179
Post-Flight Briefing 181
Notes for the C Experts 181
Notes for the PIC® Microcontroller Experts 182
Tips & Tricks
Exercises 183
Books 183
Links 184
9: Glass = Bliss 186
Flight Plan 186
Preflight Checklist 186
The Flight 187
HD44780 Controller Compatibility 188
The Parallel Master Port 188
Configuring the PMP for LCD Module Control 191
A Small Library of Functions to Access an LCD Display 192
Advanced LCD Control 195
Creating an LCD Library Module 197
Post-Flight Briefing 198
Notes for User Interface Experts 198
Notes for the C Experts 199
Tips & Tricks
Exercises 200
Books 200
Links 200
10: It’s an Analog World 202
Flight Plan 202
Preflight Checklist 202
The Flight 203
The First Conversion 205
Automatic Sampling 206
Developing a Demo 207
Expanding the EX16 Library 208
Developing a Game 209
Measuring Temperature 211
Another Game 214
Post-Flight Briefing 215
Notes for the C Experts 216
Tips & Tricks
Exercises 216
Books 216
Links 217
III: Cross-Country Flying 218
11: Capturing Inputs 220
Flight Plan 220
The Flight 221
Electrical Interface 221
The PS/2 Communication Protocol 221
Interfacing a PIC24 to the PS/2 222
Input Capture 223
Testing the PS/2 Receive Routines 227
Another Method – Change Notification 231
Evaluating Cost 234
A Third Method – I/O Polling 235
Testing the I/O Polling Method 239
Cost and Efficiency of the Solution 240
Completing the Interface, Adding a FIFO Buffer 242
Completing the Interface, Performing Key Codes Decoding 246
Post-Flight Briefing 249
Tips & Tricks
Exercises 250
Books 250
Links 250
12: The Dark Screen 252
Flight Plan 252
The Flight 252
Generating the Composite Video Signal 255
Using the Output Compare Modules 259
Memory Allocation 261
Image Serialization 263
Building the Video Module 265
Testing the Video Generator 268
Measuring Performance 269
The Dark Screen 270
A Test Pattern 271
Plotting 273
A Starry Night 274
Line Drawing 275
Bresenham Algorithm 276
Plotting Math Functions 279
Two-Dimensional Function Visualization 281
Fractals 285
Text 291
Testing the Text Functions 294
Text Page Video 295
Testing the Text Page Performance 303
Post-Flight Briefing 306
Tips & Tricks
Exercises 307
Books 308
Links 308
13: Mass Storage 310
Flight Plan 310
The Flight 311
The SD/MMC Physical Interface 311
Interfacing to the Explorer16 Board 312
Starting a New Project 313
Selecting the SPI Mode of Operation 315
Sending Commands in SPI Mode 315
Completing the SD/MMC Card Initialization 318
Reading Data From an SD/MMC Card 320
Writing Data to an SD/MMC Card 322
Using the SD/MMC Interface Module 324
Post-Flight Briefing 328
Tips & Tricks
Exercises 329
Books 329
Links 330
14: File I/O 332
Flight Plan 332
The Flight 333
Sectors and Clusters 333
The File Allocation Table 334
The Root Directory 335
The Treasure Hunt 337
Opening a File 345
File Attributes 349
Reading Data from a File 353
Closing a File 356
Creating the Fileio Module 357
Testing fopenM() and freadM() 359
Writing Data to a File 362
Closing a File, Second Take 366
Accessory Functions 367
Testing the Complete Fileio Module 371
Code Size 374
Post-Flight Briefing 374
Notes for the PIC® Microcontroller Experts 374
Tips & Tricks
Exercises 375
Books 375
Links 376
15: Volare 378
Flight Plan 378
The Flight 378
Using the PIC24 OC Modules in PWM Mode 380
Testing the PWM as a D/A Converter 382
Producing Analog Waveforms 384
Reproducing Voice Messages 388
A Media Player 388
The WAVE File Format 389
The Play() Function 390
The Low-Level Audio Routines 398
Testing the WAVE File Player 401
Optimizing the File I/O 403
LED Profiling 403
Post-Flight Briefing 404
Tips & Tricks
Exercises 405
Books 405
Links 405
Nel Blu Dipinto Di Blu 406
Index 408

Erscheint lt. Verlag 7.11.2011
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Technik Elektrotechnik / Energietechnik
ISBN-10 1-85617-871-4 / 1856178714
ISBN-13 978-1-85617-871-6 / 9781856178716
Haben Sie eine Frage zum Produkt?
PDFPDF (Adobe DRM)
Größe: 17,2 MB

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

EPUBEPUB (Adobe DRM)
Größe: 7,0 MB

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Entwicklung von GUIs für verschiedene Betriebssysteme

von Achim Lingott

eBook Download (2023)
Carl Hanser Verlag GmbH & Co. KG
39,99
Das umfassende Handbuch

von Johannes Ernesti; Peter Kaiser

eBook Download (2023)
Rheinwerk Computing (Verlag)
44,90
Das Handbuch für Webentwickler

von Philip Ackermann

eBook Download (2023)
Rheinwerk Computing (Verlag)
49,90