LCD显示的温度表的设计.docx

上传人:lao****ou 文档编号:406193 上传时间:2023-10-24 格式:DOCX 页数:8 大小:43.46KB
下载 相关 举报
LCD显示的温度表的设计.docx_第1页
第1页 / 共8页
LCD显示的温度表的设计.docx_第2页
第2页 / 共8页
LCD显示的温度表的设计.docx_第3页
第3页 / 共8页
LCD显示的温度表的设计.docx_第4页
第4页 / 共8页
LCD显示的温度表的设计.docx_第5页
第5页 / 共8页
亲,该文档总共8页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《LCD显示的温度表的设计.docx》由会员分享,可在线阅读,更多相关《LCD显示的温度表的设计.docx(8页珍藏版)》请在第一文库网上搜索。

1、-bGN16D2LC12 3 4 5 6 7Ddddddde-oC=33pfJ-JI1.C_C32.768kHzRA2RAIRA3RAORA40SC1MC1R0SC2VssVddRBORB7RB1RB6RB2RB5RB3RB4PIC16F84TemperatureDisp1ay8T1C5551651CDdisp1ayOfTemperatureTHERM.ASMShowsTemperaturefromThermistoron1CDINC1UDEp16f84.inc_CONFIG_PWRTE_0N&_1P_OSC&_WDT_0FF;uses32.768kHzcrysta1ERROR1EVE1-22

2、4ERROR1EVE1-302;supressannoyingmessagebecauseoftris;supressmessagebecauseofpagechange;DefineInformation#DEFINERSPORTA,0#DEFINEEPORTA,1;Macro;RAOisRS1ineof1CD;RA1isE1ineOf1CD;RB0-RB3areD4-D7of1CDEStrobeMACRO;StrobetheErBitbsfEbcfEENDMCB1OCKOCHTemp;atemporaryvariab1ecount;counterbin;binarynumbertobeco

3、nvertedtoBCDhundreds;BCDhundredsresu1t1ens_and_ones;BCDtensandonesresu1tsavetmr;usedtosaveva1ueoftmrdispva1ue;usedtoho1dtemperaturetobedisp1ayedtab1eindex;pointstotab1eva1uetodisp1ayENDCORGO;startat1ocation0gotomain;jumpovertomainroutineDataformessagetobeoutputshomsg:addwfPC1,fmdtTMROVa1ue:,Om1dtTem

4、perature,O;MessagetoOutput;OutputtheCharactersRatiosofPresca1erpreratio:addwfPC1,f;se1ectoffsetusingWdtD,2D,4,D,8,D,16,D,32,D64D,128;Initia1izetheponsInit:cirfPORTAc1rfPORTBmov1wB,00010000,trisPORTAmov1wBWi1OOOOtrisPORTBmov1wB1OO1(X)Oir;RA4input,othersoutputs;RB4.RB5input,othersoutputs;pu11-upsenab1

5、ed;presca1erassignedtoRA4;presca1ersetto1:16optionreturn;Initia1izethe1CDinit1cd:mov1wD40ca11nmsecbcfRSmov1w0x03ca11Nybb1eOutca11D1ay5EStrobenopnopEStrobenopnopbcfRSmov1w0x02ca11Nybb1eOut;Wait40msecsbeforeReset;sendan8bi1instruction;ResetCommand;SendtheNybb1e;Wait5msecsbeforeSendingAgain;Wait244usee

6、sbeforeSendingtheSecondTime;Wait244useesbeforeSendingtheThirdTime;sendan8bitinstruction;Set4BitModenopnopmov1w0x028ca11SendINSmov1wOxO1Oca11SendINSmov1wOxOO1ca11SendINSca11D1ay5mov1w0x006ca11SendINSmov1wOx(X)C;4bit,21ine,5x7font;disp1ayshiftoff;C1eartheDisp1ayRAM;Note,Cantakeupto4.1msecs;incrementcu

7、rsor;disp1ayoncursoroffca11SendINSreturnSendthecharacterinWouttothe1CDSendASCIIadd1w0,SendCHARmovwfTempswapfTemp,wbsfRSca11Nybb1eOutmovfTemp,w;SendnbrasASCIIcharacter;SendtheCharactertothe1CD;SavetheTemporaryVa1ue;SendtheHighNybb1e;RS=1;Sendthe1owNybb1ebsfRSca11Nybb1eOutreturnSendaninstructioninWout

