Go Down

### Topic: datasheet notation means what? (Read 1 time)previous topic - next topic

#### Claghorn

##### Mar 29, 2012, 03:31 am
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

#1
##### Mar 29, 2012, 03:37 am
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
https://forum.arduino.cc/index.php?action=dlattach;topic=327736.0;attach=128670 New EEPROM library released

#### MarkT

#2
##### Mar 29, 2012, 03:52 am
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 will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### Claghorn

#3
##### Mar 29, 2012, 03:58 am

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

#4
##### Mar 29, 2012, 04:09 am
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 will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### Jack Christensen

#5
##### Mar 29, 2012, 05:12 am

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

Go Up

Please enter a valid email to subscribe