新聞中心

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

51單片機(jī)總線驅(qū)動(dòng)

作者: 時(shí)間:2016-11-29 來源:網(wǎng)絡(luò) 收藏
/*********************************************************清楚8*8的大點(diǎn)(用畫點(diǎn)方式 速度慢)*********************************************************//*void clr_big(uchar x,uchar y){uint addr;uchar temp1,temp2,n;addr=(y<<8)+(y<<6)+(x);//x/8*4;y*320=y*(256+64)=(y<<8)+(y<<6)for(n=0;n<8;n++){temp1=addr&0x00ff;//addr%6temp2=addr>>8;lcd_writecom_two(temp1,temp2,0x24);lcd_writecom(0xf3);lcd_writecom(0xf2);lcd_writecom(0xf1);lcd_writecom(0xf0);lcd_writecom(0xf7);lcd_writecom(0xf6);lcd_writecom(0xf5);lcd_writecom(0xf4);addr+=40;}}*//*********************************************************清除8*8的大點(diǎn)(用讀修改寫方式 速度快)*********************************************************/void clr_rbig(uchar x,uchar y){uint addr;uchar temp1,temp2,n,dat;addr=(y<<8)+(y<<6)+(x);//x/8*4;y*320=y*(256+64)=(y<<8)+(y<<6)for(n=0;n<8;n++){temp1=addr;//&0x00ff;//addr%6temp2=addr>>8;lcd_writecom_two(temp1,temp2,0x24);//dat=(lcd_readdat_onebyte(0xc5))|0x00;dat=0x00;lcd_writedat_onebyte(dat,0xc4);addr+=40;}}/*************************************************************圖形方式 屏上寫漢字 16*16************************************************************/void graph_mode_writeword(uchar x,uchar y,uchar *dat){uint addr;uint temp1;uchar n;temp1=y;temp1=(temp1<<9)+(temp1<<7);//512+128addr=temp1+(x<<1);for(n=0;n<16;n++){lcd_writecom_two((addr&0x00ff),(addr>>8),0x24);lcd_writedat_onebyte(*dat,0xc0);dat++;lcd_writedat_onebyte(*dat,0xc4);dat++;addr=addr+40;}}/*************************************************************圖形方式 屏上寫字母,數(shù)字 8*16************************************************************/void graph_mode_write_letter(uchar x,uchar y,uchar *dat){uint addr;uint temp1;uchar n;temp1=y;temp1=(temp1<<9)+(temp1<<7);//512+128addr=temp1+(x<<1);for(n=0;n<16;n++){lcd_writecom_two((addr&0x00ff),(addr>>8),0x24);lcd_writedat_onebyte(*dat,0xc0);dat++;addr=addr+40;}}/******************************************************用畫點(diǎn)的方式劃橫線 (可以用讀改寫的方式)******************************************************//*void horizontal(uchar x0,uchar x1,uchar y){uchar temp,n;if(x0>x1){temp=x0;x0=x1;x1=temp;}n=x1-x0;for(;n>0;n--){sel_point(x0+n,y);}}*//*************************************劃橫線 (用讀改寫的方式)***************************************/uchar get_num(uchar x0){uchar dat;switch(x0){case 0: dat=0xff;break;case 1: dat=0x7f;break;case 2: dat=0x3f;break;case 3: dat=0x1f;break;case 4: dat=0x0f;break;case 5: dat=0x07;break;case 6: dat=0x03;break;case 7: dat=0x01;break;}return dat;}uchar get_num_n(uchar x1){uchar dat;switch(x1){case 0: dat=0x80;break;case 1: dat=0xc0;break;case 2: dat=0xe0;break;case 3: dat=0xf0;break;case 4: dat=0xf8;break;case 5: dat=0xfc;break;case 6: dat=0xfe;break;case 7: dat=0xff;break;}return dat;}void rhorizontal(uchar x0,uchar x1,uchar y){uint addr;uchar temp,n,temp1,temp2,dat,dat1;if(x0>x1){temp=x0;x0=x1;x1=temp;}addr=(y<<5)+(y<<3)+(x0>>3);temp1=addr;//&0xff;temp2=addr>>8;lcd_writecom_two(temp1,temp2,0x24);lcd_writecom_two(temp1,temp2,0x24);n=x1-x0;dat1=lcd_readdat_onebyte(0xc5);if((x0>>3)!=(x1>>3)){lcd_writedat_onebyte((get_num(x0&0x3)|dat1),0xc0);temp1=x0>>3;temp2=x1>>3;temp=temp2-temp1-1;lcd_writecom(0xb0);check_auto_write_busy();while(temp){lcd_writedat(0xff);temp--;}lcd_writecom(0xb2);dat1=lcd_readdat_onebyte(0xc5);lcd_writedat_onebyte((get_num_n(x1&0x03)|dat1),0xc4);}else{x0=x0&0x07;x1=x1%0x07;dat =~(get_num(x0)^get_num_n(x1));lcd_writedat_onebyte((dat|dat1),0xc4);}}

關(guān)鍵詞: 51單片機(jī)總線驅(qū)

評(píng)論


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

關(guān)閉