Sei sulla pagina 1di 2

AVR Simulator IDE Getting Started

This presentation will help you to test the included DEMO. AS e!ample and in that way get ac"uainted with the most #re"uently used #eatures o# AVR Simulator IDE. E$AM%&E ' ( E!amine demo.)as #ile #rom the application #older. This program #irst writes *+ )ytes o# data to an e!ternal +,-+./ I+- EE%ROM and then 0eri#ies the operation )y reading the data )ac1. During these operations #ormatted te!t is displayed on the attached +!'/ character &-D module. 2ile demo.asm was generated using integrated asic compiler. 2ile demo.he! was generated using integrated assem)ler. Define Define Define Define Define Define Define Define Define Define LCD_BITS = 8 LCD_DREG = PORTB LCD_DBIT = 0 LCD_RSREG = PORTD LCD_RSBIT = 1 LCD_EREG = PORTD LCD_EBIT = 3 LCD_RWREG = PORTD LCD_RWBIT = 2 LCD_COMMANDUS = 1000 'de !" !f#e$ LCDCMDOUT% def!& # '! &e i( )000

Define LCD_DATAUS = )0 'de !" !f#e$ LCDOUT% def!& # '! &e i( 100 Define LCD_INITMS = 2 'de !" &(ed *" LCDINIT% def!& # '! &e i( 100 '#+e !(# #+$ee Define di$e,#i'e( (e# #+e '! &e( (&i#!* e f-$ (i.& !#i-n/ #+e" (+-& d *e -.i##ed f-$ ! $e! de'i,e Di. !dd$ A( W-$d Di. d!#! A( B"#e S".*S".*(d! = PORTC01 (, = PORTC00

L,dini# L,dC&$B in1 W!i#M( 1 '(&i#!* e f-$ (i.& !#i-n 2-$ !dd$ = 0 T- 31 L,d,.d-&# L,dC e!$ d!#! = 200 3 !dd$ I2CW$i#e (d!% (, % 04!0% !dd$% d!#! L,d-&# 5W$i#e T- EEPROM5 L,d,.d-&# L,dLine26-.e L,d-&# 575% 8!dd$% 59 = 5% 8d!#! W!i#M( 1 '(&i#!* e f-$ (i.& !#i-n Ne4# !dd$ 2-$ !dd$ = 0 T- 31 L,d,.d-&# L,dC e!$ I2CRe!d (d!% (, % 04!0% !dd$% d!#! L,d-&# 5Re!d 2$-. EEPROM5 L,d,.d-&# L,dLine26-.e L,d-&# 575% 8!dd$% 59 = 5% 8d!#! W!i#M( 1 '(&i#!* e f-$ (i.& !#i-n Ne4# !dd$ ( Start AVR Simulator IDE. ( -lic1 on Options3Select Microcontroller. ( Select 4ATmega*+4 and clic1 on Select )utton. ( -lic1 on Options3-hange -loc1 2re"uency.

( Enter 4,4 and clic1 on O5 )utton. ( -lic1 on Options3&ist I6O Registers 2irst. The list on General %urpose 7or1ing and I6O Registers panel will )e in0erted. ( -lic1 on Tools3 ASI- -ompiler ( -lic1 on 2ile3Open ( Select demo.)as #ile and clic1 on Open. The )asic source program will )e displayed in the editor. ( -lic1 on Tools3-ompile 8 Assem)le 8 &oad. The compiler will generate demo.asm #ile with assem)ler source. The integrated assem)ler will assem)le that #ile and ma1e demo.lst and demo.he! #iles. Demo.he! #ile will )e loaded into the simulator program memory. ( -lic1 on Tools3&-D Module. That will open the &-D Module simulator window. -lic1 on 9es to load the &-D parameters #rom the )asic program #ile. ( -lic1 on Setup )utton on the &-D Module 7indow. ( -lic1 on -hange &-D Module -olor Scheme. ( Enter 4*4 #or )lue )ac1ground choice and con#irm with O5. ( -lic1 on Apply: )utton. Reposition the windows on the screen to get )etter 0iew. ( -lic1 on Tools3I+- EE%ROM. Another simulation inter#ace will )e displayed. ( -lic1 on SDA &ine la)el and select %ORT-.' pin. ( 7ith similar procedure select %ORT-.; pin #or the S-& &ine. ( Reposition the windows on the screen to get )etter 0iew. I# needed use Always On Top option on the windows. ( Select the Rate3E!tremely 2ast simulation rate. ( -lic1 on Options3In#inite &oop Stops Simulation. ( -lic1 on Simulation3Start. The simulation will start immediately. ( 7atch the simulation on the main simulation inter#ace< &-D and I+- EE%ROM simulation modules. Around ';ms o# real simulation time will )e necessary to pass to see the #irst acti0ity on the &-D module. 7atch Real Time Duration #ield. ( The simulation can )e stopped any time )y clic1ing on Simulation3Stop. Otherwise< it will )e automatically stopped a#ter the whole program has )een simulated and in#inite loop detected. ( Try to run the simulation in Step y Step mode. Then use Run To =e!t asic Statement command. ( Screenshot> 0iew

Potrebbero piacerti anche