新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > 單片機實現adc0808程序

        單片機實現adc0808程序

        作者: 時間:2016-11-18 來源:網絡 收藏
        一:系統圖:

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

        程序部分:

        #include
        unsigned char code dispbitcode[]={0x01,0x02,0x04,
        0x08,0x10,0x20,0x40,0x80};
        unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,
        0x6d,0x7d,0x07,0x7f,0x6f};
        unsigned char dispbuf[3]={0,0,0};
        unsigned char dispcount;
        sbit ST=P3^2;
        sbit OE=P3^0;
        sbit EOC=P3^1;
        unsigned char getdata;
        void main(void)
        {
        TMOD=0x01;
        TH0=(65536-4000)/256;
        TL0=(65536-4000)%256;
        TR0=1;
        ET0=1;
        EA=1;
        P3_4=1;
        P3_5=1;
        P3_6=0;
        while(1)
        {
        ST=0;
        ST=1;
        ST=0;
        while(EOC==0);
        OE=1;
        getdata=P1;
        OE=0;
        dispbuf[2]=getdata/100;
        dispbuf[1]=getdata%10/10;
        dispbuf[0]=getdata%10;
        }
        }
        void t0(void) interrupt 1 using 0
        {static unsigned int nn;
        TH0=(65536-4000)/256;
        TL0=(65536-4000)%256;
        P2_0=0;
        P0=dispcode[dispbuf[2]];
        P2_0=1;
        for(nn=0;nn<1000;nn++);
        P2_1=0;
        P0=dispcode[dispbuf[1]];
        P2_1=1;
        for(nn=0;nn<1000;nn++);
        P2_2=0;
        P0=dispcode[dispbuf[0]];
        P2_2=1;
        for(nn=0;nn<1000;nn++);
        }



        關鍵詞: 單片機adc0808程

        評論


        技術專區

        關閉
        主站蜘蛛池模板: 哈密市| 大埔县| 柘城县| 鄂尔多斯市| 泸州市| 孝义市| 平阴县| 罗甸县| 沁源县| 文成县| 瑞金市| 三门峡市| 邵阳市| 金川县| 南溪县| 永川市| 安庆市| 博野县| 鲁甸县| 东安县| 即墨市| 星座| 丹寨县| 宜丰县| 固阳县| 封丘县| 乌拉特后旗| 庄河市| 五家渠市| 赣州市| 丹巴县| 三河市| 新沂市| 宁远县| 渭南市| 徐水县| 陈巴尔虎旗| 龙泉市| 仙游县| 灌南县| 邢台县|