【正文】
n39。)。 write_data(n % 10 + 39。039。)。 write_data(39。 n = M1*60/Z/T。)。 write_data(39。039。)。 write_data(39。e39。 write_(0x80)。 //允許定時(shí)/計(jì)數(shù)器0 中斷 if(M_FLAG) TR0=1。} } flag = 0。039。 write_(0x80 + 0x4A)。039。 write_(0x80 + 0x4A)。m39。 write_data(T / 10 % 10 + 39。=39。while(!KEY3)。)。)。 write_data(Z / 100 + 39。)。 write_data(39。 } if(!KEY1 amp。 } if(!KEY3) { delay(15)。 while(!flag) { if(!KEY2) { delay(15)。 write_(0x01)。 delay(5)。}void write_(uchar ){ LCM_RS=0。 //T法測(cè)速參數(shù)uint Z = 1,T = 1000,n = 100。 //LCD1602命令端口 sbit KEY1=P1^1。但看到自己的成果時(shí)。當(dāng)定時(shí)間到的時(shí)候關(guān)閉外部中斷和定時(shí)器,讀取外部中斷計(jì)數(shù)的個(gè)數(shù)并計(jì)算速度。在調(diào)整參數(shù)的時(shí)候,也是根據(jù)“減”“加”調(diào)整參數(shù)。內(nèi)部方式的時(shí)鐘電路如圖4—2(a) 所示,在RXD和TXD引腳上外接定時(shí)元件,內(nèi)部振蕩器就產(chǎn)生自激振蕩。盡管他的大部分功能集成在一塊小芯片上,但是它具有一個(gè)完整計(jì)算機(jī)所需要的大部分部件:CPU、內(nèi)存、內(nèi)部和外部總線系統(tǒng),目前大部分還會(huì)具有外存。第2章 硬件系統(tǒng)設(shè)計(jì) STC89C52介紹STC89C52是一種低功耗、高性能CMOS8位微控制器,具有 8K 在系統(tǒng)可編程Flash 存儲(chǔ)器。M法測(cè)速的分辨率:M法測(cè)速誤差率:在上式中,Z 和 Tc 均為常值,因此轉(zhuǎn)速 n 正比于脈沖個(gè)數(shù)。測(cè)速誤差率的大小決定于測(cè)速元件的制造精度,并與測(cè)速方法有關(guān)。當(dāng)脈沖已固定,而需要提高分辨率時(shí),可利用帶90度相位差A(yù),B的兩路信號(hào),對(duì)原脈沖數(shù)進(jìn)行倍頻。s external interrupts and timers for encoder output pulse is sampled to calculate the speed of the motor. Can be adjusted using touchtone m, t law Velocimetry parameters such as z, Tt and Tc, as well as in speed measurement method of choice, as a way to enhance the adaptability of this design. Parameter selection and calculation of motor speed results are available on LCD1602.Keywords:STC89C52,M、T method, the LCD1602, Motor speed目 錄第1章 緒論 1 旋轉(zhuǎn)編碼器 1 數(shù)字測(cè)速的精度指標(biāo) 2 分辨率 2 測(cè)速誤差率 2 M法測(cè)速 2 T法測(cè)速 3第2章 硬件系統(tǒng)設(shè)計(jì) 5 STC89C52介紹 5 6 6 顯示電路 7 速度檢測(cè)電路 7 按鍵輸入電路 8第3章 系統(tǒng)軟件設(shè)計(jì) 9 主程序設(shè)計(jì) 9 M法測(cè)速程序設(shè)計(jì) 10 T法測(cè)速程序設(shè)計(jì) 11總結(jié) 12參考文獻(xiàn) 13附錄A 系統(tǒng)原理圖 14附錄B 主要C語言源程序 15第1章 緒論 旋轉(zhuǎn)編碼器旋轉(zhuǎn)編碼器是用來測(cè)量轉(zhuǎn)速的裝置,光電式旋轉(zhuǎn)編碼器通過光電轉(zhuǎn)換,可將輸出軸的角位移、角速度等機(jī)械量轉(zhuǎn)換成相應(yīng)的電脈沖以數(shù)字量輸出(REP)??梢允褂冒存I輸入來調(diào)整M法、T法測(cè)速法中Z、Tc和Tt等參數(shù)以及測(cè)速方法的選擇,以此來增強(qiáng)本設(shè)計(jì)的適應(yīng)性。其旋轉(zhuǎn)方向的判別和脈沖數(shù)量的增減,需借助后部的判向電路和計(jì)數(shù)器來實(shí)現(xiàn)。 數(shù)字測(cè)速的精度指標(biāo) 分辨率分辨率定義:改變一個(gè)計(jì)數(shù)值所對(duì)應(yīng)的轉(zhuǎn)速