8、tothe1CDSendINSmovwfTempswapfTemp,wbcfRSca11Nybb1eOutmovfTemp,W;SendtheInstructiontothe1CD;SavetheTemporaryVa1ue;SendtheHighNybb1e;RS=O;Sendthe1owNybb1ebcfRSca11Nybb1eOutreturnSendthenibb1einWouttothe1CDNybb1eOu1;SendaNybb1etoIhe1CDmovwfPORTBEStrobenopnop;Strobeoutthe1CDDatareturnOutputthemessageont

9、he1CDOutMessage:movwfFSR;Pointatfirst1etterOut1oop:movfFSR,w;GetpointerintoWincfFSR,f;Setupfornext1etterca11shomsg;Ge1charactertooutputior1w0;AttheEndoftheMessage?btfscSTATUS,Z;Skipifnotatendreturn;Yes-Equa1toZeroca11SendCHAR;OutputtheASCIICharactergotoOut1oop;GetthenextcharacterChangebinarynbrinbin

10、toBCDbinary_to_bcd;byScottDatta1oc1rfhundredsSWiipfbin,Waddwfbin,Wand1wB,0000111skpndcadd1w0x16skpndcadd1w0x06add1w0x06skpdcadd1w-0x06btfscbin,4add1wOx16-1+0x6skpdcadd1w-0x06btfscbin,5add1w0x30btfscbin,6add1w0x60btfscbin,7add1w0x20add1w0x60r1fhundreds,fbtfsshundreds,0add1w-0x60movwftens_and_onesbtfs

11、cbin,7incfhundreds,freturnDe1ayroutinemsec250mov1w0;250msecde1ay(adjustedtotryand;a11owfor2.5%1ow1ooptime)goto$+2D1ay5mov1w5;de1ayfor5mi11isecondsnmsec:;de1ayfor#msecinWonentrynop;eachnopis0.122mi11isecondsnopnop;eachtota11oopis8X0.122=0.976msecnopadd1wHFF;sameassubtracting1fromWhtfssSTATUS,Z;skipif

12、resu1tiszerogotonmsec;thisis2X0.122msecreturn;backtoca11ingpointDisp1aybinaryva1ueinWindecima1DispDecmovwfbinca11binary_to_bcdmovfhundreds,Wca11SendASCIIswapftens_and_ones,Wand1wHFca11SendASCIImovftens_and_ones,Wand1wH,Fca11SendASCIIreturnTheMainroutinemain:ca11Init;initia1izeports,setuptimerca11ini

13、t1cd;initia1izethe1CDmov1wH,80;positionat1st1ineco1umn0ca11SendINSmov1wm-2;sendTMR0Va1ue:messageca11OutMessagemov1wH,C0ca11SendINS;positionat2nd1ineco1umn0mov1wm1-2;sendTemperature:messageca11OutMessagesho1oop:mov1wH8C;positionat1st1ineco1umn12ca11SendINSbcfINTCON,TOIFC1rfTMROca11msec250ca11msec250c

14、a11msec250ca11msec250movfTMRO,WmovwfsavetmrbtfscINTCON,TOIFgotoover1oadca11DispDecmov1wHCCca11SendINSmov1w2movwfPC1ATHmov1wD,64subwfsavetmr,Wmovwftab1eindexca11Iemptab1e1movwfdispva1ueswapfdispva1ue,Wand1wH,OF,ca11SendASCIImovfdispva1ue,Wand1wH,OF,ca11SendASCIImov1w.,ca11SendCHARmov1w3movwfPC1ATHmovfUb1eindex,Wca11temptab1e2ca11SendASCIIgotosho1oopover1oadmov1wOca11SendCHARmov1w,Vca11S

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 应用文档 > 汇报材料

copyright@ 2008-2022 001doc.com网站版权所有   

经营许可证编号:宁ICP备2022001085号

本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有,必要时第一文库网拥有上传用户文档的转载和下载权。第一文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知第一文库网,我们立即给予删除!



客服