Table of Contents For Assembly Language to C Using the PIC24 Family
Detailed Table of Contents
Detailed Table of Contents
- Number System and Digital Logic Review
- Binary Data
- Unsigned Number Conversion
- Hex to Binary, Binary to Hex
- Binary and Hex Arithmetic
- Binary and Hex Addition
- Binary and Hex Subtraction
- Shift Operations
- Combinational Logic Functions
- Logic Gate CMOS Implementations
- Combinational Building Blocks
- The Multiplexer
- The Adder
- The Incrementer
- The Shifter
- Memory (as a combinational lookup table)
- Sequential Logic
- The Clock Signal
- The D Flip-Flop
- Sequential Building Blocks
- The Register
- The Counter
- The Shift Register
- Encoding Character Data
- Review Problems
- The Stored Program Machine
- Problem Solving the Digital Way
- Finite State Machine Design
- Finite State Machine Implementation
- A Stored Program Machine
- Instruction Set Design and Assembly Language
- Hardware Design
- Modern Computers
- Review Problems
- Introduction to the PIC24 Microcontroller Family
- Introduction to Microprocessors and Microcontrollers
- The PIC24 Microcontroller Family
- Program Memory Organization
- Data Memory Organization
- Arrangement of Multibyte Values in Data Memory
- Data Transfer Instructions and Addressing Modes
- Register Direct Addressing
- File Register Addressing
- WREG - The Default Working Register
- Immediate Addressing
- Indirect Addressing
- Instruction Set Regularity
- Basic Arithmetic and Control Instructions
- Three-operand Addition/Subtraction
- Two-operand Addition/Subtraction
- Increment, Decrement Instructions
- Program Control: goto
- A PIC24 Assembly Language Program
- C-to-PIC24 Assembly Language
- The NOP Instruction
- 16-bit (WORD) Operations
- The Clock and Instruction Execution
- Review Problems
- Unsigned 8/16-bit Arithmetic, Logical, Conditional Operations
- Bitwise Logical Operations, Bit Operations
- The Status Register
- Shift and Rotate Operations
- Mixed 8-bit/16-bit Operations, Compound Operations
- Working Register Usage
- LSByte, MSByte Operations
- Conditional Execution Using Bit Tests
- Unsigned Conditional Tests
- Conditional Tests in C
- Zero, Non-zero Conditional Tests
- Bit Tests
- Equality, Inequality Conditional Tests
- Conditional Tests for >=, >, <, <=
- Comparison and Unsigned Branch Instructions
- Complex Conditional Expressions
- Looping
- Review Problems
- Extended Precision and Signed Data Operations
- Extended Precision Operations
- 32-bit Assignment Operations
- 32-bit Bitwise Logical Operations
- 32-bit Addition/Subtraction
- 32-bit Logical Shift Right/Shift Left Operations
- Zero, Non-Zero Conditional Tests
- Equality, Inequality
- Comparisons of >, >=, <, <= on Unsigned 32-bit Operands
- 64-bit Operations
- Signed Number Representation
- Signed Magnitude
- One's Complement
- Two's Complement
- Sign Extension
- Two's Complement Overflow
- Operations on Signed Data
- Shift Operations on Signed Data
- Comparisons of >, >=, <, <= on Signed Operands
- Sign Extension for Mixed Precision
- Branch Instruction Encoding
- Review Problems
- Extended Precision Operations
- Pointers and Subroutines
- An Introduction to C Pointers
- PIC24 Indirect Addressing Modes
- Instruction Stalls Due to Data Dependencies
- Arrays and Pointers in C
- C Strings
- The REPEAT Instruction
- Subroutines
- The Stack and Call/Return, Push/Pop
- The Data Memory Stack
- Call/Return and the Data Memory Stack
- Stack Overflow/Underflow
- Implementing Subroutines in Assembly Language
- Static versus Dynamic Parameter Allocation
- Using Working Registers for Subroutine Parameters and Locals
- Saving Register Values on the Stack
- The Shadow Registers
- A Subroutine with Multiple Parameters
- Stack Frames for Function Parameters and Local Variables
- Program Space Visibility and Global Variable Initialization
- Review Problems
- Advanced Assembly Language: Higher Math
- Multiplication
- 64-bit Multiplication
- Division
- Fixed-Point and Saturating Arithmetic
- Decimal to X.Y Binary Format
- X.Y Binary Format to Decimal Conversion
- Signed Fixed-Point
- 0.N Fixed-Point Format and Saturating Operations
- The dsPIC Microcontroller Family
- Floating-Point Number Representation
- IEEE 754 Floating-Point Encoding
- Floating-Point Operations
- BCD Arithmetic
- ASCII Data Conversion
- Binary to ASCII-Hex
- Binary to ASCII-Decimal
- ASCII-Hex to Binary
- ASCII-Decimal to Binary
- Review Problems
- Multiplication
- The PIC24HJ32GP202: System Startup and Parallel Port I/O
- High-Level Languages versus Assembly Language
- C Compilation for the PIC24 Microcontroller
- Special Function Registers and Bit References
- PIC24 Compiler Runtime Code, Variable Qualifiers/Attributes
- C Macros, Inline Functions
- Conditional Compilation
- PIC24HJ32GP202 Startup Schematic
- Startup Schematic: Power
- Startup Schematic: Reset
- Startup Schematic: PC Serial Communication Link
- Startup Schematic: In-circuit Serial Programming
- Startup Schematic: Application Components
- ledflash.c - The First C Program for PIC24HJ32GP202 Startup
- Clock Configuration
- Flasing the LED
- An Improved LED Flash Program
- echo.c - Testing the Serial Link
- asm_echo.s - Implementing Echo in Assembly
- Datasheet Reading - A Critical Skill
- Configuration Bits
- Clock Generation
- Setting Clock Options Using C
- Power-on Reset Behavior and Reset Sources
- Watchdog Timer, Sleep, Idle, Doze
- The reset.c Test Program
- Parallel Port Operation
- Tristate Drivers
- Schmitt Trigger Input
- Open-drain Output
- Internal Weak Pull-ups
- Digital versus Analog Inputs
- PIO Configuration Macros/Functions
- LED/Switch I/O and State Machine Programming
- State Machine I/O Programming
- A More Complex LED/Switch I/O Problem
- Interfacing to an LCD Module
- 3.3 V to 5 V Interfacing
- LCD Commands
- LCD Code Example
- The PIC24H versus the PIC24F Family
- Review Problems
- Interrupts and a First Look at Timers
- Interrupt Basics
- PIC24 Microcontroller Interrupt Details
- Vector Table
- Interrupt Priorities
- Traps
- Interrupt Latency
- ISR Overhead
- ISR Functions in C
- The Default Interrupt Handler
- An Example ISR
- Change Notification Interrupts
- Wake from Sleep/Idle
- Using a Change Notification Interrupt to Measure Interrupt Latency
- INTx External Interrupts, Remappable Pins
- Switch Inputs and Change Notification/INTx Interrupts
- Periodic Timer Interrupts
- Timer Macros and Support Functions
- Square Wave Generation
- Input Sampling
- Filtering Noisy Interrupts
- LED/Switch I/O and Semaphores
- A Rotary Encoder Interface
- A Keypad Interface
- On Writing and Debugging ISRs
- Review Problems
- Asynchronous and Synchronous Serial I/O
- I/O Channel Basics
- Synchronous, Asynchronous Serial I/O
- Asynchronous Serial I/O Using NRZ Encoding
- The PIC24 UART
- UARTx Transmit Operation
- UARTx Receive Operation
- Baud Rate Configuration
- Using the PIC24 UART with C
- <stdio.h> Library Functions
- Interrupt-Driven I/O with the PIC24 UART
- Interrupt-driven UART Receive
- Interrupt-driven UART Transmit
- The RS-232 Standard
- The Serial Peripheral Interface (SPI)
- SPI Example: The MCP41xxx Digital Potentiometer
- SPI Example:PIC24 Microcontroller Master to DS1722 Thermometer
- SPI Example:PIC24 Microcontroller Master to PIC24 Microcontroller Slave
- The I2C Bus
- I2C on the PIC24 Microcontroller
- I2C Example: PIC24 Microcontroller Master to DS1631 Thermometer
- I2C Example: PIC24 Microcontroller Master to 24LC515 Serial EEPROM
- Ping-Pong Buffering for Interrupt-driven Streaming Data
- Review Problems
- Data Conversion
- Data Conversion Basics
- Analog-to-Digital Conversion
- Counter-Ramp ADC
- Successive Approximation ADC
- Flash ADC
- Sample and Hold Amplifiers
- The PIC24 Analog-to-Digital Converter
- PIC24 ADC Configuration
- PIC24 ADC Operation: Manual
- PIC24 ADC Operation: Automatic and Scanning with Interrupts
- PIC24 ADC Operation: Automatic Using Timers
- PIC24 ADC Operation: Recap
- Digital-to-Analog Conversion
- Flash DACs
- Resistor String Flash DACs
- R-2R Resistor Ladder Flash DAC
- External Digital-to-Analog Converter Examples
- DAC Example: The Maxim 548A
- DAC Example: The Maxim 5353
- DAC Example: The Maxim 518
- Review Problems
- Timers
- Pulse Width Measurement
- Using a 32-bit Timer
- Pulse Width, Period Measurement Using Input Capture
- The Input Capture Module
- Pulse Width Measurement Using Input Capture
- Period Measurement Using Input Capture
- Application: Using Capture Mode for an Infrared Decoder
- The Output Compare Module
- Square Wave Generation
- Pulse Width Modulation
- A PWM Example
- PWM Application: DC Motor Speed Control and Servo Control
- DC Motor Speed Control
- Hobby Servo Control
- PWM Control of Multiple Servos
- A PWM DAC
- Time Keeping Using Timer1, RTCC
- The Real-Time Clock Calendar Module
- Review Problems
- Pulse Width Measurement
- Advanced Hardware Topics
- Direct Memory Access (DMA)
- Using the PIC24 Microcontroller as an I2C Slave
- Bus Arbitration for the I2C Bus
- The Controller Area Network (CAN)
- The PIC24 ECAN(TM) Module
- Using an ECAN RX FIFO
- Using an Extended Data Frame
- The Universal Serial Bus (USB)
- Run-Time Self-Programming
- A Sample Flash Application
- Comparator Module
- Parallel Master Port and CRC Generator
- Review Problems
- Operating Systems for Embedded Systems
- Operating System Concepts
- Tasks
- Multitasking and Schedulers
- Semaphores and Inter-task Coordination
- OS Services
- Embedded Systems Operating System (ESOS) for the PIC24 Microcontroller
- Overview
- User Tasks
- Our First ESOS Program
- ESOS Communication Services
- ESOS Timer Services
- ESOS Semaphore Services
- ESOS User Flags
- ESOS Child Tasks
- ESOS Interrupt Services
- Design: Adding an ESOS Service for I2C
- I2C Operations Under ESOS
- I2C Transactions Under ESOS
- Application Using the ESOS I2C Service
- Review Problems
- Operating System Concepts
- Capstone Projects
- Design of an Audio Record/Playback System
- Implementation of an Audio Record/Playback System
- Audio Data Compression
- Audio Application ISR and Configuration
- An MP3 to FM Radio Playback System
- A Solder Reflow Oven
- Solder Reflow Background
- High Temperature Sensing
- AC Power Control
- Reflow Oven Control Implementation
- A Small, Autonomous Robot
- Other Microcontroller Families from Microchip
- A Brief Survey of Non-PIC Microcontrollers
- Suggested Survey Topics
- Appendix A - PIC24 Architecture and Instruction Set Summary
- Appendix B - Software Tools Overview
- MPLAB Introduction
- PIC24 C Compiler Introduction
- The PICkit(TM)2 Programmer
- The PIC24 Bully Bootloader
- Appendix C - Suggested Laboratory Exercises
- Lab Setup
- Experiment 1: A Stored Program Machine (Chapters 1, 2)
- Experiment 2: PIC24 Assembly and MPLAB Introduction (Chapter 3)
- Experiment 3: Unsigned 8/16-bit Operations in Assembly Language (Chapter 4)
- Experiment 4: 8/16/32-bit Signed Operations in Assembly Language (Chapter 5)
- Experiment 5: Pointers, Subroutines in Assembly Language (Chapter 6)
- Experiment 6: PIC24 System Startup (Chapter 8)
- Experiment 7: LED/Switch I/O (Chapter 8)
- Experiment 8: Interrupts and Timer Introduction (Chapter 9)
- Experiment 9: Interrupt-driven Asynchronous Serial I/O andan I2C Serial EEPROM (Chapter 10)
- Experiment 10: ADC, DAC Experiments (Chapter 11)
- Experiment 11: PWM for DC Motor Control (Chapter 12)
- Hardware Debugging Checklists
- Appendix D - Notes on the C Language and the Book's PIC24 Library Functions
- Appendix E - Circuits 001
- Appendix F - References
- Appendix G - Problem Solutions to odd numbered end-of-chapter exercises (even-numbered solutions are available by email request of instructor to the authors).