First Technology Transfer

Standard and Advanced Technical Training, Consultancy and Mentoring

Course M301 - PIC32 Architectures and MIPS Assembly Language Programming

Duration: 5 Days

Intended Audience

This course is aimed at engineers with some understanding of microelectronics and programming who are new to the PIC32 architecture, or wish to fill in gaps in their knowledge. Some experience of assembly language on other microcontrollers will be useful background for an understanding of the more advanced concepts presented during this course.

Synopsis

This hands-on course aims to provide engineers with an understanding of the enhanced PIC32 family of microcontrollers and experience of using Microchip development tools to create and debug simple and more complex assembly language programs. The emphasis is on providing a solid foundation of knowledge of the architecture and features of this range of microcontrollers, together with practical experience of the development tools, MPLABX and the XC32 compiler tool suite, and the steps required to embark on a new development. The course covers various aspects of the MIPS instruction set in detail, and shows how the MIPS processors architecture design has been incorporated into the PIC32. The Floating point unit in the PIC32MZ family of PIC32 Microcontrollers is also covered.

The course includes many practical workshop exercises which are interleaved with the relevant presentation material for maximum impact and variety. These exercises are carried out using the MPLABX IDE together with the ICD3 debugger. Practical exercises include learning how to

  • Program object code into a target PIC32 microcontroller using MPLABX and ICD3
  • Create, build and debug new assembly language projects using MPLABX and XC32 Assembler and ICD3
  • How the components of an assembly source file fit together
  • How to set the PIC32 configuration options appropriately for the target system
  • How to usse digital I/O ports to interact with the outside world
  • How to manipulate data memory using direct and indirect addressing
  • How to create time delays using software loops and hardware timers
  • How to take advantage of interrupts to handle events in the background
  • How to develop structured assembly language code by means of careful design and judicious use of Macros and functions
  • How to explore MIPS Assembler programming using the QtSPIM Simulator

Course Outline

  • Overview of Development Tools
    • Microchip development software: MPLABX, PIC32 Debug Simulator and associated tools
    • Microchip In-Circuit Debugger (ICD3) and In-Circuit Emulator (ICE) hardware
    • Device programmers, and the design option of In-Circuit Serial Programming (ICSP)
    • Demonstration boards and kits
    • Third-party development tools
    • Introduction to JTAG and overview of JTAG tools
    • QtSPIM MIPS Simulator
  • The PIC32 Architecture
    • Harvard versus Von Neumann architecture
    • Organisation of program and data memory
    • Op-codes and addressing modes
    • Stack operations and interrupts
    • On-chip peripherals and clock options
  • The XC32 PIC32 Assembler
    • Assembler directives and op-codes
    • Programming style - use of templates and comments
    • Debugging assembly code using MPLABX, PIC32 MIPS simulator debugger and ICD3
    • Interrupt service routines - how to create handlers using assembly code
    • Structuring code using functions and macros
    • Modular programming - multiple file projects, modules and interfaces
    • Programming function calls using C language compatible function calling conventions
    • Understanding the GNU assembler conventions and directives
    • Learning common patterns and idioms for assembly code optimisation
    • DSP Programming in MIPS assembler
    • Assembly language coding of the Floating Point Maths Unit on relevant PIC32s