Go Down

Topic: datasheet notation means what? (Read 758 times) previous topic - next topic

Claghorn

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 :0 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 :-).
http://home.comcast.net/~tomhorsley/hardware/arduino/arduino.html

pYro_65

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

MarkT

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.
[ I won't respond to messages, use the forum please ]

Claghorn


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 :-).
http://home.comcast.net/~tomhorsley/hardware/arduino/arduino.html

MarkT

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?
[ I won't respond to messages, use the forum please ]

Jack Christensen


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:
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Go Up