t6963c的c51程序
//= Mode 1:顯示 0:清除該點
**********************************/
Pixel(unsigned char PointX,unsigned char PointY, bit Mode)
{
unsigned int StartAddr;
unsigned char dat;
StartAddr=(uint)PointX*30 + PointY/8 + grhome;
dat=LC_BIT_OP+7-PointY%8; //生產(chǎn)位操作命令畫點的數(shù)據(jù)
if(Mode) dat=dat|0x08;
wr_cmd_2(LC_ADD_POS,StartAddr);//設(shè)置該點所在單元地址
wr_cmd_0(dat); // 利用位操作命令畫點
}
/**********************************
//= 函數(shù)原型: void line( unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, bit Mode)
//= 功 能: 劃線函數(shù)
//= 參 數(shù): 坐標(biāo)1,坐標(biāo)2,顯示點或清除點
//= 返 回 值:
//= 函數(shù)性質(zhì):私有函數(shù)
//= 其它:顯示點陣不超過255*255
/**********************************/
void line( unsigned char y1,unsigned char x1, unsigned char y2,unsigned char x2, bit Mode)
{
unsigned char x,y;
float k,b;
if( abs(y1-y2) = abs(x1-x2) ) // |k|=1
{
k=((float)y2-y1) / ((float)x2-x1) ;
b=y1-k*x1;
if( x1 = x2 )
{
for(x=x1;x=x2;x++)
{
y=(uchar)(k*x+b);
Pixel(x, y, Mode);
}
}
else
{
for(x=x2;x=x1;x++)
{
y=(uchar)(k*x+b);
Pixel(x, y, Mode);
}
}
}
else // abs(y1-y2) > abs(x1-x2) |K|>1
{
k=((float)x2-x1) / ((float)y2-y1) ;
b=x1-k*y1;
if( y1 = y2 )
{
for(y=y1;y=y2;y++)
{
x=(uchar)(k*y+b);
Pixel( x , y,Mode );
}
}
else
{
for(y=y2;y=y1;y++)
{
x=(uchar)(k*y+b);
Pixel( x , y,Mode );
}
}
}
}
/**********************************
//= 函數(shù)原型: void ShowChar(uchar row,uchar col,uchar ch)
//= 功 能: 在指定行列顯示8*16字符
//= 參 數(shù): 坐標(biāo)行,坐標(biāo)列,字符串指針
//= 返 回 值:
//= 函數(shù)性質(zhì):公有函數(shù)
//=其它:所有可顯示字符不超過128個,否則本函數(shù)有溢出的可能
**********************************/
void showchar(uchar col,uchar row,uchar *chp)
{
#define hzp chp
uchar char_sequence_number;
uchar ascii_num;
row/=8;col/=8;
while (*chp != '