SECTION VI-4: asm, err, and Object Files in PIC

The asm file is also called the source file and must have the "asm" extension. The asm file is created with a text editor such as MS-DOS EDIT or Windows Notepad. Many assemblers come with a text editor. The assembler converts the asm file's Assembly Language instructions into machine language and provides the o (object) file. The PIC assembler produces the object and error files. The object file has an ".o" extension. In modular programming, we use the linker to link many object files together to create a ready to burn hex file. Before to link any program to create a ready to run program, we must make sure that it is error free. The PIC assembler provides us the error file with the extension of ".err" and this is the file we examine to see the nature of syntax errors. The linker will not link the program until all the syntax errors are fixed. We can print the error file or use notepad to examine the nature of the errors. The we go back to the asm file and correct all the errors before we assemble it again. A sample of an error file is given below.


;PIC Assembly Language Program To Add Some Data - sampel PIC Program in Assembly Language.
;Store sum in fileReg locaion 10H
SUM EQU 10H ;RAM location 10H for sum
ORG 0H ;start at address o
MOVLW 25H ;WREG = 25
ADDLW 0x34 ;add 34H to WREG
ADDLW 11H ;add 11H to WREG
ADDLW D'18' ;W = W + 12H = 7CH
ADDLW 1CH ;W = W + 1CH = 98H
ADDLW B'00000110 ;W = W + 6 = 9EH
MOVWF SUM ;save the sum in location 10H
HERE GOTO HERE ;stay here forever
END ;end of asm source file













Sample of a PIC Error, .err file


More From