avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] using EEPROM


From: Artur Lipowski
Subject: Re: [avr-gcc-list] using EEPROM
Date: Mon, 20 Oct 2003 08:04:10 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031013 Thunderbird/0.3

Jack Valmadre wrote:
What I want the program to do is write a single byte (localVar) to EEPROM
address 0, then read it and output it to PORTB.  However all the pin on
PORTB are just going low.  What have I done wrong and how can I fix it?
As I understand it is exercise only and not for production purpose because avr-libc has build-in such functionality.

unsigned int eVar1 EEPROM = 0;
unsigned int eVar2 EEPROM = 0;
There are two bytes variables. If you wan one byte use unsigned char or (IMO preffered) uint8_t types.

...
> eeprom_read_block(&a, ptr, 1);
                             ^
                             |
You write two bytes and read back only one (which is MSB) and equals 0.

All is correct ;-)

Regards,
--
Artur Lipowski



reply via email to

[Prev in Thread] Current Thread [Next in Thread]