 1994-2013 Microchip Technology Inc. DS33014L MPASM™ Assembler, MPLINK™ Object

 1994-2013 Microchip Technology Inc. DS33014L MPASM™ Assembler, MPLINK™ Object Linker, MPLIB™ Object Librarian User’s Guide DS33014L-page 2  1994-2013 Microchip Technology Inc. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Note the following details of the code protection feature on Microchip devices: • Microchip products meet the specification contained in their particular Microchip Data Sheet. • Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. • There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. • Microchip is willing to work with the customer who is concerned about the integrity of their code. • Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.” Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified. QUALITY MANAGEMENT SYSTEM CERTIFIED BY DNV == ISO/TS 16949 == Trademarks The Microchip name and logo, the Microchip logo, dsPIC, FlashFlex, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, PIC32 logo, rfPIC, SST, SST Logo, SuperFlash and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MTP, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries. Analog-for-the-Digital Age, Application Maestro, BodyCom, chipKIT, chipKIT logo, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, REAL ICE, rfLAB, Select Mode, SQI, Serial Quad I/O, Total Endurance, TSHARC, UniWinDriver, WiperLock, ZENA and Z-Scale are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. GestIC and ULPP are registered trademarks of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries. All other trademarks mentioned herein are property of their respective companies. © 1994-2013, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. ISBN: 978-1-62077-002-3 ASSEMBLER/LINKER/LIBRARIAN USER’S GUIDE  1994-2013 Microchip Technology Inc. DS33014L-page 3 Table of Contents Preface ........................................................................................................................................ 9 PIC1X MCU Language Tools and MPLAB X IDE ................................................................... 17 PIC1X MCU Language Tools and MPLAB IDE v8 .................................................................. 33 Part 1 – MPASM Assembler Chapter 1. MPASM Assembler Overview 1.1 Introduction ....................................................................................................................................... 49 1.2 MPASM Assembler Defined ............................................................................................................. 49 1.3 How MPASM Assembler Helps You ................................................................................................. 49 1.4 Assembler Migration Path ................................................................................................................ 49 1.5 Assembler Compatibility Issues ....................................................................................................... 50 1.6 Assembler Operation ........................................................................................................................ 50 1.7 Assembler Input/Output Files ........................................................................................................... 52 Chapter 2. Assembler Interfaces 2.1 Introduction ....................................................................................................................................... 61 2.2 MPLAB X IDE Interface .................................................................................................................... 61 2.3 MPLAB IDE v8 Interface .................................................................................................................. 61 2.4 Windows Interface ............................................................................................................................ 62 2.5 Command Line Interface .................................................................................................................. 63 Chapter 3. Expression Syntax and Operation 3.1 Introduction ....................................................................................................................................... 65 3.2 Text Strings ...................................................................................................................................... 65 3.3 Reserved Words and Section Names .............................................................................................. 67 3.4 Numeric Constants and Radix .......................................................................................................... 67 3.5 Arithmetic Operators and Precedence ............................................................................................. 69 Chapter 4. Directives 4.1 Introduction ....................................................................................................................................... 71 4.2 Directives by Type ............................................................................................................................ 71 4.3 access_ovr - Begin an Object File Overlay Section in Access RAM (PIC18 MCUs) .................... 74 4.4 __badram - Identify Unimplemented RAM ...................................................................................... 75 4.5 __badrom - Identify Unimplemented ROM ...................................................................................... 76 4.6 bankisel - Generate Indirect Bank Selecting Code (PIC12/16 MCUs) ......................................... 77 4.7 banksel - Generate Bank Selecting Code ...................................................................................... 80 4.8 cblock - Define a Block of Constants ............................................................................................. 82 4.9 code - Begin an Object File Code Section ....................................................................................... 84 4.10 code_pack - Begin an Object File Packed Code Section (PIC18 MCUs) .................................... 85 4.11 __config - Set Processor Configuration Bits ............................................................................... 86 4.12 config - Set Processor Configuration Bits (PIC18 MCUs) ........................................................... 88 4.13 constant - Declare Symbol Constant .......................................................................................... 89 4.14 da - Store Strings in Program Memory (PIC12/16 MCUs) ............................................................. 90 4.15 data - Create Numeric and Text Data ........................................................................................... 92 4.16 db - Declare Data of One Byte ....................................................................................................... 94 Assembler/Linker/Librarian User’s Guide DS33014L-page 4  1994-2013 Microchip Technology Inc. 4.17 de - Declare EEPROM Data Byte ..................................................................................................96 4.18 #define - Define a Text Substitution Label ..................................................................................98 4.19 dt - Define Table (PIC12/16 MCUs) ............................................................................................100 4.20 dtm - Define Table (Extended PIC16 MCUs Only) .......................................................................100 4.21 dw - Declare Data of One Word ....................................................................................................101 4.22 else - Begin Alternative Assembly Block to if Conditional .......................................................102 4.23 end - End Program Block .............................................................................................................103 4.24 endc - End an Automatic Constant Block ....................................................................................103 4.25 endif - End Conditional Assembly Block ....................................................................................104 4.26 endm - End a Macro Definition .....................................................................................................104 4.27 endw - End a while Loop ............................................................................................................105 4.28 equ - Define an Assembler Constant ...........................................................................................105 4.29 error - Issue an Error Message .................................................................................................106 4.30 errorlevel - Set Message Level ..............................................................................................108 4.31 exitm - Exit from a Macro ...........................................................................................................111 4.32 expand - Expand Macro Listing ...................................................................................................113 4.33 extern - Declare an Externally Defined Label ............................................................................114 4.34 fill - Specify Program Memory Fill Value .................................................................................116 4.35 global - Export a Label ..............................................................................................................119 4.36 idata - Begin an Object File Initialized Data Section ..................................................................120 4.37 idata_acs - Begin an Object File Initialized Data Section in Access RAM (PIC18 MCUs) .......122 4.38 __idlocs - Set Processor ID Locations ......................................................................................123 4.39 if - Begin Conditionally Assembled Code Block .........................................................................125 4.40 ifdef - Execute If Symbol Has Been Defined .............................................................................127 4.41 ifndef - Execute If Symbol Has Not Been Defined ....................................................................129 4.42 #include - Include Additional Source File ..................................................................................130 4.43 list - Listing Options ..................................................................................................................131 4.44 local - Declare Local Macro Variable .........................................................................................132 4.45 macro - Declare Macro Definition ................................................................................................134 4.46 __maxram - Define Maximum RAM Location ...............................................................................136 4.47 __maxrom - Define Maximum ROM Location ..............................................................................137 4.48 messg - Create User Defined Message .......................................................................................138 4.49 noexpand - Turn off Macro Expansion ........................................................................................140 4.50 nolist - Turn off Listing Output ..................................................................................................140 4.51 org - Set Program Origin .............................................................................................................141 4.52 page - Insert Listing Page Eject ...................................................................................................144 4.53 pagesel - Generate Page Selecting Code (PIC10/12/16 MCUs) ...............................................144 4.54 pageselw - Generate Page Selecting Code Using WREG Commands (PIC10/12/16 MCUs) ...146 4.55 processor - Set Processor Type ...............................................................................................147 4.56 radix - Specify Default Radix .....................................................................................................148 4.57 res - Reserve Memory .................................................................................................................150 4.58 set - Define an Assembler Variable ............................................................................................152 4.59 space - Insert Blank Listing Lines ................................................................................................153 4.60 subtitle - Specify Program Subtitle ..........................................................................................153 4.61 title - Specify Program Title .....................................................................................................154 4.62 udata - Begin an Object File Uninitialized Data Section .............................................................154 4.63 udata_acs - Begin an Object File Access Uninitialized Data Section (PIC18 MCUs) ................156 4.64 udata_ovr - Begin an Object File Overlayed Uninitialized Data Section ...................................158 4.65 udata_shr - Begin an Object File Shared Uninitialized Data Section (PIC12/16 MCUs) ...........160 4.66 #undefine - Delete a Substitution Label ....................................................................................162 4.67 variable - Declare Symbol Variable ..........................................................................................163 4.68 while - Perform Loop While Condition is True ............................................................................165 Table of Contents  1994-2013 Microchip Technology Inc. DS33014L-page 5 Chapter 5. Assembler Examples, Tips and Tricks 5.1 Introduction ..................................................................................................................................... 169 5.2 Example of Displaying Count on Ports ........................................................................................... 170 5.3 Example of Port B Toggle and Delay Routines .............................................................................. 171 5.4 Example of Calculations uploads/S4/ user-guide-mplab.pdf

  • 21
  • 0
  • 0
Afficher les détails des licences
Licence et utilisation
Gratuit pour un usage personnel Attribution requise
Partager
  • Détails
  • Publié le Mai 05, 2021
  • Catégorie Law / Droit
  • Langue French
  • Taille du fichier 3.1347MB