//ks0108 反白功能打點函數: color=1 ,該點黑色(顯示); color=0 ,該點白色(擦除);
// 任意指定坐標畫點 ( 轉換成字節操作 , 更改坐標位的原數據值 )
void draw_point(uchar x,uchar y,uchar color)
{ //draw pixel(x : 0~192, y : 0~63) , color : 0/1
uchar temp1,temp2; // 讀出 , 寫入數據變量
read_1byte(x,y);
delay(10);
temp1=read_1byte(x,y); // 讀取坐標所在字節數據
delay(10);
if(color) // 若要求該點為黑色 ( 畫點、顯示 )
{
temp2 =0x00; // 賦初值 0000 0000
temp2|=(0x01<<(y%8)); // 根據所在行位置,將該字節對應位置1,data|0x01
temp2 =(temp2|temp1); // 修正原數據
}
else // 若要求該點為白色 ( 擦除 )
{
temp2 = 0xff; // 賦初值 1111 1111
temp2&=~(0x01<<(y%8)); // 根據所在行位置,將該字節對應位置0,data&0xfe
temp2 =(temp2|temp1); // 修正原數據
}
write_1byte(x,y,temp2); // 重新寫入原坐標值的修正值
}
|