Pengetahuan Dasar Simpan Data Char Integer dan Array di EEPROM

[under construction]

untuk menyimpan data ber type char  di EEPROM  baik di codevision maupun di arduino sudah ada fungsi yg menyediakannya.

Contoh Code , blm ditest

void writeInteger(int addr, int dataeeprom)
{
writeeeprom(addr+1, dataeeprom & 0xff);
writeeeprom(addr, (dataeeprom>>8) & 0xff);
}

int ReadInteger(int addr)
{ char value=0,value2=0;
value = readeeprom(addr);
value2 = readeeprom(++addr);
value = (value <<8) & 0xff00;
value = value | value2;
return value;
}

void writeeeprom(unsigned int alamat, unsigned char datana)
{
while(EECR & (1<<1));
EEAR = alamat;
EEDR = datana;
EECR |= (1<<2);
EECR |= (1<<1);
delay_ms(10);
}
unsigned char readeeprom(unsigned int alamat)
{
unsigned char dataeeprom;
while(EECR & (1<<1));
EEAR = alamat;
EECR |= (1<<0);
dataeeprom=EEDR;
return dataeeprom;
delay_ms(10);
}

void simpanArrayKeEEPROM( int array[],int alamat)
{ char i=0;

for(i=0;i<13;i++)
{
writeInteger(alamat, array[i]) ;
alamat=alamat+2;
}
}

 

 

About pccontrol

Berisi Tutorial Menggunakan PC untuk mengontrol Peralatan dengan cara mudah & praktis.

Posted on 26/10/2016, in Arduino, AVR, Daftar isi. Bookmark the permalink. Leave a comment.

Komentar ,Saran atau Pertanyaan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: