📄 1335c51.c
字号:
col=Ox-xt; //第二象限
Point(col,row,attr);
row=Oy+yt; //第三象限
Point(col,row,attr);
col=Ox+xt; //第四象限
Point(col,row,attr);
/***************45度镜象画另一半***************/
col=Ox+yt; //第一象限
row=Oy-xt;
Point(col,row,attr);
col=Ox-yt; //第二象限
Point(col,row,attr);
row=Oy+xt; //第三象限
Point(col,row,attr);
col=Ox+yt; //第四象限
Point(col,row,attr);
}
}
#endif
//显示BMP图片
void BmpDisp( uint Ox, uchar Oy, uchar width, uchar height, uchar code *pbmp )
{
uint Optr;
uchar tempCount1,tempCount2;
Optr = (uint)Oy * paraP9 + Ox;
WriteCommand( CsrDirR ); // 自动右移。
for (tempCount1=0;tempCount1<height;tempCount1++)
{
WriteCommand( CsrW ); // 光标定位指令
WriteData( (uchar)(Optr &0xff) ); // 设置光标地址CSR
WriteData( Optr /256 +BasePart2 );
WriteCommand( mWrite ); // ram写指令
for(tempCount2=0;tempCount2<width/8;tempCount2++)
{
WriteData(pbmp[tempCount1*(width/8)+tempCount2]); // 写入数据
}
Optr+=paraP9;
}
}
/*==============================================================================
; 汉字写入子程序(图形方式)。每次调用输出一个汉字
; 支持图形方式使用,完成汉字点阵码的输出。
; 携入参数: Ox,Oy....写入显示的左上角坐标,Ox是以字节单位,Oy以行扫描线单位
Ptr......汉字码,库内的排列编码,大型程序时请改用unsigned int类型
; 无返回数据。
==============================================================================*/
void PutCdotInGraph( uint Ox, uchar Oy, uchar DotWidth, uchar code *Disp)
{
uint Optr;
uchar tempCount1,tempCount2,nByte;
Optr = (uint)Oy * paraP9 + Ox;
nByte = DotWidth/8;
WriteCommand( CsrDirD ); // 自动下移
for (tempCount1=0;tempCount1<nByte;tempCount1++)
{
WriteCommand( CsrW ); // 光标定位指令
WriteData( (uchar)(Optr &0xff) ); // 设置光标地址CSR
WriteData( Optr /256 +BasePart2 );
WriteCommand( mWrite ); // ram写指令
switch(DotWidth)
{
case 16: for(tempCount2=0;tempCount2<DotWidth;tempCount2++)
{
WriteData( *Disp ); // 写入数据
Disp++;
}
break;
case 24: for(tempCount2=0;tempCount2<DotWidth;tempCount2++)
{
WriteData( *Disp ); // 写入数据
Disp++;
}
break;
}
Optr++;
}
}
#if 0
//设置光标闪烁/不显示
void SurFlash(uchar x0,uchar y0,uchar att)
{
uint iTemp;
iTemp = (uint)y0/8 * paraP9 + x0/8; // 光标位置到实际ram地址换算
WriteCommand( CsrDirR ); // 自动右移光标指向
WriteCommand( CsrW ); // 制定光标位置
WriteData( (uchar)(iTemp &0xff) ); // 设置光标地址CSR
WriteData( (uchar)(iTemp /256 + BasePart1) );
WriteCommand( CsrForm ); // 光标形状设置,代码0x5d
WriteData( 0x05 ); // 设置光标水平点为CSX=8
WriteData( 0x87 ); // 光标为块状形式,垂直点为CSY=8
WriteCommand( DispOn ); // 写入指令DISP ON/OFF代码,后续参数:
if(att==1)
WriteData( 0x57 ); // 01 01 01 10显示1~4区开显示,光标闪烁显示
else
WriteData( 0x54 );
}
#endif
void PutCdotInGraph_2( uint Ox, uchar Oy, uchar num ,uchar code *Disp)
{
uint Optr;
uchar tempCount1,tempCount2;
Optr = (uint)Oy * paraP9 + Ox;
WriteCommand( CsrDirD ); // 自动下移
for(tempCount1=0;tempCount1<num;tempCount1++)
{
WriteCommand( CsrW ); // 光标定位指令
WriteData( (uchar)(Optr &0xff) ); // 设置光标地址CSR
WriteData( Optr /256 +BasePart2 );
WriteCommand( mWrite ); // ram写指令
for(tempCount2=0;tempCount2<16;tempCount2++)
{
WriteData( *Disp ); // 写入数据
Disp++;
}
Optr++;
}
}
// ==============================================================================*/
void PutSdotInGraph( uint Ox, uchar Oy,uchar *Disp)
{
uint Optr;
Optr = (uint)Oy * paraP9 + Ox;
WriteCommand( CsrDirD ); // 自动下移
while(*Disp!=0)
{
PutCdotInGraph_2( Ox,Oy,1,Cdotlib[*Disp-43]); // 写入数据
Disp++;
Ox++;
}
}
void PutSdotInGraph_V( uint Ox, uchar Oy,uchar *Disp)
{
uint Optr;
Optr = (uint)Oy * paraP9 + Ox;
WriteCommand( CsrDirD ); // 自动下移
while(*Disp!=0)
{
PutCdotInGraph_2( Ox,Oy,1,Cdotlib[*Disp-32]); // 写入数据
Disp++;
Ox++;
}
}
void ram_clear(uint Ox, uchar Oy, uchar width, uchar height)
{
uint Optr;
uchar tempCount1,tempCount2;
Optr = (uint)Oy * paraP9 + Ox;
WriteCommand( CsrDirR ); // 自动右移。
for (tempCount1=0;tempCount1<height;tempCount1++)
{
WriteCommand( CsrW ); // 光标定位指令
WriteData( (uchar)(Optr &0xff) ); // 设置光标地址CSR
WriteData( Optr /256 +BasePart2 );
WriteCommand( mWrite ); // ram写指令
for(tempCount2=0;tempCount2<width/8;tempCount2++)
{
WriteData(0); // 写入数据
}
Optr+=paraP9;
}
}
void operation0()
{
NumDisp_816(HIGHT_V_X, HIGHT_V_Y, 5, hight_limit);
NumDisp_816(SENSITIVE_V_X, SENSITIVE_V_Y, 5, sensitive_limit);
NumDisp_816(DELAY_VALUE_X, DELAY_VALUE_Y, 5, delay_value);
}
void operation1()
{
NumDisp_816(HIGHT_V_X, HIGHT_V_Y, 1, hight_limit);
NumDisp_816(SENSITIVE_V_X, SENSITIVE_V_Y, 5, sensitive_limit);
NumDisp_816(DELAY_VALUE_X, DELAY_VALUE_Y, 5, delay_value);
}
void operation2()
{
if(hight_limit>=9000)
hight_limit-=9000;
else
hight_limit+=1000;
operation1();
}
void operation3()
{
if(hight_limit<1000)
hight_limit+=9000;
else
hight_limit-=1000;
operation1();
}
void operation4()
{
NumDisp_816(HIGHT_V_X, HIGHT_V_Y, 2, hight_limit);
}
void operation5()
{
if(hight_limit%1000>=900)
hight_limit-=900;
else
hight_limit+=100;
operation4();
}
void operation6()
{
if(hight_limit%1000<100)
hight_limit+=900;
else
hight_limit-=100;
operation4();
}
void operation7()
{
NumDisp_816(HIGHT_V_X, HIGHT_V_Y, 3, hight_limit);
}
void operation8()
{
if(hight_limit%100>=90)
hight_limit-=90;
else
hight_limit+=10;
operation7();
}
void operation9()
{
if(hight_limit%100<10)
hight_limit+=90;
else
hight_limit-=10;
operation7();
}
void operation10()
{
NumDisp_816(HIGHT_V_X, HIGHT_V_Y, 4, hight_limit);
}
void operation11()
{
if(hight_limit%10>=9)
hight_limit-=9;
else
hight_limit+=1;
operation10();
}
void operation12()
{
if(hight_limit%10<1)
hight_limit+=9;
else
hight_limit-=1;
operation10();
}
void operation13()
{
NumDisp_816(HIGHT_V_X, HIGHT_V_Y, 5, hight_limit);
NumDisp_816(SENSITIVE_V_X, SENSITIVE_V_Y, 1, sensitive_limit);
NumDisp_816(DELAY_VALUE_X, DELAY_VALUE_Y, 5, delay_value);
}
void operation14()
{
if(sensitive_limit>=9000)
sensitive_limit-=9000;
else
sensitive_limit+=1000;
operation13();
}
void operation15()
{
if(sensitive_limit<1000)
sensitive_limit+=9000;
else
sensitive_limit-=1000;
operation13();
}
void operation16()
{
NumDisp_816(SENSITIVE_V_X, SENSITIVE_V_Y, 2, sensitive_limit);
}
void operation17()
{
if(sensitive_limit%1000>=900)
sensitive_limit-=900;
else
sensitive_limit+=100;
operation16();
}
void operation18()
{
if(sensitive_limit%1000<100)
sensitive_limit+=900;
else
sensitive_limit-=100;
operation16();
}
void operation19()
{
NumDisp_816(SENSITIVE_V_X, SENSITIVE_V_Y, 3, sensitive_limit);
}
void operation20()
{
if(sensitive_limit%100>=90)
sensitive_limit-=90;
else
sensitive_limit+=10;
operation19();
}
void operation21()
{
if(sensitive_limit%100<10)
sensitive_limit+=90;
else
sensitive_limit-=10;
operation19();
}
void operation22()
{
NumDisp_816(SENSITIVE_V_X, SENSITIVE_V_Y, 4, sensitive_limit);
}
void operation23()
{
if(sensitive_limit%10>=9)
sensitive_limit-=9;
else
sensitive_limit+=1;
operation22();
}
void operation24()
{
if(sensitive_limit%10<1)
sensitive_limit+=9;
else
sensitive_limit-=1;
operation22();
}
void operation25()
{
NumDisp_816(HIGHT_V_X, HIGHT_V_Y, 5, hight_limit);
NumDisp_816(SENSITIVE_V_X, SENSITIVE_V_Y, 5, sensitive_limit);
NumDisp_816(DELAY_VALUE_X, DELAY_VALUE_Y, 1, delay_value);
}
void operation26()
{
if(delay_value>=9000)
delay_value-=9000;
else
delay_value+=1000;
operation25();
}
void operation27()
{
if(delay_value<1000)
delay_value+=9000;
else
delay_value-=1000;
operation25();
}
void operation28()
{
NumDisp_816(DELAY_VALUE_X, DELAY_VALUE_Y, 2, delay_value);
}
void operation29()
{
if(delay_value%1000>=900)
delay_value-=900;
else
delay_value+=100;
operation28();
}
void operation30()
{
if(delay_value%1000<100)
delay_value+=900;
else
delay_value-=100;
operation28();
}
void operation31()
{
NumDisp_816(DELAY_VALUE_X, DELAY_VALUE_Y, 3, delay_value);
}
void operation32()
{
if(delay_value%100>=90)
delay_value-=90;
else
delay_value+=10;
operation31();
}
void operation33()
{
if(delay_value%100<10)
delay_value+=90;
else
delay_value-=10;
operation31();
}
void operation34()
{
NumDisp_816(DELAY_VALUE_X, DELAY_VALUE_Y, 4, delay_value);
}
void operation35()
{
if(delay_value%10>=9)
delay_value-=9;
else
delay_value+=1;
operation34();
}
void operation36()
{
if(delay_value%10<1)
delay_value+=9;
else
delay_value-=1;
operation34();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -