欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 新鮮出爐_ATmage128內(nèi)部EEPROE的應用程序 [打印本頁]

作者: jinsheng7533967    時間: 2018-12-10 15:48
標題: 新鮮出爐_ATmage128內(nèi)部EEPROE的應用程序

新鮮出爐! ATmage128的EEPROE實戰(zhàn)!
按按鍵進行調(diào)節(jié)模式,相對應LED有不同的反應,關(guān)機后保存數(shù)據(jù)



#include<iom128v.h>
#include<macros.h>

#define uchar unsigned char
#define uint  unsigned int
uint bai, shi, ge;   
uchar temp ;
uchar smg[]={0xc0,0xf9,0xa4,0xb0,0x99,
0x92,0x82,0xf8,0x80,0x90,0xff};  
uchar tttt(uchar t)        
{
        t=0x03;
}
uchar ledsmg(uchar kl);

void delay(uchar n)      
{
        uint i=0,j=0;
        for (i=0;i<n;i++)
                for (j=0;j<20;j++);
}

void PO_init(void)
{
        DDRA=0XFF;             //LED IO口設(shè)為輸出
        PORTA=0X00;
        
        DDRB |=0xff;           //PB4設(shè)為輸出
        PORTB|=0xff;           //關(guān)閉PB4外接的LED
        
        DDRC=0XFF;             //數(shù)碼管段選設(shè)為輸出
        PORTC=0X00;            
        
        DDRF |=0X03;           //LED及數(shù)碼管鎖存IO口設(shè)為輸出
        PORTF|=0X0E;           
        PORTF&=0xF7;           //鎖存數(shù)據(jù)關(guān)閉數(shù)碼管
        
        DDRD=0;//全部設(shè)為輸入
        PORTD=0xff;//全部上拉
        PIND=0xff;//設(shè)初始值
}

void display(void )
{
        PORTC =smg[bai];
        P5_1;
        P5_0;
        delay(3);
        
        PORTC =smg[shi];
        P6_1;
        P6_0;
        delay(3);
                                
        PORTC =smg[ge];
        P7_1;
        P7_0;
        delay(3);
}

void data_do(uchar temp_d)
{
        uint shit;
        bai = temp_d/100;                       //分出百,十,和個位
        shit= temp_d%100;
        shi = shit/10;
        ge  = shit%10;
}

void E_write(uint E_add, uchar E_data)//寫字節(jié)數(shù)據(jù)
{
        while(EECR & (1<<EEWE));
        EEARH = 0;              
        EEARL = E_add;         
        EEDR  = E_data;      
        EECR |= (1<<2);         
        EECR |= (1<<1);         
        SREG |= (1<<7);
}

uchar E_read(uint E_add)  //讀字節(jié)數(shù)據(jù)
{
        while(EECR & (1<<EEWE));
        EEARH = 0;              
        EEARL = E_add;   
        EECR |= (1<<EERE);
        return EEDR;      
}
void key(void)
{
        if(PIND == 0xfe)  //按鍵--加鍵
        {
                delay(3);
                if(PIND == 0xfe)
                {
                        while(PIND == 0xfe);
                        temp++;
                        if(temp>=6)temp=0;
                }
        }
}

void main()
{
        
    PO_init();

        temp=E_read(5);                //讀出記錄  
        
        E_write(5,temp);    //寫入記錄
        
        while (1)
        {                  
               
                key()

.................................................
代碼只貼一部份,附件中有全部

128_eeprom_hxk文件.zip

1003 Bytes, 下載次數(shù): 9, 下載積分: 黑幣 -5

128_eeprom源代碼.zip

1.08 KB, 下載次數(shù): 13, 下載積分: 黑幣 -5

128_eeprom仿真文檔.zip

29.4 KB, 下載次數(shù): 10, 下載積分: 黑幣 -5






歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1