Atmel Studio ATtiny406 avr/io.h File Do Not Exist

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

I am writing assembly code for ATtiny406 microcontroller. But, in Atmel Studio I can not find iotn406.h file which defines register address. So I can not use PORTA or other register names in assembly file. Can anyone help me to solve this problem.

 

Note: I included avr/io.h file in assembly (.S) file.

This topic has a solution.
Last Edited: Wed. Oct 14, 2020 - 07:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You need to read the header file, this device uses AVR1000 XMEGA style headers.

 

Hint, it is PORTA_DIR, PORTA_OUT, PORTA_IN or VPORTA_DIR, VPORTA_OUT, VPORTA_IN

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

Last Edited: Tue. Oct 13, 2020 - 07:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, which one should I use? Can you give me more hints :)? I am new on Atmel so, I do not understand clearly.

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

ElektroNeo wrote:
I am new on Atmel so, I do not understand clearly.

Welcome to AVRFreaks!

 

Well, like many beginners, you have chosen one of the smaller tiny AVR's to start with, most freaks would recommend you start with a mega AVR, as they have more resources, peripherals and other goodies including the ability to use a debugger with that makes learning much easier.  In fact, for beginners, an Arduino UNO is recommended as it has an ATmega328p, and no additional hardware is needed to program.

Suggest you start there, and progress to the newer xtiny's such as the one you have chosen.

Jim

edit:

An alternative to the Arduino, would be one of the xplained nano kits, which has a built in programmer/debugger and are very affordable.

https://www.microchip.com/Develo...

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

Last Edited: Tue. Oct 13, 2020 - 08:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Ideally, update the device package in Atmel Studio 7.

Else, <DFP>/include/avr/iotn406.h via http://packs.download.atmel.com/#collapse-Atmel-ATtiny-DFP-pdsc (atpack is a zip)

Device Pack Manager | Atmel Studio 7

 

"Dare to be naïve." - Buckminster Fuller

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ElektroNeo wrote:

So, which one should I use? Can you give me more hints :)? I am new on Atmel so, I do not understand clearly.

It should all be explain in the data sheet, see the description of PORT and VPORT... wink

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

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

There's even an update to AVR1000, AVR1000b. :-)

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

Very simplistically...

 

When you make the switch from tiny/mega AVR to Xmega (which now, confusingly includes Tiny/Mega AVR!) use the mapping:

 

DDRB -> PORTB_DIR

PINB -> PORTB_IN

PORTB -> PORTB_OUT

 

(sure Xmega have all the fancy _TGL, _SET, _CLR stuff too - but that's just icing on the cake - the DDR/PIN/PORT have a direct mapping to _DIR, _IN and _OUT)

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

ElektroNeo wrote:
I am new on Atmel so, I do not understand clearly

Do you have experience with any other microcontroller(s) ?

 

Do you have experience with programming in general ?

 

But the place to start with a new device is always the Product Page - it's all there:

 

https://www.avrfreaks.net/commen...

 

https://www.avrfreaks.net/commen...

 

Also, at the bottom of the Atmel Studio page, there's a load of introductory "getting started" videos and hands-on training:

 

https://www.microchip.com/mplab/avr-support/atmel-studio-7

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thanks to everyone who helped me :). I solved the problem by changing PORTA to VPORTA_OUT. Big thanks for meolsen.