无线传感网络课程设计Word格式文档下载.docx
《无线传感网络课程设计Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《无线传感网络课程设计Word格式文档下载.docx(67页珍藏版)》请在冰豆网上搜索。
*/
/**************************************************************************************************/
staticu16lookforChar(u8ch)
{
uint16i;
for(i=0;
i<
FONTLISTCOUNT;
i++)
{
if(fontList[i]==ch)
returni;
}
returni;
}
//查中文
staticu16lookforChar16(u16ch)
uint16i,j;
u16temp16;
fontChar16ListCount;
j=i*2;
temp16=fontChar16List[j+1];
temp16<
<
=8;
temp16|=fontChar16List[j];
if(temp16==ch)
在指定位置输出8*8
staticvoidLcdPutChar8(u8x,u8y,u8ch)
LcdBuf[y][x]=ch;
在指定位置输出16*16
/*staticvoidLcdPutChar16(u8x,u8y,u16ch)
LcdBuf[y][x]=(u8)ch;
//低前高后
LcdBuf[y+1][x]=(u8)(ch>
>
8);
voidLcdPutString8(u8x,u8y,u8*ptru8len,u8op)
{
u8i,*tptr=ptr,xx=x,yy=y;
u16m;
if(x>
95)
return;
if(y>
1)
i<
len;
m=lookforChar(*tptr++);
if(m!
=FONTLISTCOUNT)
{
m=m*8;
}
else
return;
xx+=8;
if(xx>
88)
voidLcdClearRam(void)
u8i;
96;
i++)
LcdBuf[0][i]=0;
LcdBuf[1][i]=0;
voidLcdClearScrean(void)
LcdClearRam();
PutPic((void*)LcdBuf);
voidLcdPutString16_8(u8x,u8y,u8*ptr,u8len,u8op)
u8i,j,*tptr=ptr,xx=x,yy=y;
if(xx>
if(yy)
{
m=m*16;
for(j=0;
j<
8;
j++)
if(op)
{
LcdPutChar8((xx+j),yy,font[m+j]);
LcdPutChar8((xx+j),yy+1,font[m+j+8]);
}
else
LcdPutChar8((xx+j),yy,~font[m+j]);
LcdPutChar8((xx+j),yy+1,~font[m+j+8]);
}
break;
96)
//显示16*16字符
voidLcdPutString16_16(u8x,u8y,u8*ptr,u8len,u8op)
m=m*32;
for(j=0;
16;
if(op)
{
LcdPutChar8((xx+j),yy,font[m+j]);
LcdPutChar8((xx+j),yy+1,font[m+j+16]);
}
else
LcdPutChar8((xx+j),yy,~font[m+j]);
LcdPutChar8((xx+j),yy+1,~font[m+j+16]);
xx+=16;
80)
staticvoidLcdPrint8(u8x,u8y,u8vl,u8op)
u8j;
m=lookforChar(vl);
if(m!
LcdPutChar8((x+j),y,font[m+j]);
LcdPutChar8((x+j),y+1,font[m+j+8]);
LcdPutChar8((x+j),y,~font[m+j]);
LcdPutChar8((x+j),y+1,~font[m+j+8]);
staticvoidLcdPrint16(u8x,u8y,u16val,u8op)
m=lookforChar16(val);
=fontChar16ListCount)
m=m*32;
LcdPutChar8((x+j),y,fontChar16[m+j]);
LcdPutChar8((x+j),y+1,fontChar16[m+j+16]);
LcdPutChar8((x+j),y,~fontChar16[m+j]);
LcdPutChar8((x+j),y+1,~fontChar16[m+j+16]);
}
voidLcdPutDispBuf(u8x,u8y,OledCodeDataType*ptr,u8op)
u8tcount=x;
OledCodeDataType*tptr=ptr;
1)
return;
while((*tptr!
='
\0'
)&
&
(tcount<
=88))
if(*tptr<
127)//显示ASIC码
LcdPrint8(tcount,y,*tptr,op);
tptr++;
tcount+=8;
else//显示汉字
temp16=tptr[1];
temp16<
temp16|=tptr[0];
LcdPrint16(tcount,y,temp16,op);
tptr+=2;
tcount+=16;
//实现中英文混合显示
voidLcdPutDisp(u8x,u8y,OledCodeDataType*ptr,u8op)
//从右往左输出一组字符并移运显示
voidLcdPutScDispRtoL(OledCodeDataType*ptr,u8op,u16dl)
//LcdClearRam();
while(*tptr!
)
memcpy(LcdBuf[0],&
LcdBuf[0][8],88);
memcpy(LcdBuf[1],&
LcdBuf[1][8],88);
LcdPrint8(88,0,*tptr,op);
LcdBuf[0][16],80);
LcdBuf[1][16],80);
LcdPrint16(80,0,temp16,op);
PutPic((void*)LcdBuf);
LcdDelay(dl);
}
voidLcdPutScDispRtoL12(OledCodeDataType*ptr,u8op,u16dl)
u16i,temp16;
12;
)
i++;
i+=2;
//从左往右
voidLcdPutScDispLtoR12(OledCodeDataType*ptr,u8op,u16dl)
OledCodeDataType*ttptr,*tptr=ptr;
u8i,len,tempbuf[2][96];
len=12;
tptr=ptr+11;
if(*(tptr)<
127)//显示ASIC码
memcpy(&
tempbuf[0][0],&
LcdBuf[0][0],96);
tempbuf[1][0],&
LcdBuf[1][0],96);
LcdBuf[0][8],&
tempbuf[0][0],88);
LcdBuf[1][8],&
tempbuf[1][0],88);
LcdPrint8(0,0,*tptr,op);
tptr--;
i++;
LcdBuf[0][16],&
tempbuf[0][0],80);
LcdBuf[1][16],&
tempbuf[1][0],80);
ttptr=tptr;
temp16=*ttptr;
ttptr=tptr-1;
temp16|=*ttptr;
LcdPrint16(0,0,temp16,op);
tptr-=2;
i+=2;
voidLcdPutScString(OledCodeDataType*ptr,u8op,u8rl,u16dl)
switch(rl)
caseLIFT_SC:
LcdPutScDispLtoR12(ptr,op,dl);
caseRIGHT_SC:
LcdPutScDispRtoL12(ptr,op,dl);
default:
break;
voidLcdPutPic(u8x,u8y,u8w,u8h,OledCodeDataType*ptr,u8op)
if((x>
95)||((x+w)>
96))
if((y>
1)||((y+h)>
2))
w;
i++)
if(op)
{
LcdBuf[y][x+i]=*tptr;
if(h==2)
LcdBuf[y+1][x+i]=*(tptr+w);
tptr++;
LcdBuf[y][x+i]=~*tptr;
LcdBuf[y+1][x+i]=~*(tptr+w);
//整屏滑动显示
voidLcdPutScPic(OledCodeDataType*ptr,u8op,u8qp,u16dl)
u8i,j;
u8tempbuf[2][96];
if(qp)
for(i=0;
tempbuf[0][i]=*ptr++;
tempbuf[1][i]=*ptr++;
else
tempbuf[0][i]=~*ptr++;
tempbuf[1][i]=~*ptr++;
switch(op)
//右边
for(i=0;
for(j=0;
84;
j++)
LcdBuf[0][95-j]=LcdBuf[0][83-j];
LcdBuf[1][95-j]=LcdBuf[1][83-j];
LcdBuf[0][11-j]=tempbuf[0][95-j];
LcdBuf[1][11-j]=tempbuf[1][95-j];
tempbuf[0][95-j]=tempbuf[0][83-j];
tempbuf[1][95-j]=tempbuf[1][83-j];
PutPic((void*)LcdBuf);
LcdDelay(dl);
//左边
LcdBuf[0][j]=LcdBuf[0][j+12];
LcdBuf[1][j]=LcdBuf[1][j+12];
LcdBuf[0][95-j]=tempbuf[0][11-j];
LcdBuf[1][95-j]=tempbuf[1][11-j];
tempbuf[0][j]=tempbuf[0][j+12];
tempbuf[