Pages: [1]   Go Down
Author Topic: datasheet notation means what?  (Read 634 times)
0 Members and 1 Guest are viewing this topic.
Delray Beach, FL USA
Offline Offline
Full Member
***
Karma: 0
Posts: 113
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset 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 smiley-mad 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 Offline
Edison Member
*
Karma: 65
Posts: 2112
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset 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 Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset 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

[ I won't respond to messages, use the forum please ]

Delray Beach, FL USA
Offline Offline
Full Member
***
Karma: 0
Posts: 113
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset 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 Offline
Shannon Member
****
Karma: 200
Posts: 11730
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset 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

[ I won't respond to messages, use the forum please ]

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 93
Posts: 3972
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset 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 smiley-roll
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Pages: [1]   Go Up
Jump to: