Transcription of MPLAB XC8 PIC Assembler User's Guide - Microchip …
1 MPLAB XC8 PIC Assembler User's Guide Notice to Customers All documentation becomes dated and this manual is no exception. Microchip tools and documentation are constantly evolving to meet customer needs, so some actual dialogs and/or tool descriptions can differ from those in this document. Please refer to our web site ( ) to obtain the latest documentation available. Documents are identified with a DS number. This number is located on the bottom of each page, in front of the page number. The numbering convention for the DS number is DSXXXXXA, where XXXXX is the document number and A is the revision level of the document. For the most up-to-date information on development tools, see the MPLAB IDE online help.
2 Select the Help menu, and then Topics to open a list of available online help files. 2020 Microchip Technology Inc. User Guide DS50002974A-page 1. Table of Contents Notice to 1. Conventions Used in This Recommended Document Revision 5. 2. Assembler 6. Device 6. Compatible Development 3. Assembler Single-step Multi-step 7. Assembler Option 8. 4. MPLAB XC8 Assembly 19. Assembly Instruction 19. Statement 23. 23. Program Assembler 5. Assembler 45. Preprocessor 45. Assembler -provided Default Linker 46. Linker-Defined 48. Assembly List 6. 50. Psects and Map 7. 61. 62. The Microchip Product Change Notification Customer 76. 2020 Microchip Technology Inc. User Guide DS50002974A-page 2. Microchip Devices Code Protection 76.
3 Legal 76. 77. Quality Management 77. Worldwide Sales and 2020 Microchip Technology Inc. User Guide DS50002974A-page 3. Preface 1. Preface Conventions Used in This Guide The following conventions may appear in this documentation: Table 1-1. Documentation Conventions Description Represents Examples Arial font: . Italic characters Referenced books MPLAB IDE User's Guide Emphasized text ..is the only Initial caps A window the Output window A dialog the Settings dialog A menu selection select Enable Programmer Quotes A field name in a window or dialog Save project before build . Underlined, italic text with right A menu path File>Save angle bracket Bold characters A dialog button Click OK. A tab Click the Power tab N Rnnnn A number in verilog format, where 4 b0010, 2 hF1.
4 N is the total number of digits, R is the radix and n is a digit. Text in angle brackets < > A key on the keyboard Press <Enter>, <F1>. Courier New font: Plain Courier New Sample source code #define START. Filenames File paths c:\mcc18\h Keywords _asm, _endasm, static Command-line options -Opa+, -Opa- Bit values 0, 1. Constants 0xFF, A'. Italic Courier New A variable argument , where file can be any valid filename Square brackets [ ] Optional arguments mcc18 [options] file [options]. Curly brackets and pipe Choice of mutually exclusive errorlevel {0|1}. character: { | } arguments; an OR selection Replaces repeated text var_name [, ]. Represents code supplied by user void main (void). { .. }. 2020 Microchip Technology Inc.
5 User Guide DS50002974A-page 4. Preface Recommended Reading This User's Guide describes the use and features of the MPLAB XC8 PIC Assembler . The following Microchip documents are available and recommended as supplemental reference resources. MPLAB XC8 PIC Assembler Migration Guide This Guide is for customers who have MPASM projects and who wish to migrate them to the MPLAB XC8 PIC. Assembler . It describes the nearest equivalent Assembler syntax and directives for MPASM code. MPLAB XC8 PIC Assembler Guide For Embedded Engineers This Guide is a getting started Guide , describing example projects and commonly used coding sequences used by the MPLAB XC8 PIC Assembler . Use this Guide if you need to develop new projects using the Assembler .
6 MPLAB XC8 C Compiler Release Notes for PIC MCU. For the latest information on changes and bug fixes to this Assembler , read the Readme file in the docs subdirectory of the MPLAB XC8 installation directory. Development Tools Release Notes For the latest information on using other development tools, read the tool-specific Readme files in the docs subdirectory of the MPLAB X IDE installation directory. Document Revision History Revision A (March 2020). Initial release of this document, based on the Assembler chapter from the MPLAB XC8 C Compiler User's Guide (DS50002737). 2020 Microchip Technology Inc. User Guide DS50002974A-page 5. Assembler Overview 2. Assembler Overview The MPLAB XC8 PIC Assembler is a free-standing cross Assembler and linker package, supporting all 8-bit PIC.
7 Microcontrollers. Device Description This Guide describes the MPLAB XC8 PIC Assembler 's support for all 8-bit Microchip PIC devices with baseline, mid- range, enhanced mid-range and PIC18 cores. The following descriptions indicate the distinctions within those device cores: The baseline core uses a 12-bit-wide instruction set and is available in PIC10, PIC12 and PIC16 part numbers. The enhanced baseline core also uses a 12-bit instruction set, but this set includes additional instructions. Some of the enhanced baseline chips support interrupts and the additional instructions used by interrupts. These devices are available in PIC12 and PIC16 part numbers. The mid-range core uses a 14-bit-wide instruction set that includes more instructions than the baseline core.
8 It has larger data memory banks and program memory pages, as well. It is available in PIC12, PIC14 and PIC16 part numbers. The Enhanced mid-range core also uses a 14-bit-wide instruction set but incorporates additional instructions and features. There are both PIC12 and PIC16 part numbers that are based on the Enhanced mid-range core. The PIC18 core instruction set is 16 bits wide and features additional instructions and an expanded register set. PIC18 core devices have part numbers that begin with PIC18. See Print-devices for information on finding the full list of devices that are supported by the Assembler . Compatible Development Tools The Assembler works with many other Microchip tools, including: The MPLAB X IDE ( ).
9 The MPLAB X Simulator The Command-line MDB Simulator see the Microchip Debugger (MDB) User's Guide (DS52102). All Microchip debug tools and programmers ( ). Demonstration boards and Starter kits that support 8-bit devices 2020 Microchip Technology Inc. User Guide DS50002974A-page 6. Assembler Driver 3. Assembler Driver The name of the command-line driver used by the MPLAB XC8 PIC Assembler is pic-as. This driver can be invoked to perform both assembly and link steps and is the application called by development environments, such as the MPLAB X IDE, to build assembly projects. The pic-as driver has the following basic command format: pic-as [options] files [libraries]. Throughout this manual, it is assumed that the Assembler applications are in your console's search path or that the full path is specified when executing the application.
10 It is customary to declare options (identified by a leading dash - or double dash -- ) before the files' names;. however, this is not mandatory. The formats of the options are supplied in Assembler Option Descriptions along with corresponding descriptions of the options' function. The files can be an assortment of Assembler source files and precompiled intermediate files. While the order in which these files are listed is not important, it can affect the allocation of code or data and can affect the names of some of the output files. The libraries is a list of user-defined library files that will be searched by the compiler. The order of these files will determine the order in which they are searched.