在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

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

            單片機(jī)12232 C語(yǔ)言的驅(qū)動(dòng)程序

            作者: 時(shí)間:2016-11-18 來(lái)源:網(wǎng)絡(luò) 收藏
            /****************點(diǎn)陣12232函數(shù)調(diào)用庫(kù)**********************/

            //////////////////////////////////////////////////////////
            #include
            #include
            #include
            #include
            #define uchar unsigned char
            #define uint unsigned int

            本文引用地址:http://www.biyoush.com/article/201611/315925.htm

            #define frist_page 0xb8 //頁(yè)地址設(shè)置(0~3)
            #define frist_row 0xc0 //掃描行 (0~31)
            #define frist_line 0x00 //列地址設(shè)置(0~61)


            bit R=1,W=0,C=0,D=1;
            /*******指令集***********************
            do_12232(W,C,1,1,0XAE); //開關(guān)屏 +1開
            do_12232(W,C,1,1,0XC0); //起始行 0~31
            do_12232(W,C,1,1,0XB8); //頁(yè)地址 0~4
            do_12232(W,C,1,1,0X00); //列地址 0~80
            do_12232(W,C,1,1,0XB1); //設(shè)置方向 正向 B0 為反向
            do_12232(W,C,1,1,0XA4); //驅(qū)動(dòng)模式 正常 +1靜態(tài)
            do_12232(W,C,1,1,0XA8); //duty設(shè)置 1/16 +1 1/32duty
            do_12232(W,C,1,1,0XE0); //R-chang-W
            do_12232(W,C,1,1,0XAE); //end
            do_12232(W,C,1,1,0XE2); //reset
            *////////////////////////////////////////////
            void delayus(uint us)
            {
            uint uscnt;
            uscnt=us>>3;
            while(--uscnt);
            }
            void delayms(uint ms) // ms數(shù)量級(jí) 是實(shí)際時(shí)間的0.83倍
            {
            while(--ms)
            {
            delayus(250);
            delayus(250);
            delayus(250);
            delayus(250);
            }
            }

            void do_12232(bit RW,bit DC,bit chceE1,bit chceE2,uchar date)
            {
            a0=DC;
            rw=RW;
            P0=date;
            if(chceE1){e1=1;e1=0;}
            if(chceE2){e2=1;e2=0;}
            }

            void init_lcd (void)
            {
            rst=1;
            do_12232(W,C,1,1,0xe2); //軟件復(fù)位
            do_12232(W,C,1,1,0xa4); //動(dòng)態(tài)驅(qū)動(dòng)
            do_12232(W,C,1,1,0xae); //顯示關(guān)閉
            do_12232(W,C,1,1,0xa9); //刷新時(shí)鐘設(shè)置1/32
            do_12232(W,C,1,1,0xa0); //clockwise
            do_12232(W,C,1,1,0xee); //寫模式
            do_12232(W,C,1,1,0xaf); //顯示打開
            }
            /*///////清屏///////////////*/////////////////
            void clear_screen()
            {
            uchar i,ii;
            for(i=0;i<4;i++)
            {
            do_12232(W,C,1,1,frist_page+i);
            do_12232(W,C,1,1,frist_row);
            do_12232(W,C,1,1,frist_line);
            for(ii=0;ii<61;ii++)
            {
            do_12232(W,D,1,1,0);
            }
            }
            }
            ///////////任意位置寫7*16的像素塊////////////////////////
            /*
            每半屏的一頁(yè)只能寫8個(gè)字符空余5列
            x 橫向x=0第一行 x=2 第二行
            y 列向y=0~16
            */
            ///////////////////////////////////////////////////////////
            /*
            加 do_12232(W,C,1,0,frist_row);是必要的的,每個(gè)像素都是在頂層
            產(chǎn)生的,每寫半屏的長(zhǎng)度執(zhí)行它可以通過(guò)滾屏達(dá)到指定的地點(diǎn)
            */
            void write_one_char(uchar x,uchar y,uchar code *cha)
            {
            uchar i,ii;
            for(ii=0;ii<2;ii++) //上下半屏分寫
            {
            if(y/8) //左右半屏分寫
            {
            do_12232(W,C,0,1,frist_page+x+ii); //值頁(yè)
            do_12232(W,C,0,1,frist_row+8*x); //掃描
            do_12232(W,C,0,1,frist_line+7*(y-8));//值列
            for(i=0;i<7;i++)
            {
            do_12232(W,D,0,1,cha[7*ii+i]);
            }
            do_12232(W,C,0,1,frist_row); //執(zhí)行滾屏

            }
            else
            {
            do_12232(W,C,1,0,frist_page+x+ii);
            do_12232(W,C,1,0,frist_row+8*x);
            do_12232(W,C,1,0,frist_line+7*y+5);
            for(i=0;i<7;i++)
            {
            do_12232(W,D,1,0,cha[7*ii+i]);
            }
            do_12232(W,C,1,0,frist_row);
            }
            }
            }

            ///////////////////////////////////////////////////////////////////
            /*
            寫任意像素15*16到指定位置
            */
            void write_one_chinese(uchar x,uchar y,uchar code *cha)
            {
            uchar i,ii;
            for(ii=0;ii<2;ii++) //上下半屏分寫
            {
            if(y/4) //左右半屏分寫
            {
            do_12232(W,C,0,1,frist_page+x+ii); //值頁(yè)
            do_12232(W,C,0,1,frist_row+8*x); //掃描
            do_12232(W,C,0,1,frist_line+15*(y-4));//值列 ?
            for(i=0;i<15;i++)
            {
            do_12232(W,D,0,1,cha[15*ii+i]);
            }
            do_12232(W,C,0,1,frist_row); //執(zhí)行滾屏

            }
            else
            {
            do_12232(W,C,1,0,frist_page+x+ii);
            do_12232(W,C,1,0,frist_row+8*x);
            do_12232(W,C,1,0,frist_line+15*y);
            for(i=0;i<15;i++)
            {
            do_12232(W,D,1,0,cha[15*ii+i]);
            }
            do_12232(W,C,1,0,frist_row);
            }
            }
            }
            //////////////////////////////////////////////////////////////////
            /************任意位置寫字符串************************************/
            void write_chars(uchar x,uchar y,uchar code *cha,uchar quantity)
            {
            uchar i;
            for(i=0;i{
            write_one_char(x,y+i,cha+14*i);
            }
            }
            /***********任意位置寫漢字串************************************/
            void write_characters(uchar x,uchar y,uchar code *cha,uchar quantity)
            {
            uchar i;
            for(i=0;i{
            write_one_chinese(x,y+i,cha+30*i);
            }
            }
            /***********整屏122*32畫一幅畫************************************/
            /*
            如果數(shù)據(jù)是從上至下有序下沉則每次不必置
            do_12232(W,C,0,1,frist_row);
            */
            void display_piture(uchar *cha)
            {
            uchar i,ii;
            for(i=0;i<4;i++)
            {
            do_12232(W,C,1,1,frist_page+i);
            do_12232(W,C,1,1,frist_row);
            do_12232(W,C,1,1,frist_line);
            for(ii=0;ii<122;ii++)
            {
            if(ii<61){do_12232(W,D,1,0,cha[122*i+ii]);}
            else{do_12232(W,D,0,1,cha[122*i+ii]);}
            }
            }
            }
            ////////////////////////////////////////////////////////////////////
            void main()
            {
            init_lcd();
            clear_screen();
            write_chars(0,3,num,8);
            write_chars(2,3,num,8);
            while(1)
            {
            clear_screen();
            (0,0,num,10);
            delayms(5000);

            clear_screen();
            write_characters(0,0,pray,8);
            write_characters(2,1,write_me,5);
            delayms(5000);

            clear_screen();
            display_piture(tup);
            delayms(5000);
            }
            }

            dewei.h 文件 定義與單片機(jī)的接口

            //DATA P0;
            sbit rst=P2^4;//復(fù)位
            sbit e1 =P2^1;// 使能
            sbit e2 =P2^2;
            sbit rw =P2^3;
            sbit a0 =P2^0;//數(shù)據(jù)指令

            table.h 文件 注入flash(code)的數(shù)據(jù)表

            //字模"0123456789"
            unsigned char code num[]={
            0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,/*"0"*/
            0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,/*"1"*/
            0x00,0x70,0x08,0x08,0x08,0xF0,0x00,0x00,0x30,0x2C,0x22,0x21,0x30,0x00,/*"2"*/
            0x00,0x30,0x08,0x88,0x88,0x70,0x00,0x00,0x18,0x20,0x20,0x31,0x1E,0x00,/*"3"*/
            0x00,0x80,0x40,0x20,0xF8,0x00,0x00,0x06,0x05,0x04,0x24,0x3F,0x24,0x04,/*"4"*/
            0x00,0xF8,0x08,0x88,0x88,0x08,0x00,0x00,0x19,0x21,0x20,0x31,0x1F,0x00,/*"5"*/
            0xE0,0x10,0x88,0x88,0x88,0x18,0x00,0x0F,0x11,0x20,0x20,0x31,0x1F,0x00,/*"6"*/
            0x00,0x38,0x08,0x08,0xE8,0x18,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,/*"7"*/
            0x70,0x98,0x88,0x08,0x98,0x70,0x00,0x1E,0x21,0x21,0x21,0x31,0x1E,0x00,/*"8"*/
            0xF0,0x08,0x08,0x08,0x18,0xE0,0x00,0x31,0x22,0x22,0x32,0x19,0x07,0x00,/*"9"*/

            unsigned char code tup[]={
            /*-- 一幅圖像: --*/
            /*-- 寬度x高度=122x32 --*/
            0x00,0x00,0x00,0x70,0xF8,0xF8,0xFC,0xFC,0xFE,0xFE,0xFE,0xFE,0xFC,0xFC,0xF0,0xE0,
            0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x80,0x40,0x20,0x10,0x48,0xD4,0xB4,0x62,0xC2,0x82,0x03,0x02,0x02,
            0x02,0x84,0xC4,0xE0,0xA0,0xE0,0x60,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x80,0xE0,0xB0,0xF8,0xF0,0xF0,0xF8,0xFC,0x60,0x60,0x30,
            0x18,0x00,0x00,0x00,0x80,0xC0,0xE0,0xE0,0xF0,0xF0,0xF0,0xD8,0x58,0x58,0x58,0x58,
            0x58,0xD8,0xD8,0x98,0xB0,0x30,0x70,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x07,
            0x07,0x07,0x02,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xFC,0xFC,0xFC,
            0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xF8,0xF0,0xC0,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x01,0x00,0x04,
            0x0D,0x1B,0x36,0x6D,0xDB,0xF6,0xED,0xFB,0xFE,0xFE,0xFF,0x7F,0x1F,0x07,0x01,0x00,
            0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0xFC,0xFE,0xFE,
            0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xE0,0xC0,0xC0,0xF8,0xFE,0xFF,0xFF,0xFF,
            0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x3E,0xF8,0x01,0x37,
            0x0C,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x60,0xFF,0xC7,0x03,0x03,0x03,0x03,0xE1,
            0xFF,0x3F,0x0F,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x0F,0x3F,0x7F,0xFF,0xEF,
            0xBF,0x7F,0xFF,0xC7,0x07,0x1F,0xFE,0xF8,0xB0,0x60,0x80,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x10,0x20,0x40,0x40,0x80,0x83,
            0xFF,0xFF,0xFF,0xFF,0x83,0x40,0x40,0x20,0x10,0x08,0x04,0x03,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x03,0x07,0x0F,0x1F,0x3F,0x3F,0x7F,0xFF,
            0xFF,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xDF,0x3F,0x3F,0x0F,0x61,0x3F,0x1F,0x2F,0x3F,
            0x1F,0x0F,0x00,0x0F,0x07,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x1E,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x40,0x60,0x70,0x3C,0x1F,0x07,0x03,0x01,0x01,0x00,0x00,
            0x01,0x07,0x07,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x44,0xEC,0x00,
            0x7C,0x44,0x7C,0x00,0x7C,0x40,0x40,0x00,0x7C,0x44,0x38,0x00,0x7C,0x14,0x1C,0x00,
            0x7C,0x40,0x40,0x00,0x78,0x24,0x78,0x00,0x7C,0x18,0x18,0x7C,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x20,0x20,0x20,0x20,0x10,0x04,0x07,0x00,0x01,0x00,0x00,0x00,0x01,
            0x05,0x03,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
            0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
            };
            unsigned char code pray[]=
            {
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 祝
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x08,0x88,0xC9,0xEF,0xFE,0x98,0x7E,0x7E,0xC2,0xC2,0xC2,0xC2,0x7E,0x7E,0x00,
            0x01,0x01,0x3F,0x3F,0x20,0x21,0x31,0x1c,0x0F,0x03,0x3F,0x3F,0x20,0x38,0x38,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 福
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            //寬的像素?cái)?shù),高的像素?cái)?shù),寬的字節(jié)數(shù),參數(shù)設(shè)置可選
            0x08,0x08,0x88,0xEE,0xFE,0x98,0x80,0xBA,0xBA,0xAA,0xAA,0xBA,0xBA,0x82,0x00,
            0x02,0x03,0x01,0x3F,0x3F,0x01,0x3F,0x3F,0x12,0x1F,0x1F,0x12,0x3F,0x3F,0x00,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 我
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x00,0x14,0x14,0x96,0xFF,0xFF,0x10,0x10,0xFF,0xFF,0x10,0xDC,0xDC,0x10,0x00,
            0x04,0x06,0x13,0x33,0x3F,0x1F,0x08,0x08,0x0F,0x07,0x0F,0x19,0x30,0x3c,0x3c,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 家
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x00,0x8C,0x8C,0xD4,0x54,0xF4,0xF5,0xD7,0x96,0x94,0xD4,0x74,0x2C,0x0C,0x00,
            0x00,0x00,0x12,0x12,0x1B,0x0D,0x26,0x23,0x3F,0x3F,0x03,0x06,0x1c,0x18,0x08,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 暑
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x80,0x80,0x80,0xBE,0xBE,0xAA,0xEA,0xEA,0xAA,0xEA,0xFE,0xBE,0x80,0x80,0x80,
            0x04,0x04,0x06,0x02,0x3F,0x3F,0x2B,0x2B,0x2a,0x2a,0x3e,0x3e,0x00,0x00,0x00,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 假
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x20,0x30,0xFC,0xFF,0x03,0xFE,0xFE,0x92,0xBE,0xBE,0x92,0x92,0xBE,0xBE,0x00,
            0x00,0x00,0x3F,0x3F,0x00,0x3F,0x3F,0x22,0x22,0x37,0x1F,0x1c,0x37,0x23,0x20,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 快
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x60,0x30,0xFF,0xFF,0xB0,0xE8,0x88,0x88,0xFF,0xFF,0x88,0xF8,0xF8,0x80,0x80,
            0x00,0x00,0x3F,0x3F,0x20,0x30,0x18,0x0e,0x07,0x07,0x0e,0x18,0x30,0x30,0x20,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 樂(lè)
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x00,0x00,0x70,0x7E,0x4E,0x42,0x42,0xFA,0xFB,0x43,0x40,0x40,0x40,0x40,0x00,
            0x00,0x10,0x18,0x0c,0x07,0x13,0x30,0x3F,0x1F,0x01,0x03,0x06,0x1e,0x18,0x00
            };

            unsigned char code write_me[]=
            {
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 孫
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x06,0x06,0x86,0xF6,0xFE,0xEE,0x26,0x80,0x80,0xFE,0xFE,0xE0,0xC0,0x00,0x00,
            0x0c,0x26,0x63,0xFF,0xFF,0x18,0x0e,0x17,0x71,0xFF,0xFF,0x00,0x01,0x07,0x0e,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 孝
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x20,0x20,0xA4,0xA4,0xA4,0xA4,0xFF,0xFF,0xE4,0xB4,0xB4,0x24,0x20,0x20,0x20,
            0x08,0x08,0x08,0x0c,0x0e,0x4B,0xC9,0xFe,0xFF,0x09,0x08,0x08,0x08,0x08,0x08,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 亮
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x00,0x04,0x04,0x74,0x74,0x54,0x57,0x57,0x54,0x54,0x74,0x74,0x04,0x04,0x00,
            0x04,0x07,0x83,0xC1,0x7D,0x3D,0x05,0x05,0xFD,0xFD,0x81,0x85,0x87,0xE7,0xE0,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 研
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x06,0xC6,0xFE,0xFE,0xC6,0xC6,0x00,0xC6,0xFE,0xFE,0xC6,0xFE,0xFE,0xC6,0xC6,
            0x01,0x1F,0x1F,0x10,0x1F,0x1F,0x20,0x30,0x1F,0x0F,0x00,0x7F,0x7F,0x00,0x00,
            /*------------------------------------------------------------------------------
            ; 源文件 / 文字 : 制
            ; 寬×高(像素): 15×16
            ------------------------------------------------------------------------------*/
            0x30,0x5E,0x5E,0x48,0xFF,0xFF,0x48,0x48,0x48,0x00,0xFC,0xFC,0x00,0xFF,0xFF,
            0x00,0x3F,0x3F,0x01,0xFF,0xFF,0x21,0x7F,0x7F,0x00,0x0F,0x2F,0x61,0xFF,0xFe
            };



            評(píng)論


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

            關(guān)閉