?? lcd.c
字號:
//ICC-AVR application builder : 2006-5-29 10:59:50
// Target : M128
// Crystal: 8.0000Mhz
#include <iom128v.h>
#include <macros.h>
void clear_lcd()
{
wait_lcd();
*command_lcd = 1;
delay(4000);
}
void delay(int i)
{
while(i--);
}
void is_busy()
{
unsigned char temp;
temp = *command_lcd;
if((temp & 0x80)==0) return 1;
else return -1;
}
void wait_lcd()
{
while (is_busy());
}
void putchar(unsigned char address, unsigned char data)
{
wait_lcd();
*commad_lcd = (address | 0x80);
wait_lcd();
*data_lcd = data;
delay(40);
}
extern display_lcd()
{
unsigned char i = 0;
clear_lcd();
if(flag == 1)
{
putchar(i,"+");
i++;
}
else if (flag == -1)
{
putchar(i, "-");
i++;
}
putchar(i,"s");
i++;
putchar(i,"p");
i++;
putchar(i,"e");
i++;
putchar(i,"e");
i++;
putchar(i,"d");
i++;
putchar(i,":");
i++;
putchar(i,(char)(speed/100 + 39));
i++;
putchar(i,(char)(speed%100/10 + 39));
i++;
putchar(i,(char)(speed/10 + 39));
}
extern void lcd_init()
{
delay(4000);
*command_lcd = 0x30;
delay(100);
*command_lcd = 0x30;
delay(40);
*command_lcd = 0x30;
wait_lcd();
*command_lcd =0x30; //一行顯示,5*7點陣
wait_lcd();
*command_lcd =0x08;
wait_lcd();
*command_lcd =0x01;
wait_lcd();
*command_lcd =0x06;//AC自動增,畫面不動
delay(40);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -