Gast
#43282
Hallo,
kennt sich jemanmd mit DSP 6711 von TI aus?
Wenn ja kannst du mir sagen wie ich einen Interrupt
freischalte oder ob das so gehen muß.
Benutze des Code Composer Studio.
Ich füge mal den Code unten an soll über die Serielle Schnittstelle
einen Sinussignal ausgeben.
//+======================================================+
//|PROGRAM: sinus.c |
//|------------------------------------------------------|
//|PURPOSE: IIR-Filter |
//| creates a sinoidual oscilation |
//| |
//|------------------------------------------------------|
//|Author: Last Code Generation |
//|W.I.G. 2003-05-15 |
//+======================================================+
#include<stdio.h>
#include <std.h>
#include <log.h>
#include <math.h>
#include <csl.h>
#include <csl_mcbsp.h>
#include <csl_irq.h>
#define SINUS
extern far LOG_Obj mylog;
/* Global stuff */
MCBSP_Handle hMcbsp;
int yaus=0;
int k=0,i=0;
float r=0.1f;
float y=0.0f;
float pred[2]={1,0}; //pred[0] is y[k-1]
//pred[1] is y[k-2]
int a=1;
/* function bodies */
float sinus(){
y=1.41421356237*pred[0]-pred[1];
pred[1]=pred[0];
pred[0]=y;
return(y);
}
float chirp(){
if(k >= 2000){ r+=0.1; k=0;pred[0]=1; pred[1]=0; }
if(r >= (3.14/2.0)) r=0.1f;
y= (1.5-r)*pred[0]-pred[1];
pred[1]=pred[0];
pred[0]=y;
k++;
return(y);
}
MCBSP_Config myConfig =
{
0x0, /* SPCR */
0x10040, /* RCR */
0x10040, /* XCR */
0x0, /* SRGR */
0x0, /* MCR */
0x0, /* RCER */
0x0, /* XCER */
0x0, /* PCR */
};
void transmit_terminated(){
//a++;
LOG_printf(&mylog,"%i\n",a);
#ifdef SINUS
y=(sinus()/1.5/a);
#else
y=(chirp()/1.5);
#endif
yaus= ((int)((0xffff>>1)*y))&0xfffe;
//LOG_printf(&mylog,"%d\n",yaus);
LOG_printf(&mylog,"%f\n",y);
MCBSP_write(hMcbsp,yaus);
}
main(void){
CSL_init();
CSL_cfgInit();
LOG_printf(&mylog,"Start");
hMcbsp = MCBSP_open(MCBSP_DEV0,MCBSP_OPEN_RESET);
MCBSP_config(hMcbsp,&myConfig);
MCBSP_start(hMcbsp, MCBSP_XMIT_START, 0);
IRQ_enable(IRQ_EVT_TINT0);
IRQ_enable(IRQ_EVT_RINT0);
IRQ_globalEnable();
#ifdef SINUS
y=(sinus()/1.5/a);
#else
y=(chirp()/1.5);
#endif
yaus= ((int)((0xffff>>1)*y))&0xfffe;
//LOG_printf(&mylog,"%d\n",yaus);
//LOG_printf(&mylog,"%f\n",y);
transmit_terminated();
LOG_printf(&mylog,"Stop");
//MCBSP_close(hMcbsp);
}