Laser Communications SystemWord格式.docx
- 文档编号:18804276
- 上传时间:2023-01-01
- 格式:DOCX
- 页数:16
- 大小:133.30KB
Laser Communications SystemWord格式.docx
《Laser Communications SystemWord格式.docx》由会员分享,可在线阅读,更多相关《Laser Communications SystemWord格式.docx(16页珍藏版)》请在冰豆网上搜索。
HighLevelDesign
Thesystemcansendarbitrarydataat27.7kbpsbaud.Thesystemillustratedaboveissetuptosendvoicedata.Themicrophoneinputisconditioned(amplifiedandbiased)sothatthefulleightbitrangeoftheanaloguetodigitalconverterisutilized.Afairamountoftimewasspentoptimizingtheamplifierforthemicinputsoastominimizepoppingbutmaximizequality.
OncethedigitalsignalisobtainedbytheADC,theMCUpassesthesignaltotheUART.TheUARTsetsatransmitpinhighorlowaccordingtotheserialprotocol.Someconditioningisappliedtothissignalaswellinordertoensureconstantcurrenttothelaser.
Onthereceiverside,thesignalisreadbyaphototransistor.Thesignalcomingoffthetransistorisputthroughacomparatortogenerateappropriatehighandlowsignals.TheUARTreadsthesesignalsandgeneratesabyteaccordingtotheserialprotocol.Thisbyteisappliedtoaport,sentthroughadigitaltoanalogueconverter,andappliedtoaspeaker.
Hardware
Adescriptionofthehardwareandcircuitryusedinthisprojectfollows.Resistor,capacitoranddiodevaluesareommittedbecausetheyneedtotuneddependingonthehardwareused.Thespecificuseforeachcomponentisdocumented.
MicrophoneAmplifier
Thefirststepintransmittingsoundistodigitizesoundwaves.ForthisweusedanelectretmicrophonepurchasedfromRadtronics.FrequentshoppersatTito'
splacedowntownknowthatfindingspecsheetsforproductsthereisimpossible.Themicrophonehesoldushadthreeleads,whichafterconsiderableangstwedecidedwereforpower,ground,andsignal.Thesignalcomingoffthemicwasfartoolowtoberead(withanydegreeofprecision)bytheanalogtodigitalconverter.Soofcourse,anamplifierisneeded.BeforethesignalisputthroughtheamplifierhoweveritisfirstputthroughacapicitortoremoveDC,andthenthroughavoltagedividertoappropriatelybiasthesignal.ALF353op-ampisusedtoboostthesignal,thegainisadjustedbytheresistorsandforthemysterymicrophonethegainisaround50-100(dependingonhowmuchpoppingandhowmuchqualityyouwant).
LaserDriver
AftertheA/Dconvertertranslatesthemicsignalinto8bits,theMCUgeneratestheappropriatebitstosend(includingstartandstopbits)andappliesthemtothelaserdrivercircuita5Vand0Vsignals.TheBJTinthiscircuitturnsonat5Vandprovidesthepropercurrentaccordingtothediodeandresitorvalues.
Receiver
Aphotodiodedetectsthelaserpulsesinadifferent(distant)location.Thissignalisputthroughacomparatorinordertogeneratesolid5Vand0Vvalueswhichareappliedtothereceivepinonthemicrocontroller.
OncethesignalisputthroughtheDAC(notshown,it'
sasimpleladder),itisboostedandlowpassfiltered(toimprovesoundquality).
Software
HalfDuplexSoftwareUART
InordertosendandreceivebothtextandaudiodatawedecidedtoimplementasoftwareprotocolwhichemulatedtheworkingsofahardwareUART.Thismeantthatwewouldbesendinginformationindigitalformoveraserialdatalink.Thelaserwouldessentiallyconstitutethe“wire”inthislinkconnectingourtwosoftwareUARTs.WecouldeasilyreservetwopinsofaporttobethereceiveandtransmitpinsforoursoftwareUART(inthefinalversionofthecodepinsD.0andD.1forreceiveandtransmitrespectively).Whatremainedwasanimplementationofareceivesubroutineandatransmitsubroutine.Thedevelopmentofthesesubroutinesisdescribedbelow.
UART101
AUniversalAsynchronousReceiverTransmitter(UART)operatesonthepremisethatonecantransmitan8-bit(sometimes9-bit)datamessagethroughasinglewirelinkwithouttimesynchronizationbetweensourceanddestination.TheresultantsinglewirelinkisknownasaSerialDataLinkbecausethebitsofthe8-bitmessagearetransmittedinseries.TheasynchronouspartoftheUART(whichiswhatattractedusmosttotheideaofemulatingaUARTinoursoftware)isachievedbysendingknownbitstodenotethebeginningandendofthedatamessage.Thesebitsarecalledstartandstopbitsandare0and1intheUARTprotocolrespectively.WhentheUARTisnottransmittingdataitmaintainsalogicalhigh
(1)onthewire.Thus,whenalogicallow(0)startbitistransmitted,thereceiverknowsthatamessageisbeingtransmittedandstarts“payingattention”.The8bitsfollowingthestartbitarethecontentsofthemessage.The8bitsarefollowedalwaysbyalogicalhigh
(1)stopbit(andinmorecomplicatedimplementationsaparitybitwhichweshallignoreforourpurposes).InthehardwareimplementationoftheUARTonmostAtmelchipstheUARTsamplesreceivedbits3timesinthemiddleofthebitandusesa“majorityrule”processtodeterminethevalueofthebit.Bycontrast,oursoftwareUARTwillsamplereceivedbitsonlyonceinthemiddletodeterminetheirvalue.
Also,anotherkeydifferencebetweenoursoftwareUARTandmosthardwareUARTsisthatitisahalfduplexUART.Thismeansthatitcanonlytransmitorreceiveatanygiventimeratherthanbothtransmitandreceiveatthesametime(fullduplex).AfullduplexsoftwareUARTwouldbemuchmorecomplicatedandisunnecessaryforourapplication.
ThemeasureoftherateatwhichbitsaretransmittedbyaUARToveraSerialDataLinkisknownasabaudrate(theterm“baud”doesnotstandforanythingbutratherisashortenedformofthenameofEmileBaudot,apioneerinearlytelegraphsystemswhoseworkpavedthewayfortheModulatorDemodulator(Modem)).Moreover,adatarateof300baudisanalogoustoarateof300bitspersecond(bps).Thisdatarateisimportantfortworeasons:
ItdetermineshowlongthetransmittingUARTmustmaintainabit’svalueonthewire,anditdetermineshowlongthereceivingUARTmustwaitbetweensamplingbits.ThesetwolengthsoftimeareactuallythesameandwillbeimplementedinoursoftwareUARTwithasoftwaredelaycall(referredtohereafterasa“delay”).
Tocalculatethelengthoftimeweneedthedelaytolastwemustknowthatgettingintoeachofthetransmitandreceivesubroutinesanddoingthenecessarylogicaloperationstochangebitvaluesortodeterminereceivedbitvaluestakeatotalofabout1μs(or16operations)andsowemustsubtractthisamountfromourendresult.Inthefollowingcalculationswewilldenoteourenddelayas“delay”andourdesiredbaudas“baud”:
Wefirstmustcalculatethetimelengthofabitatthedesiredbaud:
Thengettheperiodinμs:
Wethenroundthisresultandsubtract1μstoaccountforoverheadandlogicaloperations.Thisisourfinaldelay:
Thisdelayisdenotedas“buadnum”inthefinalcode.Wealsorequire“halfbuadnum”forthereceiver(asaruleofthumbbuadnum/2,roundresultupifbuadnumisodd).Anytimingerrorsassociatedwiththesecalculationsonlypersistfor8bitsbecausethemessagesareonly8bitslong.Sucherrorswouldbe“reset”atthebeginningofthenexttransmission,andasaresultwenoticedthatthesoftwareUARTwasnotterriblysensitivetoerrorsontheμslevel(especiallyatlowerbauds).Thesediscussionsofdelaycalculationswillmakemoresensetothereaderafterreadingthedescriptionsofthetransmitandreceivesubroutines.Atableofsomecommondelaysisgivenbelow.
BAUD
baudnum
halfbaudnum
110
9090
4545
9600
103
52
27777
35
18
38400
25
13
57600
16
8
115200
4
Itshouldbenotedthat(althoughthecodeisnowherenearthesame)manyoftheconceptsweusedincreatingoursoftwareUARTcamefromtheAtmelApplicationNoteonHalfDuplexCompactSoftwareUARTfortheAVR8-bitRISCmicrocontrollerfamily(AppNoteAVR305at).ThecodeprovidedwiththisAppNotewaswrittenentirelyinassemblerlanguageandsowewerepresentedwiththetaskofimplementingaCversionwhichmimickeditsoperation.Whatfollowsisadescriptionofourendproduct.
TheTransmitSubroutineput()
Totransmitabyte(8bits)overtheserialdatalinkwedevelopedasubroutinecalledput.Thissubroutinetakesthe8bitsofdatainthecharactervariableTxbyteandshiftseachbitoutontotheserialdatalinkoneatatimestartingwiththeLSB.ThedatabytedesiredtobesentshouldbeplacedintoTxbyteandthenputmustbecalledinordertosendth
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Laser Communications System