Atmel AVR AT90S8515-4 Manuale Utente Pagina 10

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 17
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 9
AN INTRODUCTION INTENDED FOR PEOPLE WITH NO PRIOR AVR KNOWLEDGE - AVRFREAKS.NET
9
Writing your First AVR Program
At this point you should have installed the software, and started up the a new
project called "Leds" You should also have the AT90S8515 Datasheet, stored
somewhere you can easily find it. If you can answer "Yes" to both these
questions, you are ready to continue writing some AVR Code.
In the Editor view in AVR Studio, continue your program (which at this point only
consists of the first line below) by adding the text below. (Cheaters can simply
cut & paste the source below into AVR Studio...)
;My Very First AVR Project
.include "8515def.inc" ;Includes the 8515 definitions file
.def Temp = R16 ;Gives "Defines" Register R16 the name
Temp
.org 0x0000 ;Places the following code from address
0x0000
rjmp RESET ;Take a Relative Jump to the RESET Label
RESET: ;Reset Label
ldi Temp, 0xFF ;Store 255 in R16 (Since we have defined
R16 = Temp)
out DDRB, Temp ;Store this value in The PORTB Data
direction Register
Loop: ;Loop Label
out PORTB, Temp ;Write all highs (255 decimal) to PORTB
dec Temp ;Decrement R16 (Temp)
rjmp Loop ;Take a relative jump to the Loop label
Note that the source code changes color when written in the editor window. This
is known as syntax highlighting and is very useful make the code more readable.
Once the Source code is entered, press CTRL + F7 or select [Build and Run] from
the [Project] Menu.
Vedere la pagina 9
1 2 ... 5 6 7 8 9 10 11 12 13 14 15 16 17

Commenti su questo manuale

Nessun commento