akub3
Newbie level 3

mixing Assembly and C
Hi, i'm trying to mix Assembler and C using MPLAB v6.40. (ie to get the assembler code to call a c function). The file.c source code is compiling as a standalone. So is the file.asm. The errors occur when I put them together on a project and try to compile the file.asm. I have read the MPLAB, C-18, MPASM, MPLINK user guides and still can't find what is wrong. any ideas? the file.c and file.asm code is listed below after the error I get:
C:\mcc18\example\getting_started\location\location.asm:2: unable to locate 'P18F452.INC'
error 1 spawning C:\mcc18\bin\cpp18
location.c
#include <p18f452.h>
#include <math.h>
char perform_x_averaging(char xtempregister1, char xtempregister2);
void main(void)
{
}
char perform_x_averaging(auto char xtempregister1, auto char xtempregister2)
{
return ((xtempregister1 + xtempregister2) / 2);
}
location.asm
LIST P=18F452, F=INHX32 ;directive to define processor
#include <P18F452.INC> ;processor specific variable definitions
EXTERN perform_x_averaging
Main
start
movlw 0x61
movwf POSTINC1
movlw 0x65
movwf POSTINC1
rcall perform_x_averaging
END ; directive 'end of program'
Hi, i'm trying to mix Assembler and C using MPLAB v6.40. (ie to get the assembler code to call a c function). The file.c source code is compiling as a standalone. So is the file.asm. The errors occur when I put them together on a project and try to compile the file.asm. I have read the MPLAB, C-18, MPASM, MPLINK user guides and still can't find what is wrong. any ideas? the file.c and file.asm code is listed below after the error I get:
C:\mcc18\example\getting_started\location\location.asm:2: unable to locate 'P18F452.INC'
error 1 spawning C:\mcc18\bin\cpp18
location.c
#include <p18f452.h>
#include <math.h>
char perform_x_averaging(char xtempregister1, char xtempregister2);
void main(void)
{
}
char perform_x_averaging(auto char xtempregister1, auto char xtempregister2)
{
return ((xtempregister1 + xtempregister2) / 2);
}
location.asm
LIST P=18F452, F=INHX32 ;directive to define processor
#include <P18F452.INC> ;processor specific variable definitions
EXTERN perform_x_averaging
Main
start
movlw 0x61
movwf POSTINC1
movlw 0x65
movwf POSTINC1
rcall perform_x_averaging
END ; directive 'end of program'