Sei sulla pagina 1di 2

Assembler Operation

Page 1 of 2

Assembler Operation

The MPASM assembler can be used in two ways:

Operation The MPASM assembler can be used in two ways:  To generate absolute code that

To generate absolute code that can be executed directly by a microcontroller.

To generate relocatable code that can be linked with other separately assembled or compiled modules.

Generating Absolute Code

Absolute code is the default output from the MPASM assembler. This process is shown below.

from the MPASM a ssembler . This process is shown below. When a source file is

When a source file is assembled in this manner, all variables and routines used in the source file must be defined within that source file, or in files that have been explicitly included by that source file. If assembly proceeds without errors, a hex file will be generated, containing the executable machine code for the target device. This file can then be used with a debugger to test code execution or with a device programmer to program the microcontroller.

Generating Relocatable Code

The MPASM assembler also has the ability to generate a relocatable object module that can be linked with other modules using Microchip's MPLINK linker to form the final executable code. This method is very useful for creating reusable modules.

This method is very useful for creating reusable modules . Related modules can be grouped and

Related modules can be grouped and stored together in a library using Microchip's MPLIB librarian. Required libraries can be specified at link time, and only the routines that are needed will be included in the final executable.

mk:@MSITStore:C:\Program%20Files\Microchip\MPASM%20Suite\hlpMPASMAsm.chm

5/8/2009

Assembler Operation

Page 2 of 2

Assembler Op eration Page 2 of 2 Refer to Relocatable Objects for more information on the

Refer to Relocatable Objects for more information on the differences between absolute and relocatable object assembly.

between absolute and relocatable object assembly. Microchip Technology Inc. Microchip Web Site Voice: (480)

Microchip Technology Inc.

Microchip Web Site Voice: (480) 792-7200 Fax: (480) 792-7277 Microchip Technical Support

Help Updated: 12/10/08 16:11:10 Help Page: 24

mk:@MSITStore:C:\Program%20Files\Microchip\MPASM%20Suite\hlpMPASMAsm.chm

5/8/2009