APRSBH4TDV译中文2.docx
《APRSBH4TDV译中文2.docx》由会员分享,可在线阅读,更多相关《APRSBH4TDV译中文2.docx(20页珍藏版)》请在冰豆网上搜索。
APRSBH4TDV译中文2
PIC-etRadioII:
HowtoReceiveAX.25UIFramesUsingInexpensivePICMicrocontrollers
pic-et无线电二:
如何收到ax。
25用户界面框架使用便宜的照片微控制器
byJohnA.Hansen,W2FS
StateUniversityofNewYork
49MapleAvenue
Fredonia,NY14063
hansen@fredonia.edu
被约翰一个。
汉森,w2fs纽约州立大学49枫树大街弗里多尼亚,纽约14063汉森@fredonia。
edu
Abstract:
ThispaperprovidesstepbystepdocumentationofhowtodecodeAX.25UIframesusinginexpensivePICmicrocontrollers.ItisdesignedprimarilyforthosewhowishtoreceivepacketradioUIbeaconsfrompointtomultipointcommunications.ThearticleassumessomeknowledgeofprogrammingconceptsandPICmicrocontrollers.
摘要:
这篇论文提供逐步如何的文件解码ax。
25用户界面框架使用便宜的照片微控制器。
它被计划主要地为那些谁希望收到分组无线用户界面指路明灯从点对多点沟通。
文章假设一些编程概念的知识,照片微控制器。
Keywords:
AX.25,UIFrames,PICMicrocontrollers
关键词:
ax。
25,用户界面框架,照片微控制器
Introduction
介绍
Atthe1998ARRL/TAPRDigitalCommunicationsConferenceIpresentedapaperdescribinghowtoencodeAX.25framesusingaPICmicrocontrollersothoseframescouldbetransmittedviaAmateurRadio.However,havinglearnedtotransmitpacketusingcheapchips,itwasonlynaturalthatpeoplewouldwanttoknowhowtoreceivepacketframesaswell.
在1998线电中继联盟/tapr数字交流会我提交文件描述如何编码ax。
25次帧使用一个照片微控制器所以那些框架可以被发送通过业余无线电。
然而,有学习传送分组使用廉价的芯片,它只自然那个人将想知道如何收到包框架由于好。
ThefirsteffortmadeinthisdirectionthatIknowofwassomeassemblercodedevelopedbyByonGarrabrant,N6BG.Anumberofpacketreceiveroutines(byByonandothers)arecurrentlyavailableontheTAPRPICSIGsoftwareFTPsite(ftp.tapr.org/picsig/software).ThepurposeofthispaperistoexplainthebasicsofhowPIC-basedpacketreceivefirmwareworks.
第一努力使在这个方向那我知道是一些汇编代码开发由含宝石的黄褐色土garrabrant,n6bg。
许多包收到例行(由含宝石的黄褐色土等等)目前可用的在taprpicsig软件传输文件现场(ftp。
tapr。
org/picsig/软件)。
目的的这篇论文说明如何的基本点pic-based包收到固件工作。
Notethatthispaperwillnotprovideyouwithaworkingpacketreceivesystem.Ifthatiswhatyouareseeking,simplyusethecodeprovidedontheTAPRFTPsite.Instead,mypurposeistodescribethetheorybehindhowPICbasedpacketreceiveroutinesworksothatyouwillbeabletocreateyourowncodetodecodeAX.25frames.
注意那这篇论文会不给你提供一个工作的包收到系统。
就那就是你寻求,简单地使用码提供在tapr传输文件现场。
代替,我的目的描述理论背后如何照片基础包收到日常工作以便是创建你的自己的代码解码ax。
25次帧。
Inkeepingwiththisgoal,I’vetriedtomakethecodethatispresentedhereassimpleaspossible.Todothis,Imadeanumberofsimplifications.First,allcodeexamplesherearewritteninC(mycodeisdesignedfortheCCSCcompiler,becauseitisrelativelycheap).IdidthisbecauseIthinkthatregardlessofwhetheryouareplanningtodevelopyourprojectinCorassembler,Cissomewhateasierformostpeopletofollow.
在保持说完这个目标,我努力地仰着脸孔使码,被介绍这里尽可能简单。
做这个,我使许多简单化。
第一,所有代码例子这里被写在c源文件(我的码被设计船级社c编译器,因为它相对廉价)。
我做这因为我想那不管是否你在计划开发你的项目在c源文件或汇编程序,c源文件是有些容易为大多数人跟随。
Secondly,thecodepresentedhereisdesignedtoreceivepacketsthatarenolongerthan40bytes(includingtheheader).IusedthisapproachbecauseIwantedtouseonlyaPIC16F84microcontrollerandanMX-614modemchip.Significantlylongerpacketswouldrequiresomeexternalstorage,butthe16F84hasadequateon-boardstoragetohandlerelativelyshortpackets.
其次,码介绍这里被计划收到包那个不超过40字节(包括队长)。
我使用这态度因为我想使用只有一个pic16f84微控制器,一个mx-614调制解调器芯片。
意味深长地悠久包将要求一些外部存储器,然而16f84有充足已装船存储处理相对短的包。
Anumberofpacketreceiveimplementationshavebeenrealizedthatuseexternalstorageandcanhandlelongerpackets.Forexample,MikeBergN0QBHhasusedaRamtronFRAMchipasstorageforlongerpackets.Ihaveuseda32KstaticRAMchipinmyPICKISSTNCtoprovidebothtransmitandreceivestorage.
许多包收到实现已经是实现那个用外部存储器,可以处理悠久包。
例如,话筒冰山n0qbh使用了一个瑞创国际弗拉姆芯片由于存储为悠久包。
我使用了一个32k静态随机存取存储器芯片我的照片吻跨国公司提供两者都发送与接收存储。
However,limitingthereceivedatato40bytesmeansthatweneednotincludehereroutinesforwritingandreadingtostorage.Finally,thecodepresentedhereisdesignedtoreceiveUIframes.TheresultspresentedherecouldbeextendedtocovertherangeofAX.25frames,sincetheprinciplesinvolvedinreceivingthedataarethesameinanycase.
然而,限制接收数据40字节平均值那我们需要不包括这里例行为写作和阅读存储。
终于,码介绍这里被计划收到用户界面框架。
结果介绍这里可以被延伸到包括范围ax。
25次帧,自从原则参与对的基准同一步讲。
Tomakethiscoderelativelysimple,however,thispaperwillpresentcodethatmerelyreceivestheframe,assumesitisaUIframeandformatsitandpumpsitoutaserialporttoaterminal.TheconstructionofUIframesisnotcoveredhereindetail.ForadiscussionofhowtobuildupUIframes,seemy1998DCCpaper.
使这密码相对简单,然而,这篇论文将现在的码如此只是收到框架,假设它一个用户界面帧,相机或菲林它,抽水机它出一个串口一个终端。
结构的用户界面框架不是覆盖这里详细。
为如何的一个议论建立用户界面框架,见我的1998催化裂解纸。
ReceivingBits
Theessenceofreceivingpacketisreceivingdatabits.Whiledataistransmittedovertheairasaseriesoftones(1200Hzand2200Hz),abitofinformationisnotrepresentedbythefrequencyofthetone,butratheritisrepresentedbywhetherthereisachangeintoneornot.
本质的对的包在收到数据位。
而基准被发送用无线电由于一系列的音(1200赫兹,2200赫兹),一个信息不是代表附近的的频率的音,而是它被代表由是否有一个变动在音或不。
Ashiftintone(eitherfrom1200to2200Hzorviceversa)representsazero,whilenoshiftintonerepresentsaone.Thisprojectassumesthatmodemfunctionsaredonebyanotherchip(inthiscasetheMX-614)sothataninputpinonthePICseesa“high”(+5volts)whenthereis1200Hztoneanda“low”(0volts)whenthereisa2200Hztone.
一个移入腔调(二者之一从1200到2200赫兹或反之亦然)代表一个零,而没有移入音代表一个一。
这个项目假设调制解调器功能被对待另一的芯片(在这种情况下mx-614)以便一个输入针照片供桌一个“高”(+5伏特)当有1200赫兹音,一个“低”(0伏特),有一个2200赫兹音。
Wewillbeginthediscussionofreceivingpacketframeswiththecodethatisusedtoreceiveabit.Iusethefunctionbitin()toaccomplishthis:
我们会开始议论的对的包框架同码那个被过去常常收到一点儿。
我使用功能比廷()完成这
intbitin(){//functiontoreadabit
staticintoldstate;//oldstateretainedbetweenrunsofthisfunction
intk;
for(k=0;k<121;k++){//thisloopallows838ustogoby.Ifnostatechange,bitis1
if(input(rcvPin)!
=oldstate){//ifstatehaschanged
oldstate=input(rcvPin);//updateoldstate
delay_us(430);//movetohalfwaythruthenextbit
return0;//return0ifstatechanged
}//endofif
}//endoffor
return1;//return1ifstatedidnotchange
}//endofbitin()
ThePICpinthatisconnectedtomodemchipisreferredtoas“recPin”.Themainpurposeofthisroutineistolookforstatechangesontheinputpin.Thefunction“input(recPin)”isbuiltintotheCCScompilerandreturnsa1whenthepinnamedrcvPinishighanda0whenthepinislow.
照片针,被连接调制解调器芯片被提到由于“recpin”。
这个的主要的目的例行寻找状态变化在输入针。
功能“输入(recpin)”被建立到船级社编译器,返回一个1当针命名rcvpin是极大,一个0,针是轾。
Twovariablesareusedhere,k(tocountthenumberoftimesthroughtheloop)andoldstate,whichkeepstrackofthepreviousstateofrecPin.Oldstateisastaticvariablesothatitwon’tloseitsvaluebetweentimeswhenthisfunctioniscalled.Itcyclesthroughthe‘if’loop121timestoseeifthestatehaschangedfromit’soldvalue.AssumingyouarerunningthePICat10MHz,121timesthroughthisloopwilltake838microseconds(s)tocomplete.
二变量被使用这里,K(数次数穿过环的进出交叉点)和oldstate,——跟踪以前州的recpin。
旧状态一个静态变量以便它赢得't失去它的价值有时当这个功能被呼吁。
它循环‘如果'循环121时间见如果国家改变了从它的旧的价值。
承担你正在跑步照片在10兆赫,121时间通过这循环将采取838微秒(?
s)完成。
Ina1200baudtransmission,eachbitlasts833s(1,000,000/1200).Thusif838sgobywithnochangeofthestateofrecPin,wemustbelookingata1ratherthanazero.Sothefunctionreturnsa1.
在一个1200波特传输,每位=833us(1,000,000/1200)。
因此如果838us依据同没有国家的改变的recpin,我们必定观一个1条颇比一个零。
如此功能返回一个1。
If,ontheotherhand,astatechangeisdetectedduringthistimeperiod,thefunctionreturnsazero.Ifitfindsazero,thefunctionwillalsointroduceadelayof430s.Thisisanimportantpoint.Packetisanasynchronouscommunicationssystem.Whileabitlasts833s,thereisnowaytoknowwhereaparticularbitwouldstartandstopotherthanbylookingforthoseinstanceswhenthetonechanges.
如果,另一方面,一个状态改变被检测中这个时间,功能返回一个零。
如果它发现一个零,功能会也介绍一个430的延迟?
s。
这是要点。
包一个异步通信系统。
而一点儿末833?
s,有没有办法知晓,一个特别点滴将开端和车站除了把寻找那些例子,音变动。
Atthemomentthetonechanges,weknowwhereweareinthebitstream.Thuswerecalibratethereceiveroneverytonechange.Adding430srightafteratonechangethrowsusjustpastthemiddleofthenextbit.Consequentlyeverytimeazero(tonechange)isdetectedthereceiverisreliablyplacedataspotthatisjustafterthemiddleofthefollowingbit.
此刻音变动,我们知道逃不出这鬼地方在比特流。
从而我们重新校准接收器在每个音改变。
补充430?
s权以后的的一个音改变抛掷我们刚刚过去的未来点滴的中间。
所以每一次一个零(音改变)被检测接收器可靠地放置在一个现场,在中间之后就的下面咬。
Ifthiswerenotdone,smallerrorsintimingwouldaddupaswereceivedmoreandmorebitsandeventuallywemightmissabitaltogether.Packetradiotransmissionsaredesignedtoensurethatazerowillbetransmittedatleastonceeverysixbits.Thusthereceivingroutineisrecalibratedatleasteveryfivemilliseconds.
如果这不是做,小错误在安排正在将合计由于我们收到越来越多点滴,终于我们可能一点儿错过共。
分组无线传输被计划保证一个零将发送至少一旦每个六点滴。
从而对例行被重新校准至少每个五毫秒。
Thefunctionbitin()receivesonebitofthepacketbitstream.Thetrickistomakesurethatthefunctioniscalledsufficientlyoftenthatnobitsaremissed.Inaddition,wemustknowhowtoprocesstheaccumulatedbyteswhenanentirepacketisreceived.
功能比廷()收到一包的咬比特流。
手法保证功能被呼吁充分地常常如此无点滴被错过。
此外,我们一定知道如何进程累积字节当一个整个包被收到。
Let’sPlayCapturetheFlag
Youcannotdecodeapacketframeunlessyoureceivetheentireframe.Thisisbecausetheframecontainsatwobyteframechecksequence(FCS)thatmustmatchthevaluetransmittedbythesendingstationinorderforthepackettobevalid.Henceitdoesnogoodtobeginreceivinginthemiddleofaframe.
你不能解码一个包框除非你收到整个框架。
这是因为框架包含一个贰字节帧检验序列(功能界别)那肯定相配值发送以发送站为了为包有效。
故它欺诈没有的益处开始收到在一帧的中间。
Whentheprogramfirststarts,therefore,itmustbeginbylookingfortheflagsthatindicatethebeginningofaframe.Theseflagsaresimplythebyte01111110inbinary(7Einhexadecim