Forums

NEED HELP IN C PROGRAMMING C3X

Started by zingapower May 5, 2005
salam
i am new user of tms320c3x i need to write a c program for adaptive
noise cancellation , i have to ask u people where to start off ,anyone
of who have written c programs for this dsp ,where did they learn the
basics actually i am confused in mixed assembly and c thanx


Hello Zingapower!

If you look in the C3x Compiler users guide you will find a listing of registers that need to be preserved during a function call.  The next thing you will want to do is play with some simple inline assembly.  The easiest way to do this is to create some simple functions and compile them using the 'keep asm' flag set.  You can then go back and look at the resulting ASM file.  I got started with simple math functions like the one below.  In this case, the ASM code is even embedded into the C code making it especially easy.  If you look in the DSK source files you will find a number of other examples.

Hope this helps,
Best regards

Keith Larson
DSP and Analog Consulting
Lincoln Ma, 01773 #include <math.h>
float DivHll(float A,float B)
{
  return(A/B);
}

float DivAsm(float A,float B); // C prototype of function

asm("         .global _DivAsm   ; make this label visible at all linker levels  ");
asm("_DivAsm  ldf     3.1415,R0 ; do the stuff we need to do                    ");
asm("         rets              ;                                               ");

void main(void)
{
  float A,B,C;
  A55;
  B3;
  C=DivAsm(A,B);
  C=DivHll(A,B);
}

zingapower wrote:
salam
   i am new user of tms320c3x i need to write a c program for adaptive
noise cancellation , i have to ask u people where to start off ,anyone
of who have written c programs for this dsp ,where did they learn the
basics  actually i am confused in mixed assembly and c  thanx