新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > 8位串行數碼管模塊__設計原理圖及測試程序

        8位串行數碼管模塊__設計原理圖及測試程序

        作者: 時間:2016-11-30 來源:網絡 收藏

        完整的源碼下載地址:http://www.51hei.com/f/chcxde.rar
        /***采用2片595驅動,動態掃描原理顯示,需要單片機3路IO口(DIO接 P33 SCK接P32 RCK接P34),上電顯示時鐘****/
        #include
        unsigned int tcount;
        unsigned char m;
        static unsigned char second,minute,hour;

        unsigned char code fseg[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
        unsigned char code segbit[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
        unsigned char disbuf[8]={0,0,0,0,0,0,0,0};

        本文引用地址:http://www.104case.com/article/201611/323814.htm


        //數據傳輸//
        void sdata(void)
        {unsigned char b,c,num;

        if(b==0)
        {
        b++;
        num=segbit[m];
        for(c=0;c<8;c++)
        {P3_2=0;
        P3_3=num&0x80;
        num<<=1;
        P3_2=1;
        }

        }

        if(b==1)

        {
        b--;
        if(m==2||m==5)
        {num=0xbf;}
        else
        {num=fseg[disbuf[m]];}

        for(c=0;c<8;c++)
        { P3_2=0;
        P3_3=num&0x80;
        num<<=1;
        P3_2=1;
        }

        }
        m++;
        if(m==8)
        {m=0;
        }
        }
        //數據傳輸//


        //延時0.1ms個單位//

        void delay (unsigned char h)
        { while(h--);
        }
        //延時0.1ms個單位//


        //數據輸出//
        void out(void)
        {P3_4=0;
        delay(50);
        P3_4=1;
        }
        //數據輸出//


        上一頁 1 2 下一頁

        評論


        技術專區

        關閉
        主站蜘蛛池模板: 开平市| 盱眙县| 壤塘县| 揭西县| 静海县| 西吉县| 永兴县| 和龙市| 章丘市| 五峰| 建平县| 防城港市| 马边| 青铜峡市| 巴楚县| 湟源县| 星座| 寿阳县| 阿荣旗| 鲜城| 图木舒克市| 都昌县| 万安县| 高州市| 盱眙县| 丁青县| 张家界市| 商都县| 思南县| 蚌埠市| 盈江县| 海门市| 青河县| 云梦县| 裕民县| 邮箱| 大安市| 明溪县| 当阳市| 理塘县| 蓝田县|