懷疑void LCD_SetCustomChar(char (*Table)[8])這個函數有問題,或許你根本沒寫入到CGRAM。。
你定義的Table[8][8]是二維數組,
LCD_WriteData(*(*(Table+i)+j));//讀取的是1維數據?
不知有沒有錯。給你個代碼參考測試一下:
- uchar code Word1[]={
- 0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,//一
- 0x00,0x0E,0x00,0x00,0x00,0x1F,0x00,0x00,//二
- 0x0E,0x00,0x00,0x0E,0x00,0x00,0x1F,0x00,//三
- 0x1F,0x11,0x15,0x15,0x1F,0x11,0x1F,0x00,//四
- 0x1E,0x08,0x08,0x1E,0x0A,0x0A,0x1F,0x00,//五
- 0x04,0x1F,0x00,0x0A,0x0A,0x0A,0x1B,0x00,//六
- 0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x00,//日
- 0x0F,0x09,0x0F,0x09,0x0F,0x09,0x13,0x00,//月
- 0x08,0x1F,0x12,0x0F,0x0A,0x1F,0x02,0x00};//年
- void main()
- {
- uchar num;
- uchar j;//
- Lcd_1602_init();
-
- Lcd_1602_write(0,0x40); //操作CGRAM
- for (j=0;j<64;j++)
- Lcd_1602_write(1,Word1[j]); //連續寫入64字節,8個字符, 5*7點陣按8*8計算
-
-
- while(1)
- {
-
-
- Lcd_1602_write(0,0x83); //指定顯示地址,從第一行第3個字符開始
- for(num=3;num<16;num++)
- {
- Lcd_1602_write(1,table1[num]); //連續顯示16個字符
- delay(3);
- }
- Lcd_1602_write(0,0xc0); //第2行第1個字符開始
- for(num=0;num<16;num++)
- {
- Lcd_1602_write(1,table2[num]);//顯示另一組16個字符
- delay(3);
- }
-
- Lcd_1602_write(0,0x80); //指定顯示位置
- for (j=0;j<8;j++)
- {
- Lcd_1602_write(1,j); //顯示內存1個字符
- delay(100);
- }
- for (j=0;j<8;j++)
- {
- Lcd_1602_write(1,j); //顯示內存1個字符
- delay(100);
- }
-
- Lcd_1602_write(0,0xc0); //指定顯示位置
- for (j=0;j<8;j++)
- {
- Lcd_1602_write(1,7-j); //顯示內存1個字符
- delay(100);
- }
- for (j=0;j<8;j++)
- {
- Lcd_1602_write(1,7-j); //顯示內存1個字符
- delay(100);
- }
- delay(1000);
- Lcd_1602_write(0,0x01);
- delay(500);
- }
- }
復制代碼
|