Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Error when mixing Assembly and C using MPLAB 6.4

Status
Not open for further replies.

akub3

Newbie level 3
Joined
Mar 26, 2004
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
46
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'
 

mixing Assembly and C

Sounds like it cant find the include file? Copy it into your working directory.
 

mixing Assembly and C

copy the include file as mentioned abpve and use the: #include "include_file.h"
syntax for convention.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top