Arduino Microcontroller Processing for Everyone! Part I Synthesis Lectures on Digital Circuits and Systems Editor MitchellA.Thornton,SouthernMethodistUniversity TheSynthesisLecturesonDigitalCircuitsandSystemsseriesiscomprisedof50-to100-page bookstargetedforaudiencememberswithawide-rangingbackground.TheLecturesincludetopics thatareofinteresttostudents,professionals,andresearchersintheareaofdesignandanalysisof digitalcircuitsandsystems.EachLectureisself-containedandfocusesonthebackground informationrequiredtounderstandthesubjectmatterandpracticalcasestudiesthatillustrate applications.TheformatofaLectureisstructuredsuchthateachwillbedevotedtoaspecifictopic indigitalcircuitsandsystemsratherthanalargeroverviewofseveraltopicssuchasthatfoundina comprehensivehandbook.TheLecturescoverbothwell-establishedareasaswellasnewly developedoremergingmaterialindigitalcircuitsandsystemsdesignandanalysis. ArduinoMicrocontroller:ProcessingforEveryone!PartI StevenF.Barrett 2010 DigitalSystemVerification:ACombinedFormalMethodsandSimulationFramework LunLiandMitchellA.Thornton 2010 ProgressinApplicationsofBooleanFunctions TsutomuSasaoandJonT.Butler 2009 EmbeddedSystemsDesignwiththeAtmelAVRMicrocontroller:PartII StevenF.Barrett 2009 EmbeddedSystemsDesignwiththeAtmelAVRMicrocontroller:PartI StevenF.Barrett 2009 EmbeddedSystemsInterfacingforEngineersusingtheFreescaleHCS08Microcontroller II:DigitalandAnalogHardwareInterfacing DouglasH.Summerville 2009 iv DesigningAsynchronousCircuitsusingNULLConventionLogic(NCL) ScottC.SmithandJiaDi 2009 EmbeddedSystemsInterfacingforEngineersusingtheFreescaleHCS08Microcontroller I:AssemblyLanguageProgramming DouglasH.Summerville 2009 DevelopingEmbeddedSoftwareusingDaVinci&OMAPTechnology B.I.(Raj)Pawate 2009 MismatchandNoiseinModernICProcesses AndrewMarshall 2009 AsynchronousSequentialMachineDesignandAnalysis:AComprehensiveDevelopment oftheDesignandAnalysisofClock-IndependentStateMachinesandSystems RichardF.Tinder 2009 AnIntroductiontoLogicCircuitTesting ParagK.Lala 2008 PragmaticPower WilliamJ.Eccles 2008 MultipleValuedLogic:ConceptsandRepresentations D.MichaelMillerandMitchellA.Thornton 2007 FiniteStateMachineDatapathDesign,Optimization,andImplementation JustinDavisandRobertReese 2007 AtmelAVRMicrocontrollerPrimer:ProgrammingandInterfacing StevenF.BarrettandDanielJ.Pack 2007 PragmaticLogic WilliamJ.Eccles 2007 v PSpiceforFiltersandTransmissionLines PaulTobin 2007 PSpiceforDigitalSignalProcessing PaulTobin 2007 PSpiceforAnalogCommunicationsEngineering PaulTobin 2007 PSpiceforDigitalCommunicationsEngineering PaulTobin 2007 PSpiceforCircuitTheoryandElectronicDevices PaulTobin 2007 PragmaticCircuits:DCandTimeDomain WilliamJ.Eccles 2006 PragmaticCircuits:FrequencyDomain WilliamJ.Eccles 2006 PragmaticCircuits:SignalsandFilters WilliamJ.Eccles 2006 High-SpeedDigitalSystemDesign JustinDavis 2006 IntroductiontoLogicSynthesisusingVerilogHDL RobertB.ReeseandMitchellA.Thornton 2006 MicrocontrollersFundamentalsforEngineersandScientists StevenF.BarrettandDanielJ.Pack 2006 Copyright© 2010byMorgan&Claypool Allrightsreserved.Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,ortransmittedin anyformorbyanymeans—electronic,mechanical,photocopy,recording,oranyotherexceptforbriefquotationsin printedreviews,withoutthepriorpermissionofthepublisher. ArduinoMicrocontroller:ProcessingforEveryone!PartI StevenF.Barrett www.morganclaypool.com ISBN:9781608454372 paperback ISBN:9781608454389 ebook DOI10.2200/S00280ED1V01Y201005DCS028 APublicationintheMorgan&ClaypoolPublishersseries SYNTHESISLECTURESONDIGITALCIRCUITSANDSYSTEMS Lecture#28 SeriesEditor:MitchellA.Thornton,SouthernMethodistUniversity SeriesISSN SynthesisLecturesonDigitalCircuitsandSystems Print1932-3166 Electronic1932-3174 Arduino Microcontroller Processing for Everyone! Part I Steven F.Barrett UniversityofWyoming,Laramie,WY SYNTHESISLECTURESONDIGITALCIRCUITSANDSYSTEMS#28 M &C Morgan &cLaypool publishers ABSTRACT This book is about the Arduino microcontroller and the Arduino concept.The visionary Arduino teamofMassimoBanzi,DavidCuartielles,TomIgoe,GianlucaMartino,andDavidMellislaunched anewinnovationinmicrocontrollerhardwarein2005,theconceptofopensourcehardware.Their approachwastoopenlysharedetailsofmicrocontroller-basedhardwaredesignplatformstostimulate thesharingofideasandpromoteinnovation.Thisconcepthasbeenpopularinthesoftwareworld formanyyears.Thisbookisintendedforawidevarietyofaudiencesincludingstudentsofthefine arts,middleandseniorhighschoolstudents,engineeringdesignstudents,andpracticingscientists and engineers.To meet this wide audience,the book has been divided into sections to satisfy the needofeachreader.Thebookcontainsmanysoftwareandhardwareexamplestoassistthereaderin developing a wide variety of systems.For the examples,the Arduino Duemilanove and the Atmel ATmega328isemployedasthetargetprocessor. KEYWORDS Arduinomicrocontroller,ArduinoDuemilanove,Atmelmicrocontroller,AtmelAVR, ATmega328,microcontrollerinterfacing,embeddedsystemsdesign ix Contents Preface.....................................................................xiii 1 GettingStarted ..............................................................1 1.1 Overview..................................................................1 1.2 GettingStarted.............................................................1 1.3 ArduinoDuemilanove ......................................................3 1.3.1 Arduinohostprocessor—theATmega328 3 1.4 Example:AutonomousMazeNavigatingRobot...............................4 1.4.1 Structurechart 6 1.4.2 UMLactivitydiagrams 8 1.4.3 ArduinoDuemilanoveSystems 9 1.5 Arduinoopensourceschematic..............................................9 1.6 OtherArduino-basedplatforms..............................................9 1.7 ExtendingthehardwarefeaturesoftheArduinoplatform.......................9 1.8 ArduinoSoftware .........................................................12 1.9 ArduinoDuemilanove/ATmega328hardwarefeatures.........................13 1.9.1 Memory 13 1.9.2 PortSystem 15 1.9.3 InternalSystems 16 1.10 Summary.................................................................19 1.11 References................................................................19 1.12 ChapterProblems.........................................................19 2 Programming...............................................................21 2.1 Overview.................................................................21 2.2 TheBigPicture...........................................................22 x 2.3 AnatomyofaProgram.....................................................22 2.3.1 Comments 24 2.3.2 Includefiles 25 2.3.3 Functions 25 2.3.4 Programconstants 28 2.3.5 Interrupthandlerdefinitions 29 2.3.6 Variables 29 2.3.7 Mainprogram 30 2.4 Fundamentalprogrammingconcepts........................................30 2.4.1 Operators 30 2.4.2 Programmingconstructs 34 2.4.3 Decisionprocessing 36 2.5 ArduinoDevelopmentEnvironment ........................................39 2.5.1 Background 39 2.5.2 ArduinoDevelopmentEnvironmentoverview 40 2.5.3 Sketchbookconcept 41 2.5.4 Arduinosoftware,libraries,andlanguagereferences 41 2.6 Application1:RobotIRsensor.............................................42 2.7 Application2:Artpieceilluminationsystem .................................47 2.8 Summary.................................................................47 2.9 References................................................................48 2.10 ChapterProblems.........................................................49 3 EmbeddedSystemsDesign ..................................................51 3.1 Whatisanembeddedsystem?..............................................51 3.2 Embeddedsystemdesignprocess ...........................................52 3.2.1 ProjectDescription 52 3.2.2 BackgroundResearch 52 3.2.3 Pre-Design 54 3.2.4 Design 54 3.2.5 ImplementPrototype 56
Description: