📄 huaxian.c
字号:
col=0;
row=2;
Putstr(STR1,12); /*第二行字符输出,12字节 */
col=0;
row=4;
Putstr(STR3,25); /*第三行字符输出,24字节 */
col=0;
row=6;
Putstr(STR4,24); /*第四行字符输出,12字节 */
/* x=0;
col=0;
row=0;
xy = 1; /*方向标志。定为水平方向 */
Linehv(192); /*画一条横线(0,0)-(191,0) */
col=0;
row=15;
xy = 1;
Linehv(192); /*画一条横线(0,15)-(191,15) */
col=0;
row=32;
xy = 1;
Linehv(192); /*画一条横线(0,32)-(191,32) */
col=0;
row=1;
xy = 0; /*方向标志。定为垂直方向 */
Linehv(31); /*画一条竖线(0,1)-(0,31) */
col=191;
row=1;
xy = 0;
Linehv(31); /*画一条竖线(191,1)-(191,31) */
//col=0; /*设定斜线的起点坐标 */
//row=63;
//Linexy(44,31); /*画一段斜线(0,63)-(44,31) */
//col=44;
//row=31;
//Linexy(190,62); /*继续画斜线(44,31)-(191,63) */
while(0){
Rollscreen(x); /*定位新的显示起始行 */
x++;
Delay(100); /*延时,控制滚动速度 */
};
/**********************************************************/
void Linexy(uint endx,uint endy)
{
register uint t;
int xerr=0,yerr=0,delta_x,delta_y,distance;
int incx,incy;
/* compute the distance in both directions */
delta_x=endx-col;
delta_y=endy-row;
/* compute the direction of the increment ,
an increment of "0" means either a vertical or horizontal lines */
if(delta_x>0) incx=1;
else if( delta_x==0 ) incx=0;
else incx=-1;
if(delta_y>0) incy=1;
else if( delta_y==0 ) incy=0;
else incy=-1;
/* determine which distance is greater */
delta_x = fabs( delta_x );
delta_y = fabs( delta_y );
if( delta_x > delta_y ) distance=delta_x;
else distance=delta_y;
/* draw the line */
for( t=0;t <= distance+1; t++ ) {
point();
xerr += delta_x ;
yerr += delta_y ;
if( xerr > distance ) {
xerr-=distance;
col+=incx;
}
if( yerr > distance ) {
yerr-=distance;
row+=incy;
}
}
}
/****************************************/
/*画线。只提供X或Y方向的,不支持斜线 */
/****************************************/
void Linehv(uint length)
{
uint xs,ys;
if (xy)
{ ys = col;
for (xs=0;xs<length;xs++)
{
col = ys + xs;
point();
}
}
else
{ xs = row;
for (ys=0;ys<length;ys++)
{
row = xs + ys;
point();
}
}
}
/****************************************/
/* 画点 */
/****************************************/
void point(void)
{
uint x1,y1,x,y;
x1=col;
y1=row;
row=y1>>3; /*取Y方向分页地址 */
Rddata();
y=y1&0x07; /*字节内位置计算 */
x=0x01;
x=x<<y; /*移入所画点 */
Wrdata(cbyte|x); /*画上屏幕 */
col=x1; /*恢复xy坐标 */
row=y1;
}
/****************************************/
/* 屏幕滚动定位 */
/****************************************/
void Rollscreen(uint x)
{
cbyte = DISPFIRST|x; /*定义显示起始行为x?*/
WrcmdL(cbyte);
WrcmdM(cbyte);
WrcmdR(cbyte);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -