[TUT][ASM][Screencast] Intro to AVR Studio with Assembly

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

The link below provides users with a screencast of how to use AVR Studio 4 with assembly. The screencast includes full explanations of everything done, including writing an assembly program, simulation, and programming the AVR. This tutorial will be of use to anyone who is beginning with AVRs. Basic digital knowledge such as binary, hex, and logic operations such as AND and EOR are assumed to be known.

http://salgat.angelfire.com/AVRI... (18MB)

EDIT: Please notify me by personal messaging me or e-mailing me if the link dies. Also please forgive me for the incredible number of typos, unfortunately I lost the source for this and cannot fix them.

Last Edited: Sat. Jan 17, 2009 - 07:16 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks. Still downloading (slow connection, sorry), but can you tell me if it mentions splitting the code into multiple files/pages/modules. I'm having to do a LOT of scrolling. :(

If you think education is expensive, try ignorance.

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

Sorry, it only covers the very basics (for beginners).

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

In you example code, you wrote:

in TEMP,PORTD

That got me into trouble a few days ago, and one of the gurus here set me straight.

Quote:
Read PIN, write PORT.

So your code should be:

in TEMP,PIND

If you think education is expensive, try ignorance.

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

I believe that only matters when the PORT is set to be an Input, but if it is standard practice I will fix it. Any other feedback is helpful.

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

Quote:
splitting the code into multiple files/pages/modules.
Nothing too complicated there. ie if you are using a USART then put all the USART code into a file then .include that file in you main program. A snippet from one of my programs:
;Mega88 start up code

.nolist
.include	"m88def.inc"
.include	"c:\avr\lib\ASCII_table.asm"	
.list

.include	"c:\avr\projects\dis25100\dis25100_equ.asm"
.include	"c:\avr\projects\dis25100\dis25100_ram.asm"
.include	"c:\avr\lib\int_v_m88.asm"

.cseg

RESET:

more main code...
at the end of main

;Include files area
.include	"c:\avr\projects\dis25100\dis25100_init.asm"
.include	"c:\avr\lib\rs485com_mega88.asm"
.include	"c:\avr\lib\h2d_d2h8.asm"
.include	"c:\avr\lib\6x6_5x8_dis25100.asm"
.include	"c:\avr\projects\dis25100\dis25100_mon.asm"
.include	"c:\avr\lib\cgn5x7_1252_ex1.asm"
.include	"c:\avr\lib\sw_timers.asm"
.include	"c:\avr\projects\dis25100\int_s_dis25100.asm"
.include 	"c:\avr\lib\TWI_master_m48_m88_m168.asm"
.include 	"c:\avr\lib\DS1307_driver.asm"
.include 	"c:\avr\lib\TSL2561_driver.asm"
.include 	"c:\avr\lib\luxmeter_calcs.asm"

As you can see the main is comparatively small, most of the work is broken up into smaller files, some of which are library file of working code so one never need to look at that at all.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Thanks js. I really needed to know that. :D

If you think education is expensive, try ignorance.

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

Thank you very much, Salgat. The stack ptr setup was very helpfull :)

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

Thanks Salgat! I finally begin to see the logic in asm programming. :)