ATtiny 13 A & 32 bit variables?

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

Does 32 bit variables work with gcc? I have feeling that 32 bit calculations have some problems?

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

Quote:
Does 32 bit variables work with gcc?
Of course they do.
Quote:
I have feeling that 32 bit calculations have some problems?
I'm not sure why you would say that. Certainly on the tiny13 you will have to be careful how many you use since it only has 64 bytes of ram.

Regards,
Steve A.

The Board helps those that help themselves.

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

Of course they work but beware the integer promotion rules of C and the fact that the natural int size of AVR is just 16 bits so intermediate calculation results can often overspill the implied -32768..+32767 integer range of integer constants.

Try appending some "UL"s to any numeric constants involved in calculating a 32bit result and this will promote the whole calculation to 32bit.

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

Quote:
Does 32 bit variables work with gcc?
Yes, whether you have enough ram in the T13 it's another story. Maybe you can add 2 32 bit numbers together. :?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:

Yes, whether you have enough ram in the T13 it's another story. Maybe you can add 2 32 bit numbers together.

LOL--Reminds me of a past project creating an industrial counter. The app was fairly simple so the first choice was a similar "SRAM challenged" AVR model. The kicker was a 40-bit counting requirement. I got it to fit--barely. Nowadays it would be easier. Back then there weren't as many AVR models, and each was "several dollars". Nowadays it is "less than a couple dollars" for e.g. Mega48 and "less than a dollar" to move up to e.g. Mega88 (with a whopping 1K of SRAM!).

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.