📄 text1.c
字号:
{
ha=find4;
hb=ha+sizeof(find4)/sizeof(find4[0]);
}
else if(n==5)
{
ha=find5;
hb=ha+sizeof(find5)/sizeof(find5[0]);
}
else if(n==6)
{
ha=find6;
hb=ha+sizeof(find6)/sizeof(find6[0]);
}
while(ha<hb)
{
for(i=0;i<n;i++)
{
if(*(in+i)!=*((*ha).num+i))
{
break;
}
}
if(i==n&&cx<6)
{
p[cx]=ha;
cx++;
}
ha++;
}
if(cx==0)
{
cx=re;
length--;
}
}
void out()
{
uchar i,locx,locy,j,k,l,aa,bb,max,min;
aa=cs1_12864;
bb=cs2_12864;
if((cx*length)>16)
{
if(((staren+1)*length)<=16)
{
min=0;
max=cx;
while((max*length)>16)
max--;
}
else
{
max=cx;
min=cx;
while((min*length)>16)
min--;
}
}
else
{
max=cx;
min=0;
}
cs1_12864=0;
cs2_12864=1;
locx=col_12864;
locy=row_12864+6;
for(l=min;l<max;l++)
{
for(i=0;i<length;i++)
{
k=0;
write_command_12864(locx);
write_command_12864(locy);
for(j=0;j<8;j++)
{
if(l==staren)
write_data_12864(~asc[(*(p[l]->zimu+i)-'a')*16+(k++)]);
else
write_data_12864(asc[(*(p[l]->zimu+i)-'a')*16+(k++)]);
}
locy++;
write_command_12864(locx);
write_command_12864(locy);
for(j=0;j<8;j++)
{
if(l==staren)
write_data_12864(~asc[(*(p[l]->zimu+i)-'a')*16+(k++)]);
else
write_data_12864(asc[(*(p[l]->zimu+i)-'a')*16+(k++)]);
}
if(locx>(col_12864+54))
{
cs1_12864=1;
cs2_12864=0;
locx=col_12864;
}
else
locx+=8;
locy--;
}
}
cs1_12864=aa;
cs2_12864=bb;
}
void outen(struct index *pz,uchar n)
{
uchar i,locx,locy,j,k,aa,bb;
aa=cs1_12864;
bb=cs2_12864;
cs1_12864=0;
cs2_12864=1;
locx=col_12864;
locy=row_12864+6;
for(i=0;i<n;i++)
{
k=0;
write_command_12864(locx);
write_command_12864(locy);
for(j=0;j<8;j++)
{
write_data_12864(asc[(*(pz->zimu+i)-'a')*16+(k++)]);
}
locy++;
write_command_12864(locx);
write_command_12864(locy);
for(j=0;j<8;j++)
{
write_data_12864(asc[(*(pz->zimu+i)-'a')*16+(k++)]);
}
locx+=8;
locy--;
}
cs1_12864=aa;
cs2_12864=bb;
}
void qing()
{
uchar i,aa,bb;
aa=cs1_12864;
bb=cs2_12864;
cs1_12864=0;
cs2_12864=1;
write_command_12864(col_12864);
write_command_12864(row_12864+6);
for(i=0;i<64;i++)
write_data_12864(0);
write_command_12864(col_12864);
write_command_12864(row_12864+7);
for(i=0;i<64;i++)
write_data_12864(0);
cs1_12864=1;
cs2_12864=0;
write_command_12864(col_12864);
write_command_12864(row_12864+6);
for(i=0;i<64;i++)
write_data_12864(0);
write_command_12864(col_12864);
write_command_12864(row_12864+7);
for(i=0;i<64;i++)
write_data_12864(0);
cs1_12864=aa;
cs2_12864=bb;
}
uint minn(uint x)
{
uint i;
i=x/6;
return(i*6);
}
uint maxn(uint x)
{
uint i;
i=x/6;
return(i*6+6);
}
void outch(struct index *pz,uchar n)
{
uchar i,j,k,aa,bb,l;
uint min,max;
aa=cs1_12864;
bb=cs2_12864;
cs1_12864=0;
cs2_12864=1;
min=minn(n);
max=maxn(n);
l=0;
for(i=min;i<max;i++)
{
k=0;
if(i==min+4)
{
cs1_12864=1;
cs2_12864=0;
l=0;
}
write_command_12864(col_12864+16*l);
write_command_12864(row_12864+6);
for(j=0;j<16;j++)
{
if(i==n)
write_data_12864(~pz->py[i*32+(k++)]);
else
write_data_12864(pz->py[i*32+(k++)]);
}
write_command_12864(col_12864+16*l);
write_command_12864(row_12864+7);
for(j=0;j<16;j++)
{
if(i==n)
write_data_12864(~pz->py[i*32+(k++)]);
else
write_data_12864(pz->py[i*32+(k++)]);
}
l++;
}
cs1_12864=aa;
cs2_12864=bb;
}
void hanzi()
{
uchar i,k;
write_command_12864(row);
write_command_12864(col);
k=0;
for(i=0;i<16;i++)
write_data_12864(p[staren]->py[starch*32+(k++)]);
write_command_12864(row+1);
write_command_12864(col);
for(i=0;i<16;i++)
write_data_12864(p[staren]->py[starch*32+(k++)]);
}
void next()
{
if((col-col_12864)>47)
{
if((cs1_12864==0)&&(cs2_12864==1))
{
cs1_12864=1;
cs2_12864=0;
col=col_12864;
}
else
{
col=col_12864;
row+=2;
cs1_12864=0;
cs2_12864=1;
}
}
else
col+=16;
}
main()
{
uchar i,j,key,input[6];
TMOD=0x01;
TH0=0x00;
TL0=0x00;
staren=0;
starch=0;
dis=0;
x=0;
state=0;
init_lcd_12864();
row=row_12864+5;
col=col_12864;
write_command_12864(row);
write_command_12864(col);
for(j=0;j<2;j++)
{
for(i=0;i<64;i++)
write_data_12864(0x80);
cs1_12864 =1;cs2_12864=0; //右屏
row=row_12864+5;
col=col_12864;
write_command_12864(row);
write_command_12864(col);
}
cs1_12864 =0;cs2_12864=1;
row=row_12864;col=col_12864;
write_command_12864(row);
write_command_12864(col);
TR0=1;
row=row_12864;
col=col_12864;
while(1)
{
key=0;
while(key==0)
key=keyscan();
while(P2!=0xf0)
P2=0xf0;
if(state==0)
{
length=0;
staren=0;
input[length]=change(key);
length++;
attempt(input,length);
state=1;
out();
}
else if(state==1)
{
if(key==0x48)
{
if(staren<cx-1)
{
staren++;
qing();
out();
}
}
else if(key==0x88)
{
if(staren>0)
{
staren--;
qing();
out();
}
}
else if(key==0x12)
{
if(length>0)
length--;
qing();
staren=0;
if(length>0)
{
attempt(input,length);
out();
}
}
else if(key==0x11)
{
if(p[staren]->py!=NULL)
{
starch=0;
qing();
outch(p[staren],starch);
state=2;
}
}
else
{
staren=0;
input[length]=change(key);
length++;
attempt(input,length);
qing();
out();
}
}
else if(state==2)
{
if(key==0x48)
{
starch++;
outch(p[staren],starch);
}
else if(key==0x88)
{
if(starch>0)
{
starch--;
outch(p[staren],starch);
}
}
else if(key==0x12)
{
qing();
out();
state=1;
}
else if(key==0x11)
{
hanzi();
qing();
state=0;
starch=0;
staren=0;
cx=0;
length=0;
next();
}
}
}
}
void iii(void) interrupt 1 using 1
{
x++;
if(x==8)
{
dis=~dis;
write_data_12864(dis);
row++;
write_command_12864(row);
write_command_12864(col);
write_data_12864(dis);
row--;
write_command_12864(row);
write_command_12864(col);
x=0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -