新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > T6963C的51單片機(jī)驅(qū)動(dòng)程序

T6963C的51單片機(jī)驅(qū)動(dòng)程序

作者: 時(shí)間:2016-12-02 來源:網(wǎng)絡(luò) 收藏
/********************************************************************************************************/void ReverseShowChar(uchar x,uchar y,uchar ch)//CGTAB{uchar i, dat;uint StartAddr,StartAddr1;StartAddr=x*240+y;StartAddr1=x*240+y+1;for(i=0;i<8;i++){ LCD_WriteTCommand3(LCD_ADR_POS,StartAddr,StartAddr>>8);//LCD_WriteTCommand1(0xc5); //數(shù)據(jù)一次讀,地址不變//dat=LCD_ReadData(); //讀入數(shù)據(jù)dat=ASCII_DOT_LIB[ch][i];dat=(0xff-dat); //取反//LCD_WriteTCommand2( dat, 0xc4); //送回LCD_WriteTCommand2(LCD_NOC_WR,dat);StartAddr=StartAddr+30;}for(i=0;i<8;i++){LCD_WriteTCommand3(LCD_ADR_POS,StartAddr1,StartAddr1>>8);//LCD_WriteTCommand1(0xc5); //數(shù)據(jù)一次讀,地址不變// dat=LCD_ReadData(); //讀入數(shù)據(jù)dat=ASCII_DOT_LIB[ch][i+8];dat=(0xff-dat); //取反// LCD_WriteTCommand2(dat, 0xc4); //送回LCD_WriteTCommand2(LCD_NOC_WR,dat);StartAddr1=StartAddr1+30;}}/**********************************//= 函數(shù)原型: Pixel(unsigned char PointX,unsigned char PointY, bit Mode)//= 功 能: 在指定坐標(biāo)位置顯示一個(gè)點(diǎn)//= 參 數(shù): 坐標(biāo),顯示點(diǎn)或清除點(diǎn)//= 返 回 值://= 函數(shù)性質(zhì):私有函數(shù)//= 如果顯示屏超過了256*256,請(qǐng)修改這個(gè)函數(shù) PointX,PointY的類型//= Mode 1:顯示 0:清除該點(diǎn)**********************************/Pixel(unsigned char PointX,unsigned char PointY, bit Mode){unsigned int StartAddr;uchar StartAddrL,StartAddrH;unsigned char dat;StartAddr=(uint)((uint)PointX*30 + PointY/8 );//grhomeStartAddrL=StartAddr&0xFF;StartAddrH=StartAddr>>8;dat=LCD_BIT_OP+7-PointY%8; //生產(chǎn)位操作命令畫點(diǎn)的數(shù)據(jù)if(Mode) dat=dat|0x08;LCD_WriteTCommand3(LCD_ADR_POS,StartAddrL,StartAddrH);//設(shè)置該點(diǎn)所在單元地址LCD_WriteTCommand1(dat); // 利用位操作命令畫點(diǎn)}/**********************************//= 函數(shù)原型: void line( unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, bit Mode)//= 功 能: 劃線函數(shù)//= 參 數(shù): 坐標(biāo)1,坐標(biāo)2,顯示點(diǎn)或清除點(diǎn)//= 返 回 值://= 函數(shù)性質(zhì):私有函數(shù)//= 其它:顯示點(diǎn)陣不超過255*255/**********************************/void line( unsigned char y1,unsigned char x1, unsigned char y2,unsigned char x2, bit Mode){unsigned char x,y;float k,b;if( abs(y1-y2) <= abs(x1-x2) ) // |k|<=1{k=((float)y2-y1) / ((float)x2-x1) ;b=y1-k*x1;if( x1 <= x2 ){for(x=x1;x<=x2;x++){y=(uchar)(k*x+b);Pixel(x, y, Mode);}}else{for(x=x2;x<=x1;x++){y=(uchar)(k*x+b);Pixel(x, y, Mode);}}}else // abs(y1-y2) > abs(x1-x2) |K|>1{k=((float)x2-x1) / ((float)y2-y1) ;b=x1-k*y1;if( y1 <= y2 ){for(y=y1;y<=y2;y++){x=(uchar)(k*y+b);Pixel( x , y,Mode );}}else{for(y=y2;y<=y1;y++){x=(uchar)(k*y+b);Pixel( x , y,Mode );}}}}/********************************************************************************************************/uchar code HZTable[ ][32]={{0x40,0x02,0x27,0xC2,0x24,0x42,0x84,0x52,0x45,0x52,0x55,0x52,0x15,0x52,0x25,0x52,0x25,0x52,0x25,0x52,0xC5,0x52,0x41,0x02,0x42,0x82,0x42,0x42,0x44,0x4A,0x48,0x04},/*"測(cè)",0*/{0x00,0x20,0x40,0x28,0x20,0x24,0x30,0x24,0x27,0xFE,0x00,0x20,0xE0,0x20,0x27,0xE0,0x21,0x20,0x21,0x10,0x21,0x10,0x21,0x0A,0x29,0xCA,0x36,0x06,0x20,0x02,0x00,0x00},/*"試",1*/{0x0D,0xF8,0x71,0x08,0x11,0x08,0x11,0x08,0xFD,0x08,0x11,0xF8,0x30,0x00,0x3B,0xFC,0x54,0x40,0x50,0x40,0x93,0xFC,0x10,0x40,0x10,0x40,0x10,0x40,0x17,0xFE,0x10,0x00},/*"程",2*/{0x01,0x00,0x00,0x80,0x3F,0xFE,0x20,0x00,0x27,0xF8,0x21,0x10,0x20,0xA0,0x20,0x40,0x2F,0xFE,0x20,0x44,0x20,0x40,0x20,0x40,0x20,0x40,0x40,0x40,0x41,0x40,0x80,0x80},/*"序",0*/{0x06,0x40,0x38,0x50,0x08,0x48,0x08,0x48,0x08,0x40,0xFF,0xFE,0x08,0x40,0x08,0x48,0x0E,0x28,0x38,0x30,0xC8,0x20,0x08,0x50,0x09,0x92,0x08,0x0A,0x28,0x06,0x10,0x02},/*"我",1*/};unsigned char code ASCII_DOT_LIB[][16]={//正確的,縱向取模,字節(jié)正序0x00,0x10,0x18,0x14,0x03,0x11,0x1F,0x10,0x00,0x04,0x1C,0x64,0x80,0x04,0xFC,0x04,0x00,0x08,0x10,0x17,0x11,0x11,0x1F,0x10,0x00,0x18,0x04,0xC4,0x04,0x04,0xFC,0x04,0x00,0x10,0x1C,0x13,0x00,0x13,0x1C,0x10,0x00,0x00,0x00,0x04,0xFC,0x04,0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x08,0x07,0x00,0x00,0xF0,0x08,0x04,0x04,0x08,0xF0,0x00, // -0-0x00,0x00,0x00,0x00,0x1F,0x08,0x08,0x00,0x00,0x00,0x04,0x04,0xFC,0x04,0x04,0x00, // -1-0x00,0x0E,0x11,0x10,0x10,0x10,0x0E,0x00,0x00,0x0C,0x84,0x44,0x24,0x14,0x0C,0x00, // -2-0x00,0x0C,0x12,0x11,0x11,0x10,0x0C,0x00,0x00,0x70,0x88,0x04,0x04,0x04,0x18,0x00, // -3-0x00,0x00,0x1F,0x08,0x04,0x03,0x00,0x00,0x00,0x24,0xFC,0x24,0x24,0x20,0xE0,0x00, // -4-0x00,0x10,0x10,0x11,0x11,0x10,0x1F,0x00,0x00,0x70,0x88,0x04,0x04,0x84,0x98,0x00, // -5-0x00,0x00,0x18,0x11,0x11,0x08,0x07,0x00,0x00,0x70,0x88,0x04,0x04,0x88,0xF0,0x00, // -6-};
上一頁 1 2 3 下一頁

評(píng)論


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

關(guān)閉