#1:同样的代码,仿真显示正常
#2:只要首地址写入数字,就显示不对;比如首地址写入1,那么硬件上显示的为q;若首地址写入0,那么硬件上显示的为p;
#3:请大哥们帮忙分析一下,抱拳谢过!
- --发送数据
- void LCD_dis_char(uchar x, uchar y, uchar dat)
- {
- uchar address;
- if (y == 1)
- {
- address = 0x80 + x;
- }
- else
- {
- address = 0xc0 + x;
- }
- LCD_Write_command(address);
- Lcd1602_Delay1ms(1);
- LCD_Write_data(dat);
- }
- ------------------初始化---------------------------
- void LCD_Init()
- { //LCD_Write_command(0x33);
-
- //LCD_Write_command(0x32);//复位后LCD默认是8线的;需将最后四位改成0010;也就是说低字节只要是0010就能改为4线
-
- LCD_Write_command(0x02);//同上;只要最后4位是0010即可;这一行和上一行任选其一即可;
- LCD_Write_command(0x28);//在四位线下的初始化
- LCD_Write_command(0x0C);//开显示,不显示光标
- LCD_Write_command(0x06); //写一个指针加1
- LCD_Write_command(0x01); //清屏
- Lcd1602_Delay1ms(5);
- LCD_Write_command(0x80); //设置数据指针起点
-
-
- }
- -----------main--------------
- void main()
- {
-
- uchar i = 0;
- //n = n + 0x30; //转为ASCII
- Lcd1602_Delay1ms(15);
- LCD_Init();
- for (i = 0; i < sizeof(dis_a)-1; i++)
- {
- LCD_dis_char(i, 1, dis_a[i]);Lcd1602_Delay1ms(1);
- }
- for (i = 0; i < sizeof(dis_b)-1; i++)
- {
- LCD_dis_char(i, 2, dis_b[i]);Lcd1602_Delay1ms(1);
- }
- while (1);
- }
复制代码
|