Programming 16-Bit PIC Microcontrollers in C - Learning to Fly the PIC 24 (2nd Edition)
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....
Gespeichert in:
| 1. Verfasser: | |
|---|---|
| Format: | E-Book Buch |
| Sprache: | Englisch |
| Veröffentlicht: |
Chantilly
Elsevier
2012
Newnes Elsevier Science & Technology Newnes/Elsevier |
| Ausgabe: | 1 |
| Schlagworte: | |
| ISBN: | 9781856178709, 1856178706, 9780750682923, 0750682922 |
| Online-Zugang: | Volltext |
| Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Inhaltsangabe:
- Title Page Introduction to the Second Edition Introduction Checklists Preface Table of Contents Part I. First Flights 1. The First Flight 2. A Loop in the Pattern 3. More Pattern Work, More Loops 4. Numbers 5. Interrupts 6. Taking a Look under the Hood Part II. Flying "Solo" 7. Synchronous Communication 8. Asynchronous Communication 9. Glass = Bliss 10. It's an Analog World Part III. Cross-Country Flying 11. Capturing Inputs 12. The Dark Screen 13. Mass Storage 14. File I/O 15. Volare Index
- Cover -- Contents -- Preface -- Introduction -- Who should read this book? -- Structure of the book -- What this book is not -- Checklists -- PART I -- CHAPTER 1: THE FIRST FLIGHT -- Flight plan -- Preflight checklist -- The flight -- Compiling and linking -- Building the first project -- PORT initialization -- Retesting PORTA -- Testing PORTB -- Post-flight briefing -- Notes for assembly experts -- Notes for PIC MCU experts -- Notes for C experts -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 2: A LOOP IN THE PATTERN -- Flight plan -- Preflight checklist -- The flight -- An animated simulation -- Using the Logic Analyzer -- Post-flight briefing -- Notes for assembly experts -- Notes for PIC microcontroller experts -- Notes for C experts -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 3: MORE PATTERN WORK, MORE LOOPS -- Flight plan -- Preflight checklist -- The flight -- Do Loops -- Variable declarations -- for loops -- More loop examples -- Arrays -- A new demo -- Testing with the Logic Analyzer -- Using the Explorer16 demonstration board -- Post-flight briefing -- Notes for assembly experts -- Notes for PIC microcontroller experts -- Notes for C experts -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 4: NUMB3RS -- Flight plan -- Preflight checklist -- The flight -- On optimization (or lack thereof) -- Testing -- Going long -- Note on the multiplication of long integers -- Long long multiplication -- Floating point -- Notes for C experts -- Measuring performance -- Post-flight briefing -- Notes for assembly experts -- Notes for PIC microcontroller experts -- Tips and tricks -- Math libraries -- Complex data types -- Exercises -- Books -- Links -- CHAPTER 5: INTERRUPTS -- Flight plan -- Preflight checklist -- The flight -- Nesting of interrupts -- Traps -- A template and an example for Timer1 interrupt
- The flight -- HD44780 controller compatibility -- The Parallel Master Port -- Configuring the PMP for LCD module control -- A small library of functions to access an LCD display -- Advanced LCD control -- Post-flight briefing -- Notes for C experts -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 10: IT'S AN ANALOG WORLD -- Flight plan -- Preflight checklist -- The flight -- The fi rst conversion -- Automatic sampling timing -- Developing a demo -- Developing a game -- Measuring temperature -- The breath-alizer game -- Post-flight briefing -- Notes for C experts -- Tips and tricks -- Exercises -- Books -- Links -- PART III - CROSS-COUNTRY FLYING -- CHAPTER 11: CAPTURING INPUTS -- CHAPTER 12: THE DARK SCREEN -- Flight plan -- The flight -- Generating the composite video signal -- Using the Output Compare modules -- Memory allocation -- Image serialization -- Building the video module -- Testing the video generator -- Measuring performance -- The dark screen -- A test pattern -- Plotting -- A starry night -- Line drawing -- Bresenham algorithm -- Plotting math functions -- Two-dimensional function visualization -- Fractals -- Text -- Testing the TextOnGPage module -- Developing a text page video -- Testing the text page performance -- Post-flight briefing -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 13: MASS STORAGE -- Flight plan -- The flight -- The SD/MMC card physical interface -- Interfacing to the Explorer16 board -- Starting a new project -- Selecting the SPI mode of operation -- Sending commands in SPI mode -- Completing the SD/MMC card initialization -- Reading data from an SD/MMC card -- Writing data to an SD/MMC card -- Using the SD/MMC interface module -- Post-flight briefing -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 14: FILE I/O -- Flight plan -- The flight -- Sectors and Clusters
- The File Allocation Table (FAT) -- The Root Directory -- The treasure hunt -- Opening a fi le -- Reading data from a file -- Closing a file -- Creating the fileio module -- Testing fopenM() and freadM() -- Writing data to a file -- Closing a file, second take -- Accessory functions -- Testing the complete fileio module -- Code Size -- Post-flight briefing -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 15: VOLARE -- Flight plan -- The flight -- The PS/2 communication protocol -- Interfacing a PIC24 to the PS/2 -- Input Capture -- Testing the Input Capture method using Stimulus Scripts -- Testing the PS/2 receive routines -- The simulation -- The Simulator Profile -- Another method - Change Notification -- Evaluating cost -- A third method - I/O polling -- Testing the I/O polling method -- Cost and efficiency of the solution -- Completing the interface: adding a FIFO buffer -- Completing the interface: performing key codes decoding -- Post-flight briefing -- Tips and tricks -- Stalling transmissions from the keyboard - Open-Drain Output Control -- Exercises -- Books -- Links -- Flight plan -- The flight -- Using the PIC24 OC modules in PWM mode -- Testing the PWM as a D/A converter -- Producing analog waveforms -- Reproducing voice messages -- A media player -- The WAVE file format -- The play() function -- The low level audio routines -- Testing the WAVE file player -- Optimizing the fi le I/O -- LED Profi ling -- Looking under the hood for more -- Post-flight briefing -- Tips and tricks -- Exercises -- Books -- Links -- About the Author -- Index
- A real example with Timer1 -- Testing the Timer1 interrupt -- The secondary oscillator -- The real-time clock calendar (RTCC) -- Managing multiple interrupts -- Post-flight briefing -- Notes for C experts -- Notes for assembly experts -- Notes for PIC microcontroller experts -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 6: TAKING A LOOK UNDER THE HOOD -- Flight plan -- Preflight checklist -- The fl ight -- Memory space allocation -- Program space visibility -- Investigating memory allocation -- Looking at the MAP -- Pointers -- The heap -- MPLAB C30 Memory Models -- Post-flight briefing -- Notes for C experts -- Notes for assembly experts -- Notes for PIC microcontroller experts -- Tips and tricks -- Exercises -- Books -- Links -- PART II FLYING SOLOŽ -- CHAPTER 7: COMMUNICATION -- Flight plan -- Preflight checklist -- The flight -- Synchronous serial interfaces -- Asynchronous serial interfaces -- Parallel interfaces -- Synchronous communication using the SPI modules -- Testing the Read Status Register command -- Writing to the EEPROM -- Reading the memory contents -- A nonvolatile storage library -- Testing the new NVM library -- Post-flight briefing -- Notes for C experts -- Notes for the experts -- Notes for PIC microcontroller experts -- Tips and tricks -- Exercises -- Books -- Links -- CHAPTER 8: ASYNCHRONOUS COMMUNICATION -- Flight plan -- Preflight checklist -- The flight -- UART confi guration -- Sending and receiving data -- Testing the serial communication routines -- Building a simple console library -- Testing a VT100 terminal -- Using the serial port as a debugging tool -- The matrix -- Post-flight briefing -- Notes for C experts -- Notes for PIC microcontroller experts -- Tips and tricks -- About the ICD2 and UARTs on ICE -- Exercises -- Books -- Links -- CHAPTER 9: GLASS BLISS -- Flight plan -- Pre-flight checklist
- Testing the Video Generator -- Measuring Performance -- The Dark Screen -- A Test Pattern -- Plotting -- A Starry Night -- Line Drawing -- Bresenham Algorithm -- Plotting Math Functions -- Two-Dimensional Function Visualization -- Fractals -- Text -- Testing the Text Functions -- Text Page Video -- Testing the Text Page Performance -- Post-Flight Briefing -- Tips & -- Tricks -- Exercises -- Books -- Links -- 13: Mass Storage -- Flight Plan -- The Flight -- The SD/MMC Physical Interface -- Interfacing to the Explorer16 Board -- Starting a New Project -- Selecting the SPI Mode of Operation -- Sending Commands in SPI Mode -- Completing the SD/MMC Card Initialization -- Reading Data From an SD/MMC Card -- Writing Data to an SD/MMC Card -- Using the SD/MMC Interface Module -- Post-Flight Briefing -- Tips & -- Tricks -- Exercises -- Books -- Links -- 14: File I/O -- Flight Plan -- The Flight -- Sectors and Clusters -- The File Allocation Table -- The Root Directory -- The Treasure Hunt -- Opening a File -- File Attributes -- Reading Data from a File -- Closing a File -- Creating the Fileio Module -- Testing fopenM() and freadM() -- Writing Data to a File -- Closing a File, Second Take -- Accessory Functions -- Testing the Complete Fileio Module -- Code Size -- Post-Flight Briefing -- Notes for the PIC® Microcontroller Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- 15: Volare -- Flight Plan -- The Flight -- Using the PIC24 OC Modules in PWM Mode -- Testing the PWM as a D/A Converter -- Producing Analog Waveforms -- Reproducing Voice Messages -- A Media Player -- The WAVE File Format -- The Play() Function -- The Low-Level Audio Routines -- Testing the WAVE File Player -- Optimizing the File I/O -- LED Profiling -- Post-Flight Briefing -- Tips & -- Tricks -- Exercises -- Books -- Links -- Nel Blu Dipinto Di Blu -- Index
- Testing the Serial Communication Routines -- Building a Simple Console Library -- Testing a VT100 Terminal -- Using the Serial Port as a Debugging Tool -- The Matrix -- Post-Flight Briefing -- Notes for the C Experts -- Notes for the PIC® Microcontroller Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- 9: Glass = Bliss -- Flight Plan -- Preflight Checklist -- The Flight -- HD44780 Controller Compatibility -- The Parallel Master Port -- Configuring the PMP for LCD Module Control -- A Small Library of Functions to Access an LCD Display -- Advanced LCD Control -- Creating an LCD Library Module -- Post-Flight Briefing -- Notes for User Interface Experts -- Notes for the C Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- 10: It's an Analog World -- Flight Plan -- Preflight Checklist -- The Flight -- The First Conversion -- Automatic Sampling -- Developing a Demo -- Expanding the EX16 Library -- Developing a Game -- Measuring Temperature -- Another Game -- Post-Flight Briefing -- Notes for the C Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- III: Cross-Country Flying -- 11: Capturing Inputs -- Flight Plan -- The Flight -- Electrical Interface -- The PS/2 Communication Protocol -- Interfacing a PIC24 to the PS/2 -- Input Capture -- Testing the PS/2 Receive Routines -- Another Method - Change Notification -- Evaluating Cost -- A Third Method - I/O Polling -- Testing the I/O Polling Method -- Cost and Efficiency of the Solution -- Completing the Interface, Adding a FIFO Buffer -- Completing the Interface, Performing Key Codes Decoding -- Post-Flight Briefing -- Tips & -- Tricks -- Exercises -- Books -- Links -- 12: The Dark Screen -- Flight Plan -- The Flight -- Generating the Composite Video Signal -- Using the Output Compare Modules -- Memory Allocation -- Image Serialization -- Building the Video Module
- Front Cover -- Programming 16-Bit PIC Microcontrollers in C -- Copyright Page -- Contents -- Preface -- Introduction to the Second Edition -- Introduction -- Who Should Read this Book? -- Structure of the Book -- What This Book Is Not -- Checklists -- I: First Flights -- 1: The First Flight -- Flight Plan -- Preflight Checklist -- The Flight -- Compiling and Linking -- Debugging the First Project -- Port Initialization -- Re-Testing PortA -- Configuring the PIC24 -- Testing PortB -- Analog vs Digital Pin Control -- Post-Flight Briefing -- Notes for the Assembly Experts -- Notes for the PIC Microcontroller Experts -- Notes for the C Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- 2: A Loop in the Pattern -- Flight Plan -- Preflight Checklist -- The Flight -- While Loops -- Animation -- Not So Fast, Please! -- Post-Flight Briefing -- Notes for the Assembly Experts -- Notes for the PIC® Microcontroller Experts -- Notes for the C Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- 3: More Pattern Work, More Loops -- Flight Plan -- Preflight Checklist -- The Flight -- do Loops -- Variable Declarations -- for Loops -- More Loop Examples -- Arrays -- Sending a Message -- Post-Flight Briefing -- Notes for the Assembly Experts -- Notes for the PIC® Microcontroller Experts -- Notes for the C Experts -- Tips & -- Tricks -- Notes for PIC24 GA1 and GB1 Users -- Exercises -- Books -- Links -- 4: Numb3rs -- Flight Plan -- Preflight Checklist -- The Flight -- Going Long -- Long Long Multiplications -- Floating Point -- Notes for the C Experts -- Measuring Performance -- Post-Flight Briefing -- Notes for the Assembly Experts -- Notes for the PIC® Microcontroller Experts -- Tips & -- Tricks -- Math Libraries -- Complex Data Types -- Exercises -- Books -- Links -- 5: Interrupts -- Flight Plan -- Preflight Checklist -- The Flight
- Nesting of Interrupts -- Traps -- Trap Vector Details -- A Template and an Example for a Timer1 Interrupt -- A Real Example with Timer1 -- Testing the Timer1 Interrupt -- The Secondary Oscillator -- The Real-Time Clock Calendar (RTCC) -- Managing Multiple Interrupts -- Post-Flight Briefing -- Notes for the C Experts -- Notes for the Assembly Experts -- Notes for the PIC Microcontroller Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- 6: Taking a Look Under the Hood -- Flight Plan -- Preflight Checklist -- The Flight -- Memory Space Allocation -- Program Space Visibility -- Investigating Memory Allocation -- Looking at the Map -- Pointers -- The Heap -- MPLAB C Memory Models -- Post-Flight Briefing -- Notes for the C Experts -- Notes for the Assembly Experts -- Notes for the PIC Microcontroller Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- II: Flying "Solo" -- 7: Synchronous Communication -- Flight Plan -- Preflight Checklist -- The Flight -- Synchronous Serial Interfaces -- Asynchronous Serial Interfaces -- Synchronous Communication Using the SPI Modules -- Testing the Read Status Register Command -- Writing to the EEPROM -- Reading the Memory Contents -- A Non-Volatile Storage Library -- Testing the New SEE Library Module -- The I2C Interface -- I2C Data Transfer Rules -- I2C Serial EEPROMs -- Talking to I2C Serial EEPROMs -- Forming Commands -- The SEE Grammar -- Reading and Writing 16-Bit Values -- The iWriteSEE() Function -- The iReadSEE() Function -- The Big I2C SEE Table -- Post-Flight Briefing -- Notes for the C Experts -- Notes for the Experts -- Notes for the PIC Microcontroller Experts -- Tips & -- Tricks -- Exercises -- Books -- Links -- 8: Asynchronous Communication -- Flight Plan -- Preflight Checklist -- The Flight -- UART Configuration -- Sending and Receiving Data

