本帖最后由 konglingfei0615 于 2013-8-16 08:07 编辑
最近在学习12864液晶,写了个画点程序,有点问题。每次画一个点,但是屏幕上确显示很多点,这是什么原因?
/*******************************************
函数名称:LCD_DrawDot
功 能:在任意位置绘制点
参 数:点的位置坐标(uchar x,uchar y)
返回值 :无
********************************************/
void LCD_DrawDot(uchar x,uchar y)
{
uchar x_byte,x_bit,y_ping,y_bit;
uchar tempH,tempL;
LCD_Write(0x30,0);
Delayus(72);
LCD_Write(0x06,0);
Delayus(72);
LCD_Write(0x0c,0);
Delayus(72);
LCD_Write(0x01,0);
Delayus(72);
LCD_Write(0x36,0);//打开扩展指令
Delayus(72);
LCD_Write(0x34,0);//关绘图显示
Delayus(72);
x_byte = x / 16;
x_bit = x % 16;
y_ping = y / 32;
y_bit = y % 32;
LCD_Write(0x80 + y_bit,0);
LCD_Write(0x80 + x_byte + 8*y_ping,0);
tempH = LCD_Read();
tempH = LCD_Read();
tempL = LCD_Read();
Delayus(2);
LCD_Write(0x80 + y_bit,0);
LCD_Write(0x80 + x_byte + 8*y_ping,0);
Delayus(1);
if(x_bit < 8)
{
LCD_Write(tempH|(0x01<<(7-x_bit)),1);
LCD_Write(tempL,1);
}
else
{
LCD_Write(tempH,1);
LCD_Write(tempL|(0x01<<(15-x_bit)),1);
}
LCD_Write(0x36,0);
Delayus(72);
LCD_Write(0x30,0);
Delayus(72);
}
|