新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > 51單片機程序——點陣顯示漢字

        51單片機程序——點陣顯示漢字

        作者: 時間:2016-11-23 來源:網絡 收藏
        #include
        #define uint unsigned int
        unsigned char code tab[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
        unsigned char code digittab[]={0x14,0x18,0xff,0x18,0x14,0x18,0xff,0x18}; //
        unsigned char code digittab1[]={0x54,0xff,0x54,0x3f,0x55,0xfd,0x55,0x1d}; //
        unsigned char code digittab2[]={0x54,0x10,0x5a,0xf6,0x5f,0xf6,0x5a,0x12}; //
        void delay(uint z)
        {
        uint x,y;
        for(x=z;x>0;x--)
        for(y=110;y>0;y--);
        }
        void main()
        {
        int i,t=50;
        while(1)
        {
        while(t--)
        {
        for(i=0;i<8;i++)
        {
        P0=tab[i];
        P1=digittab[i];
        delay(5);
        }
        }
        P0=0xff;
        delay(100);
        t=50;
        while(t--)
        {
        for(i=0;i<8;i++)
        {
        P0=tab[i];
        P1=digittab1[i];
        delay(5);
        }
        }
        P0=0xff;
        delay(100);
        t=50;
        while(t--)
        {
        for(i=0;i<8;i++)
        {
        P0=tab[i];
        P1=digittab2[i];
        delay(5);
        }
        }
        P0=0xff;
        delay(100);
        t=50;
        }
        }


        評論


        技術專區

        關閉
        主站蜘蛛池模板: 蕉岭县| 高碑店市| 大新县| 略阳县| 威信县| 卓尼县| 达州市| 宁波市| 平远县| 宜君县| 浑源县| 灵寿县| 南开区| 漳平市| 赫章县| 雷山县| 贞丰县| 恩平市| 莲花县| 黄浦区| 房山区| 禄丰县| 肥东县| 南汇区| 额敏县| 合江县| 磐石市| 雷波县| 昌黎县| 兴宁市| 出国| 上蔡县| 琼结县| 新绛县| 庐江县| 张家界市| 阿克苏市| 大兴区| 磴口县| 新疆| 中江县|