Vous êtes sur la page 1sur 9

The Bas i cs ofA V R St udi o4

Thi st ut or i alw i l ls how you t he bas i cs ofA V R C pr ogr am m i ng us i ng A V R St udi o 4. Thi s gui de w i l ls how you how t os etup a pr oj ect ,i ns er ts om e code, how t o com pi l ei t ,how t os wi t ch t o us i ng t he J TA G ,and s om e bas i cs on debuggi ng.

Set t i ng up a proj ect 1. )O pen A V R St udi o4 St ar t! Pr ogr am s ! A t m elA V R Tool s ! A V R St udi o4 Y ou s houl dt hen s ee t hi sw i ndow :

2. )Cl i ck N ew Pr oj ect 3. )Sel ectA V R G CC and ent era pr oj ectnam e,pl aci ng i ti n an appr opr i at e pl ace ( Z: \ 466 i ss how n her e) . Cl i ck N ext .

4. )Sel ectA V R Si m ul at oras yourD ebug pl at f or m and t he A Tm ega16 as yourD evi ce. Cl i ck Fi ni s h.

5. )N extgo t o Pr oj ect! Conf i gur at i on O pt i ons U ndert he G ener alTab m ake s ur et hatC reat e H ex Fi l e,G enerat e M ap Fi l e,and G enerat e Li s tFi l e ar e checked

I ns ert i ng s om e code and com pi l i ng i t Com pi l i ng i nAVR s t udi oi s eas y. Fi r s tent eryourcode t hen cl i ck t he bui l d but t on. I fi nf or m at i on on t he A V R m em or y does n tcom e up af t ert he bui l d, t hen t he bui l d pr obabl yf ai l ed.

I fyou w antt o change any oft he com pi l e opt i ons ,go t o Pr oj ect! Conf i gur at i on O pt i ons Thi ngs l i ke t he opt i mi zat i on f l ags and w het herchar s ar es i gned oruns i gned m ay be f ound i nt he G ener alTab. er ed i nt he Cus t om O pt i ons Tab. M or es peci f i c com pi l ef l ags m ay be ent

Set t i ng up t he JTA G To s wi t ch f r om Si m ul at i on t ot he J TA G ,f ol l ow t hes es t eps : 1. )Fr om t he m ai ns cr een go D ebug ! Sel ectPl at f or m and D evi ce 2. )Sel ectJ TA G I CE orJ TA G I CE m kI Idependi ng on w hi ch devi ce you ar e us i ng ( l ook f ort he l abelon yourdevi ce)and A Tm ega16

3. )Cl i ck Fi ni s h.

Us i ng t he JTA G t o program t he A Tm ega16 1. )Bui l d yourpr oj ect 2. )Cl i ck t he A V R but t on 7 but t ons t ot he l ef toft he Com pi l e but t on. I t l ooks l i ke t hi s : 3. )Thi sw i ndow s houl d pop up:

Sel ectJ TA G I CE orJ TA G I CE m kI Iand CO M 1

Cl i ck Connect .

Bas i cs ofD ebuggi ng D ebuggi ng i st he s am e w het heri ns of t w ar e orhar dw ar e. The onl y di f f er ence i st hatyou m us ts el ectyourdevi ce as ei t herA V R Si m ul at or ( s of t w ar e) ,orJ TA G I CE ( orJ TA G I CE m kI I )( har dw ar e) . The i nt er f ace i s m uch t he s am e as V i s ualSt udi o orany ot herdebuggi ng i nt er f ace you m ay have us ed. Y ou can s etbr eakpoi nt s ,add var i abl es t oa w at ch l i s t ,et c. A V R St udi o 4 has m any i nt er act i ve debuggi ng f eat ur es .Fort he pur pos es of t hi s cl as st he t w o bas i c m et hods you w i l lus et o debug ar et he A V R Si m ul at orand t he J TA G .A tt he bot t om ofyours cr een A V R St udi o di s pl ays w hatdevi ce/ chi pi tw i l li nt er actw i t h w hen debuggi ng and w hi ch debuggeri t wi l lus e.Bel ow i s a pi ct ur e oft he St at us Bars how i ng t hatt he devi ce i s an A TM ega16 and t he debug pl at f or m i st he A V R Si m ul at or .

To change t he t ar getdevi ce f ordebuggi ng and/ ort he debug pl at f or m go t o t he D ebug m enu and s el ectt he m enu opt i on Sel ectdevi ce and debug pl at f orm . I nt hi sw i ndow you can s el ectA V R s i m ul at ori fyou w antt o debug i ns i m ul at i on ori fyou w antt o debug di r ect l y on yourhar dw ar e choos e ei t herJ TA G I CE orJ TA G I CE m kI I( dependi ng on w hi ch J TA G you have atyours t at i on) .

The debuggeri n AVR s t udi or uns s i mi l art o ot herdevel opm ent envi r onm ent s .Bes i des t he opt i ons i nt he debug m enu t her ei sa t ool bar ( s how n bel ow ) t o cont r olt he debugger .For m ore i nf orm at i on on how t o cont rolt he debugger ref er t ot he A V R St udi o H el p M enu.

O ne oft he m os tpow er f ulf eat ur es oft he debuggeri st he abi l i t yt o vi ew t he cur r ents t at es ofany oft he r egi s t er s .Y ou can vi ew t he cur r entval ue ofany r egi s t eri nt he I / O vi ew t ab.

A not herus ef ulf eat ur e oft he A V R St udi o 4 debug s ys t em i st he w at ch wi ndow w hi ch al l ow s you t os ee w hatt he val ue any var i abl ei si nt he RA M . To vi ew t he cur r entval ue ofa var i abl e us e,add t he var i abl et ot he w at ch wi ndow .

Vous aimerez peut-être aussi