所需E币: 4
时间: 2019-12-24 21:20
大小: 282.49KB
Recently,MicrochiphasintroducedaseriesofnewPIC16andPIC18PICmicro®microcontrollersthathaveanon-boardInternalRCOscillator,capableofeightfrequenciesfrom31kHzto8MHz.Thesemicrocontrollersincludethefollowingdevices:•PIC16F818/819•PIC16F87/88•PIC18F1X20•PIC18F2220/2320/4220/4320TheinternalRCoscillatorisconfiguredandtunedbytheOSCCONandOSCTUNEregisters,respectively.TheOSCCONregistersetsthefrequencyandcontainstheIOFSbit,whichindicateswhenthefrequencyhasstabilizedafterafrequencychangeintheOSCCONregister.OSCTUNEisresponsiblefortuningthefre-quencywithinarangeof+/-12percentontheselectedfrequency.Theupperrangeoftuningis01h-1Fhandthelowerrangeis20h-3Fh,withcenterfrequencyat00h.Itisrecommendedtoconsultthedevicedatasheetforfurtherdetails.Theassemblycodeincludedinthisapplicationnote(seeAppendixA)isonlyapplicableforaPIC16F819microcontroller;however,withminorchanges,thecodecanbeportedovertothedeviceslistedabove.HavinganinternalRCoscillatoreliminatestheneedforcapac-itorsandanexternalcrystal,resultinginproductioncostsavings.Youmaybewondering,“Whywoulditbenecessarytocalibratetheinternaloscillatorifitissupposedtocomefromthefactoryalreadycalibrated?”Eventhoughtheinternaloscillatorisfactorycalibratedat25°C,temper-aturevariationsintheoperatingenvironmentmustbeconsidered.Sinceachangeinfrequency,aslittleastwotothreepercent,cancorruptserialcommunication,theinformationpresentedinthisapplicationnotecanhelpyouavoidthisissuebyallowingfrequencycalibrationovertemperature.AN244InternalRCOscillatorCalibrationTheabilitytocalibratetheinternaloscillatormeansthatAuthor:ChrisValentiaknowntime-basemustbeestablishedasareferenceMicrochipTechnologyInc.point.Thistime-basewillbederivedfroma32.768kHzclockcrystalconnectedtoTimer1(seeFigure1).OtherINTRODUCTIONfixedtime-basesthatcanbeusedareACline……