SECTION VI-3: Assembling and Linking a PIC Program

The steps to create an executable assembly language program are mentioned below:

 

  • Use a text editor to type in a program. In the case of a PIC microcontroller, we use the MPLAB IDE, which has a text editor, assembler, linker, simulator and much more all in one software package. It is an excellent development software that supports all the PIC chips and is free. Many editors or word processors are also available that can be used to create or edit the program. Some widely used editors are the MS-DOS EDIT, and NOTEPAD in windows, which comes with all Microsoft Operating System. The editor must be able to produce an ASCII file. For assemblers, the file names follow the usual DOS conventions, but the source file has the extension ".asm". The ."asm" extension for the source file is used by an assembler.

 

  • The "asm" source file containing the program code created is fed to the PIC assembler. The assembler converts the instructions into machine code. The assembler will produce an object file and an error file. The extension for the object file is "o". The extension for the error file, which contains any syntax errors and their line numbers, is ".err". The error file can be viewed with any text editor.

 

  • Assemblers require a step called linking. The link program takes one or more object files and produces a hex file, a list file, a map file, an intermediate object file, and a debug file. The hex file has the extension ".hex", the list file extension is ".lst", the map file extension is ".map", the intermediate object file extension is ".out", and debug file extension is ".cod". After a successful link, the hex file is ready to be burned into the PIC's program ROM and is downloaded into the PIC trainers.

 

The MPLAB IDE, is windows-based program.

 

Steps to Create Assembly Language Program 

 

More From Iamtechnical.com

Advertisement:

SiteLock