新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應用 > ATmega128并行控制帶字庫的12864程序

ATmega128并行控制帶字庫的12864程序

作者: 時間:2012-08-02 來源:網(wǎng)絡(luò) 收藏
void outChinese(unsigned char place,unsigned char unit,unsigned char *point){unsigned char i,progdata;wr_com(place);for(i=0;iunit*2;i++)//一個漢字為兩個字符{progdata=pgm_read_byte(point+i);wr_data(progdata);}}void outchar(unsigned char place,unsigned char unit,unsigned char *point){unsigned char i,progdata;wr_com(place);for(i=0;iunit;i++){progdata=pgm_read_byte(point+i);wr_data(progdata);}}void ydgb(void){wr_com(yb);//顯示光標位置yb=yb+0x01;if(yb==0x88){yb=0x90;}if(yb==0x97){yb=0x88;}if(yb==0x8f){yb=0x98;}if(yb==0xa0){yb=0x80;}}void display1(void){ydgb();outChinese(0x80,8,name00);//第一行:80-87HoutChinese(0x90,8,name01);//第二行:90-97HoutChinese(0x88,8,name02);//第三行:88-8FHoutChinese(0x98,8,name03);//第四行:98-9FH//outchar(0x9f,2,name4);}void display2(void){ydgb();outChinese(0x80,8,name10);outChinese(0x90,8,name11);outChinese(0x88,8,name12);outChinese(0x98,8,name13);}void display3(void){ydgb();outchar(0x80,16,name20);outchar(0x90,16,name21);outchar(0x88,16,name22);outchar(0x98,16,name23);}int main(void){DDRC=0xff; //數(shù)據(jù)PORTC=0x00;DDRG=0xff; //命令PORTG=0xff;DDRD=0xff; //命令PORTD=0xff;reset();while(1){ydgb();j++;ydgb();wr_com(0x01);//清屏if(j==3)j=0;switch(j){case 0:display1();break;case 1:display2();break;case 2:display3();break;}_delay_ms(3000);}}
上一頁 1 2 下一頁

關(guān)鍵詞: ATmega128 并行控制 12864程序

評論


相關(guān)推薦

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

關(guān)閉