Pages: [1]   Go Down
 Author Topic: datasheet notation means what?  (Read 261 times) 0 Members and 1 Guest are viewing this topic.
Delray Beach, FL USA
Offline
Full Member
Karma: 0
Posts: 112
 « on: March 28, 2012, 08:31:21 pm » Bigger Smaller Reset

I guess this is a programming question :-). I'm trying to understand the notation used in the atmel datasheet to describe things like the timer control registers. A particular example is taking about WGM22:0 being set to 1 or 5 or 7. What on earth does that mean? There is a single bit named WGM22 in the TCCR2B register. How can it be anything other than 0 or 1? I assume the on the end is supposed to convey something, but I have no idea what that might be :-). Is there a section in the datasheet that explains the notation? (Because I can't find it if there is :-).
 Logged

North Queensland, Australia
Offline
Edison Member
Karma: 31
Posts: 1209
 « Reply #1 on: March 28, 2012, 08:37:44 pm » Bigger Smaller Reset

I had a quick search and this popped up: http://extremeelectronics.co.in/avr-tutorials/avr-timers-an-introduction/
Looks like it might answer a few things
 Logged

0
Offline
Tesla Member
Karma: 73
Posts: 6638
Arduino rocks
 « Reply #2 on: March 28, 2012, 08:52:20 pm » Bigger Smaller Reset

2:0 means bits 2 to 0 of the register/value, ie the bottom 3 bits.  7:4 would mean the top 4 bits of a byte value, etc etc.
 Logged

Delray Beach, FL USA
Offline
Full Member
Karma: 0
Posts: 112
 « Reply #3 on: March 28, 2012, 08:58:22 pm » Bigger Smaller Reset

2:0 means bits 2 to 0 of the register/value, ie the bottom 3 bits.  7:4 would mean the top 4 bits of a byte value, etc etc.

There must be some additional level of abstraction being employed in the case of WGM22 in particular. It is a single bit in one control register, and the WGM21 and WGM20 bits are in a completely different control register. I guess what they mean is that if I were to pretend WGM22,WGM21,WGM20 formed a 3 bit logical value, then I'd want to set it to 5 or 3 or whatever, but that is so peculiar, I sure wish I could find an official atmel document describing their strange and wondrous notation :-).
 Logged

0
Offline
Tesla Member
Karma: 73
Posts: 6638
Arduino rocks
 « Reply #4 on: March 28, 2012, 09:09:26 pm » Bigger Smaller Reset

WGM22:0 means WGM2[2:0] - they've just abbreviated it for convenience (!).  They sometimes say "bits 2...0", so not very consistent, but clear enough from context (if you've read most of the datasheet it's pretty obvious what is meant.)

Either that or the conversion to PDF format lost a few special characters?
 Logged

Grand Blanc, MI, USA
Offline
Karma: 43
Posts: 2518
"We're a proud service of the Lost Electricity Reclamation Agency"
 « Reply #5 on: March 28, 2012, 10:12:02 pm » Bigger Smaller Reset

I guess what they mean is that if I were to pretend WGM22,WGM21,WGM20 formed a 3 bit logical value, then I'd want to set it to 5 or 3 or whatever, but that is so peculiar, I sure wish I could find an official atmel document describing their strange and wondrous notation :-).

That is exactly what they mean, don't think I've seen it explained anywhere. Looking at some of the tables (like 18-8) makes it pretty clear, though. There's probably some story about how the bits got split between the two registers. It must be a hum dinger, given that TCCR2A bit 2 is unused ... exactly the right place for WGM22
 Logged

Get the infamous "One Million Ohms" board at tINDIE.com: http://tinyurl.com/BuyMohms

 Pages: [1]   Go Up