The Art of Assembly Language Programming Using PIC® Technology

Book Description

The Art of Assembly Language Programming using PIC® Technology thoroughly covers assembly language as used in programming the PIC® Microcontroller (MCU). Using the minimal instruction set, characteristic of most PIC® products, the author elaborates on the nuances of how to execute loops. Fundamental design practices are presented based on Orr’s Structured Systems Development using four logical control structures. These control structures are presented in Flowcharting, Warnier-Orr® diagrams, State Diagrams, Pseudocode, and an extended example using SysML®. Basic math instructions of Add and Subtract are presented, along with a cursory presentation of advanced math routines provided as proven Microchip® utility Application Notes.

Appendices are provided for completeness, especially for the advanced reader, including several Instruction Sets, ASCII character sets, Decimal-Binary-Hexadecimal conversion tables, and elaboration of ten ‘Best Practices.’ Two datasheets (one complete datasheet on the 10F20x series and one partial datasheet on the 16F88x series) are also provided in the Appendices to serve as an important reference, enabling the new embedded programmer to develop familiarity with the format of datasheets and the skills needed to assess the product datasheet for proper selection of a microcontroller family for any specific project.

The Art of Assembly Language Programming Using PIC® Technology is written for an audience with a broad variety of skill levels, ranging from the absolute beginner completely new to embedded control to the embedded C programmer new to assembly language.

With this book, you will be guided through the following areas:

  • Symbols and terminology used by programmers and engineers in microcontroller applications
  • Programming using assembly language through examples
  • Familiarity with design and development practices
  • Basics of mathematical knowledge in hexadecimal
  • Resources for advanced mathematical functions

Approaches to locate resources

  • Teaches how to start writing simple code, e.g., PICmicro® 10FXXX and 12FXXX
  • Offers unique and novel approaches on how to add your personal touch using PICmicro® ‘bread and butter’ enhanced mid-range 16FXXX and 18FXXX processors
  • Teaches new coding and math knowledge to help build skillsets
  • Shows how to dramatically reduce product cost by achieving 100% control
  • Demonstrates how to gain optimization over C programming, reduce code space, tighten up timing loops, reduce the size of microcontrollers required, and lower overall product cost

Table of Contents

  1. Cover image
  2. Title page
  3. Table of Contents
  4. Copyright
  5. Dedication
  6. Preface
    1. Abstract
    2. Purpose and Scope
    3. Author’s Note
    4. Dare We Call It Fun?
  7. Chapter 1: Introduction
    1. Abstract
    2. Practical Applications
    3. Why Assembly?
    4. Core Families (“Baseline,” “Midrange,” “Enhanced Midrange,” “High Performance”)
    5. Data Sheet—Walk Through
    6. Straight Line Program Implementation
    7. Looped Code Implementation
    8. Microchip Tools
    9. Microchip Microcontroller Course Information
    10. Jargon Note—Italics
    11. Word Search
    12. Binary Puzzle
    13. Further Reading
  8. Chapter 2: Microchip 8-bit architecture
    1. Abstract
    2. The Microprocessor
    3. System Clock
    4. Execution Cycle
    5. Instruction Flow Pipelining
    6. Bus for Data and Program
    7. Hardware Interfaces
    8. Hardware Organization of Memory Address Space
    9. Data Memory and File Registers
    10. Arithmetic Logic Unit (ALU) and the W Register
    11. Prototyping
    12. Word Search
    13. Puzzle: Oscillator
    14. Further Reading
  9. Chapter 3: Instruction sets
    1. Abstract
    2. Instruction Set Comparison for PICmicro 10F, 12F, 16F, 18F Controllers
    3. Common 33 Instruction Set for PICmicro Controllers
    4. Addressing
    5. Code Example
    6. Paging Consideration
    7. Word Search: Instruction Set
    8. Puzzle: Instruction Set
    9. Further Reading
  10. Chapter 4: Beginning code
    1. Abstract
    2. Subroutines
    3. Macros
    4. Elementary Programs
    5. Program Counter Addressing
    6. Application Notes
    7. Interrupts and Jump Tables (AN514)
    8. Stacks (AN534)
    9. Calculate Timing
    10. Word Search: Beginning Code
    11. Puzzle: Number Square
    12. Further Reading
  11. Chapter 5: Looping code
    1. Abstract
    2. Loops Introduction
    3. 8-Bit Sum of Data
    4. Looped Code Example
    5. Partial Straight Line Code Example
    6. Macros for Page and Bank Switching (AN586)
    7. Long Conditional Branch Vectors (AN581)
    8. Word Search: Loops Code
    9. Puzzle: Loops Code
    10. Further Reading
  12. Chapter 6: Embedded control fundamentals
    1. Abstract
    2. Embedded Control
    3. Electrical Wiring Diagrams
    4. Breadboards
    5. Basic Input and Output (I/O)
    6. Specialized Input/Output
    7. Timer Modules and Registers
    8. Development Boards
    9. Word Search: Embedded Control
    10. Puzzle: Flustered
    11. Further Reading
  13. Chapter 7: Fundamentals of good practice
    1. Abstract
    2. Structured Programming
    3. Software Design Patterns
    4. Reusable Code Guidelines
    5. Ordered Lists
    6. Structured Systems Development (SSD): Four Basic Structures
    7. Word Search: Program Design and Development
    8. Puzzle: Spiral
    9. Further Reading
  14. Chapter 8: Data and control structures
    1. Abstract
    2. Assembly Language Concepts
    3. Program Structures
    4. Data Structures
    5. Control Structures
    6. Word Search: Data Structures
    7. Puzzle: Jigsaw Sudoku 66h
    8. Further Reading
  15. Chapter 9: Logic and numbering systems
    1. Abstract
    2. Boolean Algebra
    3. Polynomial Systems
    4. Multibyte Integers
    5. Signed and Unsigned Integers
    6. Floating Point
    7. BCD as a Type
    8. ASCII—Single-Byte Characters
    9. Unicode—Multibyte Characters
    10. Word Search
    11. Puzzle: Diamond 22h
    12. Further Reading
  16. Chapter 10: Mathematical operations
    1. Abstract
    2. #Include Mathematical Routines
    3. Application Notes in Standard and High Performance Microprocessors
    4. Specific Math Utility Routines
    5. Featured 8-Bit MCU Boards
    6. Word Search: Mathematical Operations
    7. Puzzle: Number Tower
    8. Further Reading
  17. Chapter 11: Word search solution
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
  18. Puzzle Solutions
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
  19. Appendix A: Instruction Sets
    1. Baseline PIC MCU Instruction Set
    2. Comparison Table
  20. Appendix B: ASCII characters
  21. Appendix C: Decimal-binary-hexadecimal characters
  22. Appendix D: Best practices
  23. Appendix E
  24. Appendix F
  25. Index

Product Information

  • Title: The Art of Assembly Language Programming Using PIC® Technology
  • Author(s): Theresa Schousek
  • Release date: April 2019
  • Publisher(s): Newnes
  • ISBN: 9780128126189