Digital Signal Processing Reference
In-Depth Information
else if(bandage[n] > 20000)
//second threshold
{
toprow[n] = 0x20;
//blank space
botrow[n] = 0xFF;
}
else
//below second threshold
{
toprow[n] = 0x20;
botrow[n] = 0x20;
}
}
}
void send_LCD_characters()
{
int m=0;
LCD_PUT_CMD(LCD_FIRST_LINE);
//start address
for (m=0; m<16; m++)
//display top row
LCD_PUT_CHAR(toprow[m]);
LCD_PUT_CMD(LCD_SECOND_LINE);
//second line
for (m=0; m<16; m++)
//display bottom row
LCD_PUT_CHAR(botrow[m]);
}
void init_LCD()
{
LCD_PUT_CMD(LCD_CTRL_INIT);
//put command
LCD_PUT_CMD(LCD_CTRL_OFF);
//off display
LCD_PUT_CMD(LCD_CTRL_ON);
//turn on
LCD_PUT_CMD(0x01);
//clear display
LCD_PUT_CMD(LCD_AUTOINC);
//set address mode
LCD_PUT_CMD(LCD_CTRL_ON);
//set it
}
void LCD_PUT_CMD(int data)
{
*ioport = (data & 0x000000FF);
//RS=0, RW=0
delay();
*ioport = (data | 0x20000000);
//bring enable line high
delay();
*ioport = (data & 0x000000FF);
//bring enable line low
delay();
}
void LCD_PUT_CHAR(int data)
{
*ioport = ((data & 0x000000FF)| 0x80000000); //RS=1, RW=0
*ioport = ((data & 0x000000FF)| 0xA0000000); //enable high
*ioport = ((data & 0x000000FF)| 0x80000000); //enable Low
delay();
}
void delay()
//create 1 ms delay
{
int q=0, junk=2;
for (q=0; q<8000; q++)
junk = junk*junk;
}
FIGURE 10.13. ( Continued )
Search WWH ::




Custom Search