Assemblers for PIC® and AVR® Microcontrollers
Contents
PIC® Microcontroller Assembler
The MPLAB® XC8 PIC® Assembler may be used with MPLAB X IDE or Microchip Studio for 8-bit assembly-code projects and solutions. The assembler is bundled with the MPLAB XC8 C compiler.
- Introduction to the MPLAB XC8 PIC Assembler
- MPLAB XC8 PIC Assembler User's Guide
- MPASM™ to MPLAB XC8 PIC Assembler Migration Guide
- MPLAB XC8 PIC Assembler User's Guide for Embedded Engineers
AVR® Microcontroller Assembler
The AVR® Assembler (avrasm2) may be used with MPLAB X IDE or Microchip Studio for 8-bit assembly-code projects and solutions. The assembler is bundled with Microchip Studio. (Older version may be found with Atmel Studio.)
- AVR Assembler - Command line usage
Using AVR Assembler with MPLAB® X IDE Projects
Overview
When using the AVR Assembler, only the main project file should be enabled in the project configuration; all other files should be excluded. The other project files should be included in the main file using the .INCLUDE assembler directive.
Step-by-Step Tutorial
Identify the AVR Assembler to MPLAB X IDE
Open MPLAB X IDE and go to Tools > Options > Embedded > Build Tools. Look for "avrasm2" in the Toolchain list. If you do not see it, click Add and locate the file on your computer. The assembler is bundled with Microchip Studio.
Create an Assembly Project
Select File > New Project to open the New Project wizard.
- Choose Project: Select the Microchip Embedded category and Standalone Project project.
- Select Device: Choose an AVR device (ATtiny, ATmega, or ATxmega) from the drop-down list. Then select your debug tool.
- Select Header: N/A
- Select Plugin Board: N/A
- Select Compler: Choose an avrasm2 version from the list (see image).
- Select Project Name and Folder: Give your project a name and select a folder location.
Create Assembly Project Files
In the Project tree, right-click on the Source Files folder and select New > Other to open the New File wizard (see image).
- Choose File Type: Select the Assembler category and AssemblyFile.asm file type.
- Name and Location: Give your file a name and select a folder location.
Repeat for each file. Note that once you have created the first file, "AssemblyFile.asm" will appear in the "New" submenu for selection.
Include Only Main File in Project
In the Project tree, right-click on the project name and select Properties to open the Project Properties window.
- Select the File Inclusion/Exclusion category.
- Ensure that only your main file (here called main.asm) is under Included files and all other project files are under Excluded files. To move a file, select it and then click > (see image). To move several files, select them and then click ».
Once files are excluded, they appear grayed in the project tree.
Use .INCLUDE Directive to Build
Since only the main file is included in the project configuration, the other files will not build until you use the .INCLUDE directive in the main file to include them (see image).