DSPRelated.com
Forums

Interrupts ???

Started by tamas_harczos March 31, 2003
Hi again,

the code above is a slightly modified version of an example program
from Mr. Chassaing. My problem is the following: if I start the IRQ
(11), the code between the while brackets in main function doesn't
seem to run at all. What's wrong?

---------------------------

//Loop_intr.c Loop program using interrupt, output=input
//Comm routines and support files included in C6xdskinit.c

#define buffer_length 32000
#define Get_Switches 7-((*(int *)0x90080000>>24) & 0x07)
#define LED1_on *(int *)0x90080000 = 0x0E000000
#define LED2_on *(int *)0x90080000 = 0x0D000000
#define LED3_on *(int *)0x90080000 = 0x0B000000
#define LEDs_off *(int *)0x90080000 = 0x07000000

short far sample[buffer_length];

long int buffer_pos= 0;
char interrupt_enable= 1;

interrupt void c_int11() //interrupt service routine
{
int sample_data;
if (interrupt_enable == 0) return;

sample[buffer_pos]= sample_data= input_sample();
output_sample(sample[(buffer_pos + buffer_length/2)%
buffer_length]);

buffer_pos++;
if (buffer_pos >= buffer_length) buffer_pos= 0;
return;
}

void reset_samples(void)
{
long int i;
for (i=0; i<buffer_length; i++) sample[i]= 0;
}

void main()
{
short getstate;

reset_samples();
comm_intr(); // init DSK, codec, McBSP

while(1)
{
getstate= Get_Switches;
if (getstate>0)
{
if (getstate%1 == 0) LED1_on;
if (getstate%2 == 0) LED2_on;
if (getstate%4 == 0) LED3_on;
}
else
{
LEDs_off;
}
};
}