Digital Signal Processing Reference
In-Depth Information
// EMIF.LCD.c Core C program. Displays spectrum to LCDs through EMIF
#define IOPORT 0xA1111111
//EMIF address
int *ioport = (int *)IOPORT;
//pointer to get data out
int input, output;
//temp storage
void set_LCD_characters();
//prototypes
void send_LCD_characters();
void init_LCD();
void LCD_PUT_CMD(int data);
void LCD_PUT_CHAR(int data);
void delay();
float bandage[16];
//holds FFT array after downsizing
short k=0, j=0;
int toprow[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int botrow[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
short rowselect = 1;
//start on top row
short colselect = 0;
//start on left of LCD
#define LCD_CTRL_INIT 0x38
//initialization for LCD
#define LCD_CTRL_OFF 0x08
#define LCD_CTRL_ON 0x0C
#define LCD_AUTOINC 0x06
#define LCD_ON 0x0C
#define LCD_FIRST_LINE 0x80
#define LCD_SECOND_LINE 0xC0
//address of second line
main()
{
..
init_LCD();
//init LCD
while(1)
//infinite loop
{
for(k=0; k<16; k++){
//for 16 bands
float sum = 0;
//temp storage
for(j=0; j<8; j++)
//for 8 samples per band
sum += x1[8*k+j]; //sum up samples
bandage[k] = (sum/8); //take average
}
set_LCD_characters(); //set up character arrays
send_LCD_characters(); //put them on LCD
} //end of infinite loop
}
//end of main
interrupt void c_int11()
//ISR
{
output_sample(bandage[buffercount/16]); //out from iobuffer
..
}
void set_LCD_characters()
//to fill arrays with characters
{
int n = 0;
//temp index variable
for (n=0; n<16; n++)
{
if(bandage[n] > 40000)
//first threshold
{
toprow[n] = 0xFF;
//block character
botrow[n] = 0xFF;
}
FIGURE 10.13. Core C program using a C-coded FFT function to display the spectrum to
LCDs through EMIF ( EMIF_LCD.c ).
Search WWH ::




Custom Search