DIY_PC_based_20MHz_oscilloscope_PIC16F84_bitscope

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

CircuitCellarINK®Issue97August19981www.circuitcellar.comBitScopeFEATUREARTICLENormanJacksonsHasyourofficebecomesoclutteredthatyoucan’tfindyouroscilloscopeorlogicanalyzer?Noproblem,Normanwillhelpyoubuildalow-cost,mixed-signalcaptureenginethatconnectstoyourcomputerviatheserialport.ometimeago,Ihadabadexperi-encewithabus—alogicbus.Ithadsixram-pagingDSPcardsandaSCSIcontrol-leralltryingtorideatthesametime.Aboutonceanhour,therewasasickeningcrash.Aftergoingthroughtheusualstagesofblamingthesoft-ware,Irelented,admittedpossibleculpability,andborrowedamixed-modeDSO.Thismachinehasadigitalsamplingoscilloscopeandalogicanalyzereffec-tivelyjoinedatthehip.Theyshareacommontriggermodulethatenablestheusertoidentifyacomplexeventandrecordthestateofthetargethard-warebeforeandafterthetrigger—inboththeanaloganddigitaldomains.Inthecaseofmyerraticbuslogic,theculpritturnedouttobeadelin-quentGALwithagroundbounceproblem.Theoffendingchiphaditsdutiesreassignedandthedocumenta-tionpolicewerealerted.EngineerAMixed-SignalCaptureEngineTHECOMPUTERAPPLICATIONSJOURNAL®INKtriumphsoverbug.Byemployingahigh-techpieceoftestequipment,Icouldtriggeronacomplexdigitaleventandcorrelatethiseventtoanoscilloscopetracethatshowedwhatwasreallyhappeningintheanalogdomain.Iwassavedinthenickoftime,butdespitehavingformedadeepattachmenttothetrusty’scope,Ihadtogiveitback.Followingthisadventure,Istartedmusingabouthowtorollmyownversionofthatusefulelectronicgadget.AftersomementaltinkeringandwiththeaddedincentiveofDesign98,Iwassoonsketchingelectronicstuffonthegridpad.BitScopebegantoemerge(seePhoto1).THEBIGPICTUREThebasicideabehindBitScopeisthatofaspecializedpieceofdata-capturehardwarethatdoesn’tincludeanyuserinterfaceotherthananRS-232plug.Mostengineershavemorecom-puters,mice,andkeyboardsthanthey2Issue97August1998CircuitCellarINK®www.circuitcellar.comSERIALCONNECTIONWhileaserialinterfacemayseemabottleneckforacaptureenginethatcanpotentiallystore64KBofdata,thisisnotaproblem.ThankstotheInternetand56kmodems,mostPCsnowhavefast,bufferedUARTs.ThetransmissionspeedoftheBit-Scopeseriallinkcanbescaledto115kbpsusingafastmicrocontroller.Atthisrate,youcantransferenoughtrollerfirmwareisdesignedasavirtualmachine(VM).TheBitScopedesignisnovelbecauseithasanunusualarrangementoftheVMprogramcode.Thein-structionsarenotlocatedinmemoryonthemicrocontrollerbutresideintheuserinterfaceandareexecutedatomicallydirectfromtheserialport.IfyoustudyBitScope’svir-tualinstructionset,youseethatarrangingthingsinthiscrazywayhasitsadvantages.Allinstruc-tionsareatomic.Inotherwords,thereisnoinherentsyntaxassociatedwithanycommandbyte.Allinstructionbytesareechoedtoprovideasimplehandshakemechanism.And,allinstructionsarepreemptive,soyoucanalwaysabortthepreviouscommandandregaincontrolsimplybysendinganewcommand.knowwhattodowith.IfIwasgoingtobuildacheap’scope,Icertainlydidn’twantanymoreofthatstuff.WhatIneededwasanelectronicdronethatcouldcaptureanddisgorgedataoncommand.Nomore,noless.ThecommandshadtobesimpleASCIIcharactersthatareintuitiveandeasytolearn.ThePC-baseduserinterfacecanthensynthesizefunc-tionalityofarbitrarycomplexitybysendingscriptsofcommandcharac-tersandreceivingthereplies.Theanswer:avirtualinstrumentwherespecializedhardwaredoestheelectronictestjobandaPCletstheengineerdriveit.Onebigadvantageofthissetupisthatchangingthewaythevirtualinstrumentworksdoesn’tusuallyinvolvereprogrammingchips(hard)butmaybedonebydownload-inganewprogramfromthe’Net(easy).Asdescribedinthesidebar“VirtualMachineArchitecture,”themicrocon-Figure1—Thisblockdiagramofthemixed-signalcaptureengineshowsbasicdesignarchitecture.ABdivnAnalogSupplyPowerSupplyMuxRangeFlashADCDigitalPodDataMux32K·8SRAM32K·8SRAMClockPLDLogicControlPICCPUSerialFigure2a—TheBitScopeCPUandstorageengineincludesthePIC,PLDlogic,clock,datamuxes,andsampleRAM.CircuitCellarINK®Issue97August19983www.circuitcellar.comVirtual-MachineArchitectureAvirtualmachine(VM)consistsofafullyfunctionalprocessorhostedonanunrelatedsubstratemachine.VMdesignhasadvantagesoverconventionalcoding.Eachinstructionmaybehighlyoptimizedforperfor-mance—unlikeageneral-purposeinterpreterlikeBASIC,whichcandoanythingbutinefficiently.VMinstructionsarecompactlikeassemblybutperformextremelycomplextasks.Oncearegisterandcommandsetaredevised,youcanaddnewinstructionstoenhancethemachine.Theoriginalinstructionsremainthesame,whichpromotesmodularity.SincetheoperationaldefinitionoftheVMisrigid,firmwarechangestendtobestraightforward,eventothepointofhostingthetargetarchitectureonacompletelynewsubstrate.Inthisdesign,thePIC16F84isasubstratetoimple-mentacustomBitScopemachinewithitsinstructionsetbecomingmicrocodetoimplementtheVM.So,theBitScopeVMhasinstructionsandregistersbutthey’reunrelatedtothePICnativeinstructionset.ThevirtualregistersarehostedbyPICmemoryregistersbuthavemeaningonlytotheBitScope.Similarly,BitScopehasnouseforXOR-orDECFSZ-typeinstructions.Instead,ithasinstructionsformanipulatingregisters,startingsampleRAM,anddumpingcaptureddata.BitScoperegistersmaybeoptionbits,timerconstants,sampleaddress,andsoon.Theexactfunctionoftheregist

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功