volatile 32bit var & eeprom

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hello, i'm trying to declare the following

volatile uin32_t Es;

but i get the following error

../monitor2.c:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Es'

could you tell me how to fix it?

Also, in case of a power outage i need to save the value stored in Es in eeprom - Es was a double and i was doing

eeprom_write_word(&eeEtots, (unsigned int)Es);	

Now that it's an unsigned 32-bit variable, is this correct?:

eeprom_write_dword (&eeEtots, Es);

where eeEtots is declared

uin32_t EEMEN eeEtots = 0;

Thank you!

- Eric

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
volatile uin32_t Es;
Is this a copy of what you wrote? You are missing a t uint32_t

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And if you really did type uint32_t then try #include'ing

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ooops ... i missed the t... thanks guys :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Alway cross your Ts and dot you is..... :wink:

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

one more question! how do i convert the uint32 variable to char if itoa is

extern char *itoa(int __val, char *__s, int __radix);

if i would do

char Es_str[8];
volatile uint32_t Es;
itoa((int)Es,Es_str,10);

i'll probably lose accuracy / bits (?)

thanks,
Eric

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

schamton wrote:
i get the following error
../monitor2.c:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Es'

could you tell me how to fix it?

This is one of GCC's really brain-dead diagnostic messages.

The message is 100% correct but 100% useless.

Dunno why the message does not quote the unknown/problematic token (uin32_t in this case)...

avrfreaks does not support Opera. Profile inactive.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
how do i convert the uint32 variable to char if itoa
You can't, that is why they created ltoa.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks Steve, wasn't sure if 'unsigned long int' for the m64 is 'uint32' - i think it'd be ultoa -

- Eric