Delay con blackfin 533

Solo disponible en BuenasTareas
  • Páginas : 3 (644 palabras )
  • Descarga(s) : 0
  • Publicado : 2 de noviembre de 2011
Leer documento completo
Vista previa del texto
#include "Talkthrough.h"

/*
We initialize the array, an implementation variable.
start is a variable which go to 1 the first time the array is full, It allow to start a delay
*/
static intarray[144000];
static int i=0;
static int start=0;

void Process_Data(void)
{
//ampDelay is parameter we use to change the amplitude of the sample,
int ampDelay=2;

static unsignedchar ucActive_LED = 0x00;
//delay is the output value
int delay;


array[i]=iChannel0LeftIn>>2; //capture the signal and shift it 2 bits
i++;


if (i>=144000)
{start=1;
}
//FlagCMode is the third button;
if(FlagCMode==0)
{
ampDelay=2;
}

if(FlagCMode==1)
{
ampDelay=4;
ucActive_LED = ucActive_LED | 0x20;}

//FlagAMode is the first button; with this button we change the number of repetitions (1,2 or 3)
switch(FlagAMode)
{

//no delay
case 0:
{ucActive_LED = 0x01;


delay=iChannel0LeftIn>>ampDelay;
}
break;
//one repetition
case 1:
{//FlagBMode is the second button; with it we change the time of the delay
switch(FlagBMode)
{
//delay of 1s
case 0:
{

ucActive_LED =0x0A;

if (i>=48000)
{
i=0;
}

//with one repetition, we add the input + the value of the array onesecond ago(we use only 48000 cells of the array)
if(start==1)
{
delay=(iChannel0LeftIn>>ampDelay)+(array[i]>>ampDelay);
}
}
break;//delay of 0.5s
case 1:
{

ucActive_LED = 0x12;

if (i>=24000)
{
i=0;...
tracking img