F].SI4EVHYI
PART 1:
Introducing the AVR C Programming Workshop Series TVSKVEQQMRKERHQMGVS GSRXVSPPIVWEVIX[SFMK...
94 downloads
961 Views
10MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
F].SI4EVHYI
PART 1:
Introducing the AVR C Programming Workshop Series TVSKVEQQMRKERHQMGVS GSRXVSPPIVWEVIX[SFMKXSTMGW TVEGXMGEPP]GSRXMRIRXEPMRWM^I ERHPMOIGSRXMRIRXWEVIIEW]XSKIX PSWXMR'SQFMRMRKXLIX[SMWEPMXXPI PMOIXVEMTWMRKJVSQ%PEWOEXS8MIVVEHIP *YIKS'LERGIWEVI]SYvPPKIXXSXEPP] PSWXERHMJXLIREXMZIWHSRvXIEX]SY ]SYVMRJIGXIHFPMWXIVW[MPPQEOI]SY [ERXXSWMXERHTSYX-vZIFIIRHS[R XLMWVSEHWSQER]XMQIWXLEXTVSFEFP]LEZIQ]S[RTIVWSREPVYX IXGLIHMRXLIQIXETLSVMGEPWSMPERH -GERTSMRXXSXLIWLEVTVSGOW-vZI WXITTIHSRXLIFVERGLIWXLEXLEZI [LEGOIHQIMRXLIJEGIERHXLI FYWLIWJVSQ[LMGLXLITVIHEXSVW PIETX-J]SYKIXXLIMQEKISJE VEKKIH]FYQWXYQFPMRKXLVSYKLXLI NYRKPI]SYvZIKSXQIVMKLX'SRWMHIV XLIWI[SVOWLSTWEGSQFMREXMSR VSEHQETKYMHIFSSOERHIQIVKIRG] JMVWXEMHOMXJSV]SYVNSYVRI]MRXSXLMW JEWGMREXMRKFYXWSQIXMQIWHERKIVSYW [SVPH -LMKLP]VIGSQQIRHXLEX]SY KIXXLIFSSO8LI'4VSKVEQQMRK 0ERKYEKI{ 7IGSRH)HMXMSR F] /IVRMKLERERH6MXGLMILIVIEJXIV VIJIVVIHXSEW/ 6(IRRMW6MXGLMI *MKYVI [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[EVI2:
8LI7XERHEVHJSV GLIGOMRK 'ETEGMXSVWMRGMVGYMX
0SGEXIWLSVXIHSV PIEO] GSQTSRIRXWSV GSRHMXMSRW XSXLII\EGXWTSXMRGMVGYMX
+SSHIRSYKLXSFIXLI GLSMGISJ4EREWSRMG 4MSRIIV2&'%&'*SVH .:'2%7% ERHXLSYWERHW SJMRHITIRHIRXWIVZMGI XIGLRMGMERW -RI\TIRWMZIIRSYKLXSTE]JSVMXWIPJMRNYWX SRIHE]tWVITEMVW%XMXtWEJJSVHEFPI %RH[MXLEHE]XVMEPTIVMSHWEXMWJEGXMSR KYEVERXIIHSVQSRI]FEGOTSPMG]XLISRP] XLMRK]SYGERPSWIMWEPPXLIXMQI]SYtVI GYVVIRXP]WTIRHMRKSRXV]MRKXSVITEMVEPP XLSWIHSKW]SYtZIKMZIRYTSR
'ET%REP]^IV %
7XMPPGYXXMRKYTXLITGF ERHYRWSPHIVMRKIZIV] TEVXXV]MRKXSKYIWWEX [LIVIXLIWLSVXMW# =SYV(:1WLS[WXLIWEQIWLSVXIHVIEHMRKEPP EPSRKXLITGFXVEGI0IEO7IIOIV&LEWXLI VIWSPYXMSRXSJMRHXLIHIJIGXMZIGSQTSRIRX 8SYGLTEHWEPSRKXLIXVEGIERH0IEO7IIOIV FIITWLMKLIWXMRTMXGLEXXLIHIJIGXtWTEH2S[ ]SYGERPSGEXIEWLSVXIHTEVXSRP]EUYEVXIVSJ ERMRGLE[E]JVSQEKSSHTEVX7LSVXGERFI JVSQXSSLQW
0IEO7IIOIV &
%ZEMPEFPIEX]SYVHMWXVMFYXSVSVGEPP [[[IHWMRGGSQ
)PIGXVSRMG(IWMKR7TIGMEPMWXW
%YKYWX
- Print Pages
55 of 100
http://nutsvolts.texterity.com/nutsvolts/200809/templates/pageviewer_pr...
04/09/2008 11:40 م
- Print Pages
56 of 100
http://nutsvolts.texterity.com/nutsvolts/200809/templates/pageviewer_pr...
04/09/2008 11:40 م
- Print Pages
57 of 100
http://nutsvolts.texterity.com/nutsvolts/200809/templates/pageviewer_pr...
04/09/2008 11:40 م
- Print Pages
58 of 100
http://nutsvolts.texterity.com/nutsvolts/200809/templates/pageviewer_pr...
04/09/2008 11:40 م
- Print Pages
59 of 100
http://nutsvolts.texterity.com/nutsvolts/200809/templates/pageviewer_pr...
04/09/2008 11:40 م
F].SI4EVHYI
PART 3: C Types, Operators, and Expressions EWXQSRXL[I[VSXISYVJMVWX' 4VSKVEQ']PSR)]IWGFYMPXXLI ']PSR)]IWLEVH[EVIERH[EXGLIH XLI0)(PMKLX^MTFEGOERHJSVXL 8LMWQSRXL[I[MPPPSSOEX%:6 TSVXMRTYXERHSYXTYX%RH[I[MPPEHH ERIMKLXFMX(-4W[MXGLXSSYVPIEVRMRK TPEXJSVQ6IQIQFIVMR;SVOWLST [LIVI-GSQTEVIHPIEVRMRK'ERH%:6W XS[EPOMRKEGVSWWX[SGSRXMRIRXWERH WEMH-tHKMZI]SYWSQI[EVRMRKW#;IPP TVITEVIXSLEZIEFVERGLWQEGO]SYMR XLIJEGI8LMW[SVOWLSTLEWWSQIZIV] XIHMSYWJEGXWMRMX7SVV]FYXMXGERtXEPP FIJYRERHKEQIWERH]SYLEZIXS GPMQFELMKL[EPPMRSVHIVXSKIXXSXLI JYRWXYJJ%W6ERH]4EYWGLWEMHMRXLI s0EWX0IGXYVItqFVMGO[EPPWEVIXLIVI JSVEVIEWSR8LIFVMGO[EPPWEVIRSX XLIVIXSOIITYWSYX8LIFVMGO[EPPW EVIXLIVIXSKMZIYWEGLERGIXSWLS[ LS[FEHP][I[ERXWSQIXLMRK &IGEYWIXLIFVMGO[EPPWEVIXLIVIXS WXSTXLITISTPI[LSHSRtX[ERXMX FEHP]IRSYKL8LI]tVIXLIVIXSWXSTXLI SXLIVTISTPIr
L
ERHJEPWIt-XtWXLIPEXXIVXLEXEPPS[WYW XSYWIFMXWXSEYXSQEXI&SSPIER0SKMG ERsEPKIFVEtJSVHIXIVQMRMRKMJE WXEXIQIRXMWX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XLIQ ERHHSRvXXLMROXSSLEVHEFSYXMX]IX ;I[MPPVIZMWMXIEGLJYRGXMSRMRPEXIV ;SVOWLSTWEW[IMRGVIEWISYV ORS[PIHKI &IJSVIGVIEXMRKXLI 1EXL'SQQYRMGEXSVTVSNIGXMR %:67XYHMSVIEHXLI7QMPI]vW ;SVOWLSTz7YTTPIQIRX%HHMRK 0MFVEVMIWXS4VSNIGXW THJJMPIXLEX ]SYGERKIXJVSQ2YXW :SPXW [[[RYXWZSPXWGSQ SV7QMPI] 1MGVSW;SVOWLST^MTHS[RPSEH XLEXEPWSGSRXEMRWXLI%:67XYHMS TVSNIGX MRGPYHI EZVMSL" MRGPYHI WXHMSL" MRGPYHI WXHPMFL" MRGPYHIXLIWTIGMEPPMFVEV] JSV7QMPI]vW;SVOWLST MRGPYHIwWQ[WLx HIJMRIXLITEVWI'SQQERH JYGXMSR ZSMHTEVWI'SQQERH GLEV YMRXCX MRXQEMR ZSMH _ GLEVF! GLEVW?A YMRXCXGSYRX! XLMWMWMRPMFWQ[W MRMXMEPM^EXMSR XLIC4ERH4786[IMVHRIWW EPPS[W]SYXSWXSVIE WXVMRKMRJPEWLVEXLIVXLER [EWXMRKWTEGIMR76%1 TVMRXJC4 4786 w1EXL 'SQQYRMGEXSVEX]SYVWIVZ MGI@Rx
[LMPI _ [LMPI F!u!v _ XLMWMWMRWQ[WE F! GLEV VIGIMZI&]XI W?GSYRXA!F a
SMILEYS WORKSHOP TEVWI'SQQERH WGSYRX F! GSYRX! a VIXYVR a ZSMHTEVWI'SQQERH GLEV WYMRXCXGRX _ MRXEF GLEVX?A X?A!W?A X?A!W?A X?A! E!EXSM X X?A!W?A X?A!W?A X?A! F!EXSM X W[MXGL W?A _ GEWIuv TVMRXJ w H H! H@RxEFEF FVIEO GEWIuv TVMRXJ w H H! H@RxEFEF FVIEO GEWIuv TVMRXJ w H H! H@RxEFEF FVIEO GEWIuv TVMRXJ w H H! H@RxEFEF FVIEO GEWIu v TVMRXJ w H H!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HS[WSJXLI+VIEX7QSOI] 1SYRXEMRWMR8IRRIWWII,IMWEYXLSVSJ :MVXYEP7IVMEP4SVX'SSOFSSO ERH ' 4VSKVEQQMRKJSV1MGVSGSRXVSPPIVW 7QMPI]vW;SVOWLST0MZIMR/RS\ZMPPI82 'SRXEGXRZ$WQMPI]QMGVSWGSQJSVHIXEMPW
*-+96)(IZIPSTIV8IVQMREP[MXL 1EXL'SQQYRMGEXSV<10HEXE
9WMRK1EXL'SQQYRMGEXSVG ;I[MPPHIQSRWXVEXIXLMWGSHI YWMRKXLI(IZIPSTIV8IVQMREPXLEX ]SY[IVIMRXVSHYGIHXSMR ;SVOWLST -RSVHIVXSQEOISYVPMJI WMQTPIV[I[MPPVIWXVMGXSYVQEXLXS 2SZIQFIV
F].SI4EVHYI
PART 5: There are exactly 10 types of people in the world: those who understand binary and those who dont. EWXQSRXL[IPIEVRIHWSQIQSVI'W]RXE\E FMXEFSYXPMFVEVMIWERHXEYKLXSYV&YXXIVJP]XSXEPO 8LMWQSRXL[IEVIKSMRKXSPIEVR[LEXXLILIGO XLEXFYXXSRMR*MKYVIQIERW%2(XLIJMVWXFMREV] JSPOW[LSEWO[MPPKIXXLIFYXXSRJSVJVII 7II [[[WQMPI]QMGVSWGSQ JSVHIXEMPW-JXLMWHSIWRtX QEOIWIRWIXS]SYRS[MX[MPPMREQMRYXI SVX[S
L
&MX[MWI3TIVEXSVW &MX[MWISTIVEXSVWEVIGVMXMGEPP]MQTSVXERXMR QMGVSGSRXVSPPIVWSJX[EVI8LI]EPPS[YWXSHSQER]XLMRKW MR'XLEXGERFIHMVIGXP]ERHIJJMGMIRXP]XVERWPEXIHMRXS QMGVSGSRXVSPPIVQEGLMRISTIVEXMSRW8LMWMWEHIRWIXSTMG WSKIXSYXETIRGMPERHTMIGISJTETIVERH[SVOXLVSYKL IEGLSJXLII\EQTPIWYRXMP]SYYRHIVWXERHMX -RGEWI]SYtZIIZIV[SRHIVIHLS[XSXIPP[LEXMWXVYI ER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MX] 4368(!GI?MAWLS[RSRMRZIVX IPWI 4368(!bGI?MAWLS[MRZIVXIH a VYRHS[RXLIEVVE] JSV M!M"!Mh
_ MJ HMPP](EPP]
VIXYVRHIPE]SVFEMP MJ 4SPEVMX] 4368(!GI?MAWLS[RSRMRZIVX IPWI 4368(!bGI?MAWLS[MRZIVXIH a a a
;LSE[I[IVILEZMRKWSQYGLJYRXLEX[ItZIVYR SYVWIPZIWTPYQSYXSJWTEGI8LIVIWXSJXLI ']PSR3TXSQIXV]WSJX[EVIERHEXI\XWYTTPIQIRXMWMR ']PSR3TXSQIXV]^MTXLEX]SYGERHS[RPSEHJVSQ2YXW
:SPXW EX [[[RYXWZSPXWGSQ SV [[[WQMPI]QMGVSWGSQ &]RS[]SYWLSYPHORS[[LEX*MKYVIQIERWFMRE V]TISTPIMWHIGMQEPTISTPIERHXLEXKMZMRKE[E] FMREV]FYXXSRWMWRtXWYGLEFMKHIEPWMRGIMXtW HIGMQEPFYXXSRW-J]SYIQEMP]SYVEHHVIWWXS RZ$WQMPI]QMGVSWGSQERHEVISRISJXLEXJMVWXFMREV] -tPPWIRH]SYEFYXXSRJSVJVII%RSXIJSV:MWXE YWIVWERHXLSWIJSPOW[LS[ERXXSYWIXLIQSWXVIGIRX ;MR%:6ERH%:67XYHMS=SYGERHS[RPSEHJVSQ [[[WQMPI]QMGVSWGSQ s2I[5YMGO7XEVX+YMHItERH s'4VSNIGXW7SYVGI'SHIJSV:MWXEt2:
(IGIQFIV
- Print Pages
Page 80 of 100
http://nutsvolts.texterity.com/nutsvolts/200901/templates/pageviewer_print?pg=1&p...
12/02/2009
- Print Pages
Page 81 of 100
http://nutsvolts.texterity.com/nutsvolts/200901/templates/pageviewer_print?pg=1&p...
12/02/2009
- Print Pages
Page 82 of 100
http://nutsvolts.texterity.com/nutsvolts/200901/templates/pageviewer_print?pg=1&p...
12/02/2009
- Print Pages
Page 83 of 100
http://nutsvolts.texterity.com/nutsvolts/200901/templates/pageviewer_print?pg=1&p...
12/02/2009
- Print Pages
Page 84 of 100
http://nutsvolts.texterity.com/nutsvolts/200901/templates/pageviewer_print?pg=1&p...
12/02/2009
F].SI4EVHYI
PART 7:
L
EWXQSRXL[IPIEVRIHEFSYX FSXLSJXLSWIFMREV] OMRHWSJTISTPI8LMWQSRXL [I[MPPETTP]MXXSYRHIVWXERHMRK &MREV]'SHIH(IGMQEP &'( XSYWIMRGSHIJSVE[IEVEFPI &YXXIVJP]%PEVQ'PSGO WIIXLI WEJIX]TMRWLS[RMR*MKYVI ;I[MPPEPWSHMWGYWWJYRGXMSRWERH ZEVMEFPIWERHPIEVRXLEXEYXSQEXMG ZEVMEFPIWGERSRP]FIYWIHMRXLI JYRGXMSR[LIVIXLI]EVIHIGPEVIH FYXI\XIVREPZEVMEFPIWhHIGPEVIH SYXWMHIER]JYRGXMSRhGERFI YWIHER][LIVIMRXLIWSJX[EVI QSHYPI
The Wearable Alarm Clock %JYRGXMSRQYWXFIHIGPEVIH SV HIJMRIHMREQSHYPI EWMRKPI XI\XJMPISJGSHI hYWYEPP]MRE LIEHIVJMPISVFIJSVIXLIQEMR JYRGXMSRhFIJSVIMXMWIRGSYRXIVIH F]XLIGSQTMPIV -R;SVOWLST]SYWE[E JYRGXMSRHIGPEVEXMSRMRWQ[WL YMRXCXVIGIMZI&]XI ZSMH
8LMWXSPHXLIGSQTMPIVXLEX [I[SYPHFIYWMRKEJYRGXMSR REQIHVIGIMZI&]XIXLEXXEOIWRS TEVEQIXIVW ZSMH ERHVIXYVRWE F]XIXLEXXSTVIZIRXGSRJYWMSR[I GEPPYMRXCX EWXERHEVHHEXEX]TI JSVEZVPMFG 3OE]XLMWWIIQWPMOI Function Basics EQMKLX]GSRJYWMRK[E]XSTVIZIRX ;IZIFIIRYWMRKJYRGXMSRW GSRJYWMSRFYXMRVIKYPEVSPH JSVE[LMPIWS]SYWLSYPHLEZIE JEWLMSRIH'[I[SYPHGEPPE JIIPJSVXLIQ&YXPIXtWKSELIEH F]XIERYRWMK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FPIJSVXLIYTTIVRMFFPIZEPYI YMRXCXLMKL!
'SYRXXLIXIRWMRMRMXMEP&]XI [LMPI MRMXMEP&]XI"! _ LMKL MRMXMEP&]XI! a
%JXIVXLMWVYRWXLIMRMXMEP&]XIRS[GSRXEMRWSRP]XLISRIW MRXIKIVJVSQXLISVMKMREPF]XIERHLMKLZEVMEFPIGSRXEMRW XLIXIRWXLEXMWLMKL!ERHMRMXMEP&]XI!;IGSQFMRI XLILMKLERHPS[RMFFPIWXSKIXXLIGSRZIVXIHF]XI GSRZIVXIH&]XI! LMKL
` MRMXMEP&]XI
=SYHSVIQIQFIVXLI WLMJXSTIVEXSVJVSQERIEVPMIV [SVOWLSTHSRX]SY#,IVIMXQSZIWXLILMKLZEPYIMRXS XLILMKLRMFFPI8LI`36STIVEXSVXLIRGSQFMRIWMX[MXL XLIMRMXMEP&]XI[LMGLGSRXEMRWSRP]XLIPS[RMFFPI
Converting A Byte To The ASCII Equivalent Decimal Character Using BCD ;IHIJMRIX[SF]XIWhXIRWERHSRIWhERHEXLMVH F]XIhRYQFIVh[LMGL[IWIXXSEZEPYIMRXLIVERKI SJXS YMRXXIRW! YMRXSRIW! YMRXRYQFIV!
;IYWIXLIGLEVEGXIVXS&'(EPKSVMXLQ[VMXXIREWXLI JYRGXMSRF]XI&'( YMRXCX XSGSRZIVXXLIRYQFIVXS XLI&'(IUYMZEPIRXMRXIRW
JSYVFMXW[LMGL[IYWIEWXLI%7'--GLEVEGXIVSJJWIX 7LMJXXLILMKLRMFFPIXSXLIPS[RMFFPI ERHEHHJSV%7'-XIRW! XIRW""
;IPPYWIXLIWIMHIEWMRXLIWLS['PSGOJYRGXMSRMRXLI WSJX[EVI
The Real Timer Clock Software 3LKVIEX2S[XLEX[IZIKSXXIRWSQIFEWMGW HS[R[IEVISYXSJWTEGIEKEMR0SSOWPMOIXLIHIXEMPIH WSJX[EVIHMWGYWWMSR[MPPLEZIXSFIHIJIVVIHXSE WYTTPIQIRX[LIVI[I[MPPH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 7MRGIXLIF]XI&'(JYRGXMSRPSEHIHFSXLXLIXIRWERH SRIWTEVXWSJXLIRYQFIVMRXSXLILMKLERHPS[RMFFPISJXIRW [IRIIHXSI\XVEGXXLISRIWERHXLIXIRWWSXLEX[IGER EHH %7'-- XSKIXXLI%7'--GLEVEGXIVWJSV2YQFIV 0SEHXLISRIWZEVMEFPI[MXL XLILMKLERHPS[RMFFPI SRIW!XIRW 1EWOSJJXLILMKLRMFFPI ERHEHH XSKIXXLI%7'-SRIW! SRIW \*
*MREPP][IKIXXLIXIRWF]VMKLXWLMJXMRKXLIF]XI *IFVYEV]
F].SI4EVHYI
PART 8: Interrupts, I/O
Registers, and the Butterfly Joystick
I
R4EVX[IYWIHXLI&YXXIVJP]NS]WXMGO[MXLPMFVEV]JYRGXMSRW XSMQTPIQIRXEQIRYREZMKEXMSRW]WXIQFYXHMHRXKSMRXSER] HIXEMPWSJLS[XLINS]WXMGO[SVOIH8LMWQSRXL[I[MPPYWIXLI NS]WXMGOEWERMRXVSHYGXMSRXS%:6MRXIVVYTXWERH-3VIKMWXIVW
The Butterfly Joystick Hardware 8LISVMKMREPNS]WXMGO[EWERIEVP]EMVGVEJXGSRXVSPPIZIV XLEXEPPS[IHXLITMPSXXSQERIYZIVXLITPERIPIJXVMKLX YTERHHS[R*MKLXIVTPERIWEHHIHEGIRXIVFYXXSRXSJMVI QEGLMRIKYRW8LI&YXXIVJP]NS]WXMGOhPMOIQER]QIRY REZMKEXMSRHIZMGIWJSYRHSRVIQSXIGSRXVSPWERHGIPPTLSRIW hLEWJMZITSWMXMSRW94(3;20)*86-+,8ERH497, WII*MKYVI 1ERYJEGXYVIVWSJGSYVWIGERXORS[[LMGL HMVIGXMSRXLIYWIV[MPPSVMIRXXLIMVHIZMGIWSXLI]PEFIPXLIQ %&'(ERH'IRXIV JSV497, EWMR*MKYVI[LMGL GSVVIWTSRHXSTMRWRYQFIVIHEWMR*MKYVI 8LI&YXXIVJP]SVMIRXWXLIWITMRWERHGSR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GSQTMPIV[MPP[VMXI
Setting Up External Interrupts Using The ATmega169 And avrlibc
)-17/`!
4'-)
8SIREFPIXLINS]WXMGOMRXIVVYTXW[I[MPPRIIHXSWIXFMXWMR JSYVVIKMWXIVW;I[MPPWIILS[XSHSXLMWJSVXLVIITVSKVIWWMZIP] WMQTPIV[E]W8LIJMVWXMWXLIQSWXPMOIETVSJIWWMSREP'TVSKVEQ QIV [SYPHHSMXhYWMRKXLIHEXEWLIIXEGVSR]QWERHFMX[MWI STIVEXSVW[LMGLGERFIEFMXGV]TXMGJSVERSZMGI8LIWIGSRH MWEPMXXPIWMQTPIVERHLMHIWXLIFMX[MWISTIVEXMSRWFILMRHE QEGVS8LIXLMVHERHWMQTPIWXI\TERHWXLIEGVSR]QWXSWTIPP SYXXLIJYPPVIKMWXIVERHFMXREQIW-RXLMW;SVOWLST[I[MPP WLS[XLIHIXEMPWSRP]JSVXLI)-17/ )\XIVREP-RXIVVYTX1EWO 6IKMWXIV FYXXLIWSYVGIGSHIWLS[WXLMWJSVEPPYWIHMRXIVVYTXW
*MREPP][I[MPPXV]XSQEOIXLMWIZIRIEWMIVF]I\TERHMRK XLIEGVSR]QW
External Interrupt Mask Register
WIX&MX )\XIVREP-RXIVVYTX1EWO6IK 4MR'LERKI-RXIVVYTX)REFPI&MX
;IWIXXLI4'-)ERH4'-) 4MR'LERKI-RXIVVYTX )REFPIERH FMXWXSIREFPI4'-28[LMGLEVIXLI YTTIVIMKLX4MR'LERKI-RXIVVYTXWERHEVIEWWSGMEXIH[MXL XLI4SVX&TMRWMRXLI%8QIKEEWWLS[RMR*MKYVI 8LIJMVWX[E]XSHSXLMWMWXSYWIXLIVIKMWXIVERHFMX EGVSR]QWPMWXIHMRXLIMSLLIEHIVJMPI
-J]SYVIQIQFIVXLIFMX[MWISTIVEXSVWJVSQ;SVOWLST ERHORS[XLEXMRXLILIEHIVJMPIXLEX4'-)MWHIJMRIHEW ERH4'-)MWHIJMRIHEW]SY[MPPWIIXLEXXLMW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XLEXRSJYVXLIVMRXIVVYTXWGERSGGYV[LMPIXLI MRXIVVYTXWIVZMGIVSYXMRIMWVYRRMRK;LIRXLIMRXIVVYTX JMRMWLIWXLIMRXIVVYTXVIXYVRW[MXLXLI6)8-MRWXVYGXMSRXLEX [MPPVIWIXXLI-FMXXLYWIREFPMRKJYVXLIVMRXIVVYTXW
External Interrupt Flag Register )-*6h )\XIVREP-RXIVVYTX*PEK6IKMWXIV 4'-*h 4MR'LERKI-RXIVVYTX*PEK&MX 4'-*h 4MR'LERKI-RXIVVYTX*PEK&MX -J4'-*MWWIX[LIRER]4'-28TMRGLERKIWWXEXI ERH MJXLI-FMXMWWIXERH XLI4'-)FMXMWWIXMR)-17/XLIR ERMRXIVVYTXVIUYIWXMWXVMKKIVIHWSXLEXXLIEWWSGMEXIH MRXIVVYTXWIVZMGIVSYXMRI[MPPFIVYR8LIWEQIMWXVYIJSV XLI4'-*FMXERHXLI4'-28TMRGLERKIW 1EVGL
Pin Change Mask Registers 4'17/h 4MR'LERKI1EWO6IKMWXIV 4'17/h 4MR'LERKI1EWO6IKMWXIV 8LI4'17/VIKMWXIVLEW4'-28XS4'-28FMXWIEGL SJ[LMGL[LIRWIXXSIREFPIWXLITMRGLERKIMRXIVVYTXJSV XLIGSVVIWTSRHMRK-3TMR
Interrupt Service Routines ;LIRXLI%8QIKEVIGIMZIWERMRXIVVYTXMXPSEHWXLI EHHVIWWSJER-RXIVVYTX7IVZMGI6SYXMRIJVSQXLI-RXIVVYTX:IGXSV 8EFPI%ZIGXSVMWNYWXEJERG][E]XSWE]EHHVIWW8LIVIEVI ZIGXSVWWLS[RSRTEKISJXLIHEXEWLIIXFYX[I[MPPSRP]FI YWMRKZIGXSVWERHJSVXLI4'-28ERH4'-28MRXIVVYTX
7SMJER]SJXLINS]WXMGOTMRWGLERKIXLIRXLI TMR'LERKI-RXIVVYTX JYRGXMSR[MPPFIGEPPIHF]-76W;LIR ERMRXIVVYTXMWXVMKKIVIHXLI-FMXMWGP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WTPE] XLI4VSGIWWMRK-() *MKYVI
The Blinky Program, urr ... Sketch
%VHYMRSMWFYMPXHMVIGXP]SYXSJ;MVMRKI\GITXXLEXMX YWIWEQSVIEJJSVHEFPIFSEVHERHLEWMXWS[RSRPMRI
Arduino Quick Start Guide: The Arduino Integrated Developers Environment
%TVMP
8LI%VHYMRS(YIQMPERSZILEWEFYMPXMR0)([MXLE
SMILEYS WORKSHOP VIWMWXSVEXXEGLIHXS-3TMR WII*MKYVIW WS[I[MPP WXEVX[MXLETVSKVEQ SOE]WOIXGL XSFPMROXLEX0)( 8LIJSPPS[MRKWOIXGL[EWGSTMIHJVSQXLI%VHYMRS QIRY *MPI7OIXGLFSSO)\EQTPIW(MKMXEP&PMROERHQSHMJMIHXS FIXXIVJMXMRXLIQEKE^MRI &PMRO 8LIFEWMG%VHYMRSI\EQTPI 8YVRWSRER0)(SRJSVSRIWIGSRH XLIRSJJJSVSRIWIGSRHERHWSSR ;IYWITMRFIGEYWIHITIRHMRKSR]SYV %VHYMRSFSEVHMXLEWIMXLIVEFYMPXMR 0)(SVEFYMPXMRVIWMWXSVWSXLEX]SY RIIHSRP]ER0)( LXXT[[[EVHYMRSGGIR8YXSVMEP&PMRO 0)(GSRRIGXIHXSHMKMXEPTMR MRXPIH4MR! VYRSRGI[LIRXLIWOIXGLWXEVXW ZSMHWIXYT _ WIXWXLIHMKMXEPTMREWSYXTYX TMR1SHI PIH4MR398498 a VYRSZIVERHSZIVEKEMR ZSMHPSST _ WIXWXLI0)(SR HMKMXEP;VMXI PIH4MR,-+, HIPE] [EMXWJSVEWIGSRH
SV]MXMWFIGEYWIF]XIWEVIYWIHJSVXLIFSSXPSEHIVA
Uploading the Sketch to the Arduino Board 2I\X[I[MPPu9TPSEHXSXLI-3FSEVHvEWWLS[RMR *MKYVIQIERMRK[I[MPPWIGVIXP]YWI%:6(YHIXSWIRH XLILI\GSHIYWMRKXLI97&WIVMEPTSVXXSXLIFSSXPSEHIV SRXLI%8QIKEXLEX[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PEGIHIEGL[MXL ERIUYMZEPIRX%'; JYRGXMSR[MXLEQSVI' JVMIRHP]REQI XLIHSX ?uvAMRXLIQMHHPISJ XLI'REQIWKMZIW *-+96)&VIEHFSEVHGVSWWWIGXMSR [MXL0)(VIWMWXSVERH[MVI
Schematic and Drawing for the LED and Pushbutton Projects ;IWE[ETLSXSSJXLMWMR7QMPI]vW;SVOWLST FYXXLIGSRGITXWEVIVITIEXIHLIVIMR*MKYVIWERH JSV XLIGMVGYMXWGLIQEXMGERHHVE[MRK
Moving from TAW Serial to ACW Serial 2S[XLEX]SYORS[QSVIXLER]SYIZIV[ERXIHXS ORS[EFSYXFVIEHFSEVHWPIXvWQSZISRXSERI[WSJX[EVI PMFVEV]XLEX[MPPIEWISYVTSVXMRKWSJX[EVIJVSQ8%; 8LI %VHYMRS;E] XS%'; %';E] -RXLIPEWX;SVOWLST[I PIEVRIHLS[XSTSVXXLIGSHIF]WMQTP]GST]MRKEPPXLI %VHYMRSWSYVGIGSHIMRXSSYVTVSNIGXHMVIGXSV]8LMWQSRXL [I[MPPHYQTEPPXLEXGSHIMRXSEPMFVEV]{PMF%';{ [MXLXLIQENSVI\GITXMSRXLEX[I[MPPFIVITPEGMRKXLI .YRI
TVSFPIQWXLEX[IHSRvX RIIHEXXLMWTSMRX -XMWE VIPEXMZIP]WMQTPIQEXXIVXS VIHS XLIWIWIVMEPJYRGXMSRW ERH[IKIXXLIEHHIH EHZERXEKISJYWMRKXLI ZIRIVEFPITVMRXJ WXERHEVH 'PMFVEV]JYRGXMSR -RXLI SPHHE]WXLIJMVWX' TVSKVEQ]SYvH[VMXI [SYPH YWIXLIWXEXIQIRX TVMRXJ w,IPPS[SVPHx ERH [IvPPHSXLIWEQIXLMRKLIVI NYWXJSVRSWXEPKMEvWWEOI WIVMEP&IKMR PSRKWTIIH 6ITPEGIW7IVMEPFIKMR WTIIH *-+96)0E]SYXHVE[MRK ;IYWIXLMWMRXLI ERH)%+0)7GLIQEXMGJSV0)( WIXYT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