在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,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首頁 > 嵌入式系統(tǒng) > 設計應用 > AVR128的程序——EEPROM記錄復位次數(shù)

            AVR128的程序——EEPROM記錄復位次數(shù)

            作者: 時間:2016-11-22 來源:網(wǎng)絡 收藏
            #include
            #include
            #define uchar unsigned char
            #define uintunsigned int
            void EEPROM_write(uint EEPROM_ADDR, uchar EEPROM_DAT);
            void Delayms(uint MS);
            void display(uchar FirstBit,uchar Num);
            void Mcu_IO_Init(void);
            uchar EEPROM_read(uint EEPROM_ADDR);
            uchar TempData[8];
            uchar WeiMa[8] = {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
            uchar led_discode[11]={0xc0,0xf9,0xa4,0xb0,0x99,
            0x92,0x82,0xf8,0x80,0x90,0xff};
            void main(void)
            {
            uchar i;
            Mcu_IO_Init();
            i=EEPROM_read(1);
            i++;
            EEPROM_write(1,i);
            TempData[2] = led_discode[i/100];
            TempData[1] = led_discode[i];
            TempData[0] = led_discode[i/10];
            while(1)
            {
            display(6,2);
            }
            }
            void Mcu_IO_Init(void)
            {
            DDRA=0XFF;
            PORTA=0XFF;
            DDRC=0XFF;
            PORTC=0XFF;
            DDRF|=0X0E;
            PORTF|=0X0E;
            PORTF&=0xF7;
            DDRB |=0X10;
            PORTB|=0X10;
            }
            void EEPROM_write(uint EEPROM_ADDR, uchar EEPROM_DAT)
            {
            CLI();
            while(EECR & (1<
            EEARH = 0X00;
            EEARL = EEPROM_ADDR;
            EEDR = EEPROM_DAT;
            EECR |= (1<
            EECR |= (1<
            SEI();
            }
            uchar EEPROM_read(uint EEPROM_ADDR)
            {
            CLI();
            while(EECR & (1<
            EEARH = 0X00;
            EEARL = EEPROM_ADDR;
            EECR |= (1<
            return EEDR;
            SEI();
            }
            void display(uchar FirstBit,uchar Num)
            {
            unsigned char i;
            for(i=0;i
            {
            PORTC=led_discode[10];
            PORTA=WeiMa[i+FirstBit];
            PORTC=TempData[i];
            Delayms(5);
            }
            }
            void Delayms(uint MS)
            {
            uint i,j;
            for( i=0;i
            for(j=0;j<1141;j++);
            }


            關(guān)鍵詞: AVR128EEPROM復位次

            評論


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

            關(guān)閉