EmbeddedComputingandMechatronics withthePIC32Microcontroller KevinLynchNorthwesternUniversity,USA NicholasMarchukNorthwesternUniversity,USA MatthewElwinNorthwesternUniversity,USA AnintroductiontoMicrochip’sPIC32microcontrolleranditsuseinembedded computingandmechatronics KEYFEATURES • Extensive,freelydownloadablesamplecodefortheNU32developmentboard ISBN:978-0-12-420165-1 incorporatingthePIC32MX795F512Hmicrocontroller PUBINFO:Elsevier/Newnes, • Freeonlineinstructionalvideostosupportmanyofthechapters December2015 LISTPRICE:$69.95 DESCRIPTION FORMAT:Paperback For the first time in a single reference, this book provides the beginner with a PAGES:c.625 coherent and logical introduction to the hardware and software of the PIC32, TRIM:7.5wx9.25h bringing together key material from the PIC32 Reference Manual, Data Sheets, AUDIENCE: Universitycourses,students, XC32CCompilerUser'sGuide,AssemblerandLinkerGuide,MIPS32CPUmanuals, professionalsandhobbyists and Harmony documentation. This book also trains you to use the Microchip documentation,allowingbetterlife-longlearningofthePIC32.Thephilosophyis TABLEOFCONTENTS togetyoustartedquickly,buttoemphasizefundamentalsandtoeliminate"magic Part1:Quickstart 01 Quickstart steps"thatpreventadeepunderstandingofhowthesoftwareyouwriteconnects Part2:Fundamentals tothehardware. 02 Hardware 03 Software Applicationsfocusonmechatronics:microcontroller-controlledelectromechanical 04 UsingLibraries systems incorporating sensors and actuators. To support a learn-by-doing 05 TimeandSpace 06 Interrupts approach, you can follow the examples throughout the book using the sample Part3:PeripheralReference FourteenchaptersondigitalI/O, codeandyourPIC32developmentboard.Theexercisesattheendofeachchapter counter/timers,outputcompare, helpyouputyournewskillstopractice. analoginput,inputcapture,watchdog timer,comparator,flashmemory,the Thematerialinthisbookhasbeentestedandrefinedoverseveralyearsofuseas MicrochipHarmonyframework,and theprimaryreferenceforthemechatronicssequenceatNorthwesternUniversity. communicationsuchasUART,SPI, I2C,CAN,USB,andparallelcomm Part4:Mechatronics 21 Sensors 22 DigitalSignalProcessing 23 PIDFeedbackControl 24 FeedbackControlofLED Brightness 25 BrushedPermanentMagnet DCMotors 26 GearingandMotorSizing 27 DCMotorControl 28 AMotorControlProject 29 OtherActuators Part5:Appendices A. ACrashCourseinC B. CircuitsReview C. OtherPIC32Models Coverageincludes: • • • • • • • ApracticalintroductiontotheCprogramminglanguage GettingupandrunningquicklywiththePIC32 AnexplorationofthehardwarearchitectureofthePIC32anddifferencesbetweenPIC32 families FundamentalsofembeddedcomputingwiththePIC32,includingthebuildprocess,time-and memory-efficientprogramming,andinterrupts Aperipheralreference,withextensivesamplecodecoveringdigitalinputandoutput, counter/timers,PWM,analoginput,inputcapture,watchdogtimer,andcommunicationby theparallelmasterport,SPI,I2C,CAN,USB,andUART AnintroductiontotheMicrochipHarmonyprogrammingframework Essentialtopicsinmechatronics,includinginterfacingsensorstothePIC32,digitalsignal processing,theoryofoperationandcontrolofbrushedDCmotors,motorsizingandgearing, andotheractuatorssuchassteppermotors,RCservos,andbrushlessDCmotors Visithttp://nu32.orgforsamplecode,accompanyingonlinevideos,andorderinginformation TheNU32PIC32MX795F512HDevelopmentBoard Thecompanionboardforthebook EmbeddedComputingandMechatronicswiththePIC32Microcontroller KevinM.Lynch,NicholasMarchuk,andMatthewL.Elwin Newnes/Elsevier,December2015 TheNU32 TheNU32isaninexpensive60-pinDIP-compatibledevelopment board for the 64-pin surface mount PIC32MX795F512H. Its primary purpose is to break out the pins of the PIC32. It also includes an FTDI FT231X USB-to-UART chip that allows simple serial port communication over a USB cable with a program running on the host computer (e.g., a terminal emulator, MATLAB, Python, etc.). The board can be powered standalone bytheincluded6Vwalladapterorbythehost’sUSBport.An onboardbootloaderallowsprogrammingthePIC32usingonlya USBcable,withoutanexternalprogrammerdevice.Anonboard clockclockstheCPUat80MHz. Features • 80MHzMIPS32M4K32-bitCPU • 512KBflashand128KBRAM • ManydigitalI/Oandchangenotificationpins • Five16-bitcounter/timers • FivePWMand5inputcapturechannels • 1MHz10-bitanaloginput(multiplexedto16inputs) • SixUART,2CAN,3SPI,4I2C,1PMP,1USB,and1Ethernet modules • TwoLEDsandonepushbuttonavailableforuserprograms • 3.3Vand5Vregulatedvoltageoutputs • Mini-BUSBjacktoconnecttothehost • Micro-BUSBjackforUSBwithanotherdevice What’sintheBox • TheNU32developmentboard,withsolderedheaderpins • A solderless prototyping breadboard into which the NU32 canbeinserted • AUSBcableforprogrammingandcommunicationwiththe host • A6Vwallpowersupply SampleCode Extensive freely downloadable and easily modified C sample code demonstrates mostof the majorfunctions of thePIC32, includinguseoftheperipheralsandspecialfeaturesoftheCPU andtheXC32Ccompiler,suchasinterruptsandcodetimeand spaceefficiency. SampleBookChapters FreelydownloadablebookchaptersallowtheNU32usertoget started quickly with the NU32, without purchasing the book. Thefreebookchaptersalsoincludeanextensiveintroduction toprogrammingintheClanguage,acircuitsreview(usefulfor interfacing the PIC32 with sensors and actuators), and a descriptionofthetheoryofDCmotors. OnlineVideos The online videos demonstrate many of the features of the NU32 (and the PIC32 generally), as well as its application in mechatronics projects involving sensors and actuators. The videosalsofacilitateflippingatraditionalclassroom. Visithttp://nu32.orgforsamplecode,accompanyingonlinevideos,andorderinginformation