?? huaxian.c
字號(hào):
col=0;
row=2;
Putstr(STR1,12); /*第二行字符輸出,12字節(jié) */
col=0;
row=4;
Putstr(STR3,25); /*第三行字符輸出,24字節(jié) */
col=0;
row=6;
Putstr(STR4,24); /*第四行字符輸出,12字節(jié) */
/* x=0;
col=0;
row=0;
xy = 1; /*方向標(biāo)志。定為水平方向 */
Linehv(192); /*畫(huà)一條橫線(0,0)-(191,0) */
col=0;
row=15;
xy = 1;
Linehv(192); /*畫(huà)一條橫線(0,15)-(191,15) */
col=0;
row=32;
xy = 1;
Linehv(192); /*畫(huà)一條橫線(0,32)-(191,32) */
col=0;
row=1;
xy = 0; /*方向標(biāo)志。定為垂直方向 */
Linehv(31); /*畫(huà)一條豎線(0,1)-(0,31) */
col=191;
row=1;
xy = 0;
Linehv(31); /*畫(huà)一條豎線(191,1)-(191,31) */
//col=0; /*設(shè)定斜線的起點(diǎn)坐標(biāo) */
//row=63;
//Linexy(44,31); /*畫(huà)一段斜線(0,63)-(44,31) */
//col=44;
//row=31;
//Linexy(190,62); /*繼續(xù)畫(huà)斜線(44,31)-(191,63) */
while(0){
Rollscreen(x); /*定位新的顯示起始行 */
x++;
Delay(100); /*延時(shí),控制滾動(dòng)速度 */
};
/**********************************************************/
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;
}
}
}
/****************************************/
/*畫(huà)線。只提供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();
}
}
}
/****************************************/
/* 畫(huà)點(diǎn) */
/****************************************/
void point(void)
{
uint x1,y1,x,y;
x1=col;
y1=row;
row=y1>>3; /*取Y方向分頁(yè)地址 */
Rddata();
y=y1&0x07; /*字節(jié)內(nèi)位置計(jì)算 */
x=0x01;
x=x<<y; /*移入所畫(huà)點(diǎn) */
Wrdata(cbyte|x); /*畫(huà)上屏幕 */
col=x1; /*恢復(fù)xy坐標(biāo) */
row=y1;
}
/****************************************/
/* 屏幕滾動(dòng)定位 */
/****************************************/
void Rollscreen(uint x)
{
cbyte = DISPFIRST|x; /*定義顯示起始行為x?*/
WrcmdL(cbyte);
WrcmdM(cbyte);
WrcmdR(cbyte);
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -