新聞中心

EEPW首頁(yè) > 模擬技術(shù) > 設(shè)計(jì)應(yīng)用 > t6963c驅(qū)動(dòng)程序-驅(qū)動(dòng)代碼

t6963c驅(qū)動(dòng)程序-驅(qū)動(dòng)代碼

作者: 時(shí)間:2012-04-25 來(lái)源:網(wǎng)絡(luò) 收藏
; PADDING-TOP: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BACKGROUND-COLOR: rgb(255,255,255); orphans: 2; widows: 2; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">StartAddr=lin*LineChar + column; //定位起始行

for(i=0;i16;i++)
{
OutPortCom3( (unsigned char)(StartAddr), (unsigned char)(StartAddr>>8), 0x24);
OutPortCom2( HZTable[hzcode][i*2], 0xc0); //左半部 地址加一
OutPortCom2( HZTable[hzcode][i*2+1], 0xc4); //右半部 字模地址加一

StartAddr=StartAddr + LineChar;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////
//顯示一個(gè)漢字(16*16點(diǎn)陣)
//lin:行(0-7), column: 列(0-7)
//hzcode: 漢字代碼(自定義的)
void ShowHZD(unsigned char lin,unsigned char column,unsigned int hzcode)
{
unsigned char i,j;
unsigned int StartAddr;

StartAddr=lin*LineChar*16 +column; //定位起始行

for(i=0;i35;i++)
{
OutPortCom3( (unsigned char)(StartAddr), (unsigned char)(StartAddr>>8), 0x24); //定位當(dāng)前操作位置
for(j=0;j5;j++) OutPortCom2( HZTable[hzcode][i*5+j], 0xc0); //顯示當(dāng)前一行

StartAddr=StartAddr + LineChar;
}
}

////////////////////////////////////////////////////////////////////////////////////////////
/*-----------------------------------------------------------------------------------*/
//顯示一行字符串(漢字,字母混排,一行16字節(jié))
//lin:行
//lineheadaddr: 此行漢字代碼區(qū)首地址
void ShowLine(unsigned char lin,unsigned char column,unsigned char linehead[])
{
unsigned char i,j;
unsigned char byte;
unsigned int hzcode;

for( i= column,j=0; i column+14 ; )
{ byte=linehead[j];
if(byte 0x80) //字母
{
ShowChar(lin, i , byte);
i=i+1;j=j+1;
}
else // byte >= 0x80(漢字)
{
byte=byte 0x7f; //最高位置0,即:減去0x8000
hzcode=byte*256 + linehead[j+1]; //加低8位,組合成整型數(shù)地址
ShowHZ( lin,i,hzcode);
i=i+2;j=j+2;
}
}
}

/*-----------------------------------------------------------------------------------*/
//顯示一屏漢字
//pageheadaddr:此屏漢字代碼地址區(qū)首地址
void ShowPage(unsigned char lin,unsigned char column1,unsigned char pagehead[][14])
{
unsigned char i;
for(i=0;i 4 ;i++)
ShowLine((lin+i*20),column1,pagehead[i]); //1行8個(gè)漢字,16字節(jié)
}

/*----------------------------------------------------------------------------------------------------*/
//反顯一個(gè)字符
//lin:行(0-7), column: 列(0-15)
void ReverseShowChar(unsigned char lin,unsigned char column)
{
unsigned char i;
unsigned char dat;
unsigned int StartAddr;

StartAddr=lin*LineChar +column; //定位起始行

for(i=0;i16;i++)
{
OutPortCom3( (unsigned char)(StartAddr), (unsigned char)(StartAddr>>8), 0x24); //set address
OutPortCom1( 0xc5 ); //數(shù)據(jù)一次讀,地址不變
dat=InPortData(); //讀入數(shù)據(jù)
dat=~dat; //取反
OutPortCom2( dat, 0xc4); //送回

StartAddr=StartAddr+ LineChar;
}
}


/*----------------------------------------------------------------------------------------------------*/
//反顯一個(gè)漢字
//lin:行(0-7), column: 列(0-15)
void ReverseShowHZ(unsigned char lin,unsigned char column)
{
ReverseShowChar(lin,column);
ReverseShowChar(lin,column+1);
}
/*----------------------------------------------------------------------------------------------------*/
//反顯一行漢字
//lin:行(0-7)
void ReverseShowLine(unsigned char lin)
{
unsigned char column;
for(column=0; column ColumnChar; column++) ReverseShowChar(lin,column);
}


//////////////////////////////////////////////////////////////////////////////////////
void ShowPicture(unsigned char Startline,unsigned char Startcolumn,unsigned char LineWidth,unsigned char ColumnWidth,unsigned int address)
{
unsigned char i,j;
unsigned int StartAddr;

StartAddr=Startline*LineChar + Startcolumn; //定位起始位置

c語(yǔ)言相關(guān)文章:c語(yǔ)言教程




關(guān)鍵詞: t6963c 驅(qū)動(dòng)程序 驅(qū)動(dòng)代碼

評(píng)論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