I wrote the following code:-
main.c
#include<msp430.h>
extern void param(int);
extern int ret1(int);
extern void mult1(void);
void main()
{
WDTCTL = WDTPW + WDTHOLD; //holding watchdog timer
P1DIR = 0X03;
P1OUT = 0X00;
int a = 0x01; //variables
int b;
while(1)
{
P1OUT = 0X00;
__delay_cycles(600000);
param(a); //only one parameter is passed which will be through R12
__delay_cycles(600000);
b = ret1(0x02); //here value is returned from asm program
P1OUT = b;
__delay_cycles(600000);
mult1();
__delay_cycles(600000);
}
}
//function to be called from the asm program
unsigned long mult(unsigned int x, unsigned int y)
{
return 1;
}
sample1.s43
#include "msp430.h"
RSEG CODE
;...............................................................................
PUBLIC param
EXTERN mult ;to be called from the C function
param mov.b R12,&P1OUT
RET
PUBLIC ret1
ret1 mov.b R12,R13
mov.b R13,R12
ret
PUBLIC mult1
mult1 mov.b #01h,R12
mov.b #03h,R14
call #mult ;calling mult function of C program
mov.b R12,&P1OUT
ret
END
In this program when I am calling the mult function of .c file from mult1 of the assembler file, it is getting halted at that point only. Please help me debug this problem.