Register names in several chips

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

I want to share my code with other AVR freaks, but as now, it just works only on several chips.

I wanted to know if exists a table with the name of several registers for each chip available.

For example, timer register names differ from m168 to m128. I want to define all possible cases in my code.

thanks

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

Quote:

all possible cases

As regular readers know, I just LOVE these superlative requests.

So, with about 100 different AVR models currently available, you want code to do them all?

Take a glance at io.h for your compiler, and the shenanigans it must go through to just pick the right chip include file. Then go through all those files and create "all possible combinations".

In addition, or instead of, at a different level do an app that processes all of the chip .XML files from Atmel.

BTW, what good are register >>names<< when the bits in the registers can vary? Also, the meaning of the bits (e.g. clock prescalers) might be different.

Oh, yes: If you want to do timers (e.g., flash an LED at 1Hz) or communications (e.g. send "Hello, world!" to a PC), then you also need to write your translator for "all possible" clock rates. I'll concede on fractional Hertz-es. I'll even let you get away with mod 100. Lessee, now--AVRs have fully static operation so for 100Hz - 20MHz that is 200000 combinations. I suppose you'll scoff at that. But consider that to simply blink the LED at 1Hz with an AVR timer you will need to pick the proper timer prescaler as well as the number of counts...

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.

Last Edited: Wed. May 12, 2010 - 06:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's something I just tried:

C:\WinAVR-20100110\avr\include\avr>grep TCC * | wc -l
   2178

So the substring TCC appears 2,178 times in the header files for GCC. I think you have a tough job on your hands!

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

lol, ok, so it's impossible to code for all mcu's, but what are the most used families?

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

Quote:

what are the most used families?

If you are privy to Atmel's shipments by model/family, please share with all of us.

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.

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

Quote:

what are the most used families?

Are you planning to write a completely generic piece of code that can run on all AVRs?

Apart from register names being different there are also actual differences between how eg timers are working. True, they are the same on many (later) AVR models, but it is not universally true. So apart from having different names that you have to take provisions for, you also have to deal with different code for different models.

Will it be worth it?

If you have a code mass that solves problems on a level higher than the actual register access, then instead of trying to get that code generic by programming for all different AVRs, instead define an interface layer below your generic code that every user of your code has to write to get it working on a specific AVR model. If you give more details of your problem, we might give more details on such an approach.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

It may be worth looking at what other "generic" libraries do. Look at code from Peter Fleury and Pascal Stang. They tend to have written it to work on "most" of the AVR models by using various #ifdef's dependent on model/architecture. Something like the Arduino bootloader is another useful example though it's only actually designed to be built for about 10 different AVR models.

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

ok, i'll check it.

thanks guys