English Version Spanish Version French Version

A short MPASM Guide


Note: The usage of MPASM is expired, all MIOS applications have to be compiled with GPASM now!


MPASM is part of MPLAB IDE, a free available toolchain provided by Microchip, the manufacturer of the PIC microcontroller. Every time when you change the source code of a MIOS application, it has to be reassembled and converted to a .hex file - here a step by step guide:

Link to the microchip.com Download the MPLAB IDE development environment if it isn't installed on your computer.
Here a direct link to version 7.60a
Open your favourite text editor in order to edit the source files. This is a snapshot of Emacs, my preferred editor under Windows and Unix. However, not everybody finds it userfriendly - it's one of the most powerful editors (with integrated programming language and endless extensions like HTML browser, mail, newsreader, games ;-), but requires a lot of practice before it can be used efficiently. The windows version can be downloaded from here: emacs@Win.
A good alternative editor for Windows (only) is Ultraedit or the integrated editor of MPLAB.
After changes have been made in the source code, you have to open the MPASM assembler. It's located in the MCHIP_Tools directory of MPLAB
Select the .asm file which should be built and click on the "Assemble" button. The output file will get the same name with .hex extension.
If the assembler notified no errors (*), the new .hex file can now be uploaded by using MIOS Studio (see also this page).

(*) If MPASM notifies errors or warnings, the .hex file will NOT be updated! In such a case have a look into the .err file (e.g. main.err) which contains all messages and references to the incorrect parts of the code. You could also check the .lst file (e.g. main.lst) which contains the whole listing - plus errors and warnings. If you assembled "main.asm", the name of the error file is "main.err". Or if you assembled "setup_8580.asm", the filename is "setup_8580.err", etc...
A typical, and very annoying error is the one which happens, when the path to the source file is longer than 64 characters. It isn't clear to me why MPLAB still works with limitations of the Win3.1 world... the only workaround is to move the source directory to an upper path, e.g. into a separate C:\mios directory.


Note: The usage of MPASM is expired, all MIOS applications have to be compiled with GPASM now!




Last update: 2024-05-08

Copyright © 1998-2023, Thorsten Klose. All rights reserved.