ATMega8535 info

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

I noticed that ATMega8535 has a 16bit timer counter and 16 bit eeprom. So, is it possible to make 16bit operation between timer counter 1 and eeprom?

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

What kind of operation?

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

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

Quote:

and 16 bit eeprom.

Last time I looked all AVR EEPROM was byte addressable?!?

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

If i would measure te period of a signal with high precision i need fast clock and at least 16 bit. But i need also a LUT to compare the measured value, so if i use a 16bit timer counter i have TCNT1L and TCNT1H 8 bit each and i need a 16 bit eeprom to compare.

clawson wrote:
Quote:

and 16 bit eeprom.

Last time I looked all AVR EEPROM was byte addressable?!?

What does it means byte addressable?

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

Quote:

What does it means byte addressable?

That every byte can be addressed individually.

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

Hmmm--I >>think<< OP is looking at EEARL/EEARH and seeing that it is a 16-bit address. Then his Timer1 has a 16-bit value, in TCNT1/ICR1/etc.

Then the mention of the lookup table leads me to speculate that OP wants to take a 16-bit timer count value and use it as the address in an EEPROM table.

For the OP: While the Mega8535 (or any AVR for that matter) may indeed have and use a 16-bit address EEARL/EEARH only a few bits of EEARH are ever used. See the datasheet--that model probably has about 512 bytes of EEPROM.

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

Yes the eeprom is byte addressable. Atmega8535 has 512 byte eeprom. So, it is possible to use the eeprom as it wes 16 bit each address? I didn't find anything in the datasheet

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

Yes you can. You store the two bytes of your 16 bit value in sequential eeprom locations.

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

so starting from 0x00 do i store TCNT1L on 0x00 and TCNT1H to 0x01 eeprom address ?

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

You can choose to store it however you want to - it's your EEPROM - free for you to use how you see fit.

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

clawson wrote:
You can choose to store it however you want to - it's your EEPROM - free for you to use how you see fit.

So the high bit and the low bit can be stored wherever i want but i've got just to remember it right? Thanks a lot to everyone!

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

Well normally your C compiler lets you do something like:

// for GCC
uint16_t eevar EEMEM;
eeprom_write_(&eevar, 12345);
// for Codevision
eeprom uint16_t  eevar;
eevar = 12345;

The compiler or its support library handles the allocation of the EEPROM storage location and the byte ordering so you don't have to worry. You just use:

// GCC
uint16_t myvar = eeprom_read_word(&eevar);
// Codevision
uint16_t myvar = eevar;

to read the value back from EEPROM. The compiler handles the reconstruction of the byte order.

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

Actually i don't know anything about c but i'm going to start to learn ti soon. I use the assembly. I think i have to store the high bit and the low bit separately

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

If you are using Asm it's completely your choice how you order multi-byte data either in RAM or EEPROM. If you want to be really perverse you could even choose to do it little endian in RAM and big endian in EEPROM (or vicky verky).

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

Thanks a lot!