ATmega328P Registers

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

Hi,

I am learning basics of embedded electronics using ATmega328P ("Beyond Arduino", from "Nuts&Volts" magazine). In many names of registers and signals there appears a small letter "n" as in these: XCKn, UDRn, UBRRnL, U2Xn, etc.

 

In the project that I am following from the article "n" is substituted by "0" as in these: UBRR0L, UCSR0C, UDR0, etc.

 

I was digging through data sheet for this controller and couldn't find any explanation where is it coming from, what is the meaning of this letter. I guess it is a number but what does it represent? Why "0" in case of this particular project?

 

Please, help me understand this.

 

Thanks.

 

krzysiekf

Last Edited: Sun. Sep 20, 2015 - 03:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

If there are two or more instances of the same peripheral, then they are distinguished by their index. This is common for communication interfaces and timers, for example.

 

Which one to use - look in the MCU pinout diagram and check which peripheral is connected to the pins you want to use. Or rather pick the pins that are connected to the peripheral you want to use.

 

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

Last Edited: Sat. Sep 19, 2015 - 11:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A confusing feature of the datasheet for the ATmega48/88/168/328 is that the USART is referred to in this manner, when in fact there is only >>one<< USART in any of those devices.

 

I had always suspected that this was Atmel thinking ahead to a future member of that family.  With the recent release of the ATmega328PB, this theory seems to be true since the preliminary datasheet shows that this device does in fact have two USARTs:  USART0 and USART1.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

using ATmega328P

You do realise that that's NOT a Xmega chip smiley I'll move the thread. (I hope!)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Sun. Sep 20, 2015 - 03:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for posting at the wrong placeblush.

 

Thank you all for such a quick response - now I can sleep, no more terrifying thoughts of not being able to understand!smiley