?? lcd.c
字號:
#include<AD9851_CONFIG.H>
/*顯示屏命令寫入函數*/
void LCD_write_com(unsigned char com) {
RS_CLR;
RW_CLR;
EN_SET;
LCD_DATA_PORT = com;
delay_nus(5);
EN_CLR;
}
/*顯示屏命令寫入函數*/
void LCD_write_data(unsigned char data) {
RS_SET;
RW_CLR;
EN_SET;
LCD_DATA_PORT = data;
delay_nus(5);
EN_CLR;
}
/*顯示屏清空顯示*/
void LCD_clear(void) {
LCD_write_com(0x01);
delay_nms(5);
}
/*顯示屏字符串寫入函數*/
void showstring(unsigned char x,unsigned char y,unsigned char *s) {
if (y == 0) {
LCD_write_com(0x80 + x);
}
else {
LCD_write_com(0xC0 + x);
}
while (*s) {
LCD_write_data( *s);
s ++;
}
}
/*顯示屏單字符寫入函數*/
void showchar(unsigned char x,unsigned char y,unsigned char data) {
if (y == 0) {
LCD_write_com(0x80 + x);
}
else {
LCD_write_com(0xC0 + x);
}
LCD_write_data( data);
}
/*顯示屏初始化函數*/
void LCD_init(void) {
LCD_DATA_DDR = 0xFF; /*I/O口方向設置*/
LCD_CON_DDR |= (1 <<EN_BIT) | (1 << RW_BIT) | (1 << RS_BIT);
LCD_write_com(0x38); /*顯示模式設置*/
delay_nms(5);
LCD_write_com(0x38);
delay_nms(5);
LCD_write_com(0x38);
delay_nms(5);
LCD_write_com(0x38);
LCD_write_com(0x08); /*顯示關閉*/
LCD_write_com(0x01); /*顯示清屏*/
LCD_write_com(0x06); /*顯示光標移動設置*/
delay_nms(5);
LCD_write_com(0x0C); /*顯示開及光標設置*/
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -