速度轉(zhuǎn)速數(shù)字測(cè)量系統(tǒng)設(shè)計(jì)(AT89C51含CAD電路圖、說明書)
速度轉(zhuǎn)速數(shù)字測(cè)量系統(tǒng)設(shè)計(jì)(AT89C51含CAD電路圖、說明書),速度,轉(zhuǎn)速,數(shù)字,測(cè)量,丈量,系統(tǒng),設(shè)計(jì),at89c51,cad,電路圖,說明書,仿單
畢 業(yè) 設(shè) 計(jì)(論 文)外 文 參 考 資 料 及 譯 文
譯文題目: Digital Meter for Measuring Rotational Speed
數(shù)字式轉(zhuǎn)速測(cè)量?jī)x
學(xué)生姓名:
?! I(yè):
所在學(xué)院:
指導(dǎo)教師:
職 稱:
Digital Meter for Measuring Rotational Speed
The rotor speed control system of industry is one of the important parameters. Mechanical tachometer measuring speed, the rotor contact with the measured object must be to get the synchronous speed, through the internal gear shift instruction after the pointer speed with the size of the header. Use of mechanical tachometer measured object can interfere with movement, especially when measured rotor mass is very small, speed tables on the rotor pressure is not a small additional load, which affects the measurement accuracy. This paper describes a 8032 single-chip microcomputer as the core to the non-contact Digital Tachometer.
1 speed measuring principle
The gun speed-sensitive devices with infrared sensors, launched by the specialized infrared detection devices, while receiving reflected back from the measured object infrared, photoelectric conversion into electrical pulses through the signal, does not affect the rotation of the object. Tubes and pipes are fixed in the detection of acceptable shelf, through the lens focus, semi-transparent film not only to the reflected infrared light fired rotating objects, they can rotate the object by the reflected infrared light through the translucent membrane back fired for management. Along the circumference of a rotating body even paste some reflection paper, it directed reflection infrared to receive the reflected acceptance of the infrared control.
Photovoltaic conversion shown in Figure In the optical triode 3DU5C adding an appropriate bias, when 3DU5C by infrared irradiation, at the conduction state, A point for the low level, 3DG6 end, B point is high; when no infrared radiation, the photoelectric transistor closed A high point presentation, so 3DG6 low collector point B, B point of the pulse signal through the inverter 1,2 plastic, and then the door 3 RP, frequency and speed will be proportional to the size of the corresponding changes The speed pulse signal. Speed pulse signal into the 8032 microcontroller timer / counter, through the microcontroller to calculate speed software processing.
Figure 1 Schematic photoelectric conversion
When the machine used in the measurement speed M / T method and timing method were used. M/T M / T method is the detection time Tc, the time according to speed pulse m1 and m2 to calculate the speed pulse. If a fixed period Tc, the total time taken and pulse rotation pulse fp fc's Pulse on m1 and m2, timing pulse frequency f, rotor output pulses per revolution for the p, the speed n = 60fm1 / pm2 (r / min). Such as the speed measured over 1 s pulses for the m1, rotor output pulse number per revolution, that great number of p, the speed n = 60m1 / p (r / min).
2 hardware speed measurement instrument
Figure 2 constitute the grounds of speed 8032 MCU measuring circuit. 8032 is MCS-51 series single chip, compared with the common 8031 chip, a feature more than 8032 strong T2 timer / counters and 128 bytes of internal RAM, which T2 counter with 16-bit auto-reload and capture, can for timer / counter with, but also used as a baud rate generator. The system used for time T2, which take into account regular pulse, regular pulse signal directly from the 8032 chip address latch signal ALE client leads, and through the 74LS74 dual D flip-flop frequency, was two points. When using 6 MHz crystal oscillator, the time pulse frequency fc is 0.5 MHz. T0 accrual speed pulse counter fp, T1 time pulse counter for taking into account fc, trigger DFF1, DFF2 and 1,2,3,4 component count and gate control circuit, can also start and stop counters T0 and T1. P0 port to allow control through the end of 8D with latch 74LS377 extends an 8-bit output, as a five segment LED digital display of the data line selection code. P3.0, P3.1 access switches S1 and S4, S1 for the very few P set selector switch, S4 input pulse for the very few keys. P3.2 and P3.3 are connected S2 and S3 switch, S2 switch method for the speed selection key; select the use of M / T method speed, or velocity measurement with time. S3 for the speed frequency select switch, to select the measuring speed or frequency measurements. When using regular method to measure the speed, the system can be easily measured by measuring the frequency.
3 software design and anti-interference measures
System programming includes the main program, interrupt procedures, code conversion routines, display routines, etc. The hardware structure of two measurement methods are identical, but different software process, to set the speed through the P3.2 port approach. The following two measurement methods were discussed works.
M / T method, first of all by the end of 8032 the P1.1 output start pulse signal, the start pulse cleared DFF1 and DFF2 two triggers, so that Q1 ended output low, blocking the door 2,3,4, Q- 1 side open the door for the high one, and trigger DFF2 the Q-2-ended output is high, ready for the start of work. When the speed pulse signal fp receives the rising edge, the flip-flop DFF1 turn, Q-1 is low, blocking the door 1, Q1 is high, open the door 2,3,4, so that start time T2, m1, m2 and started counting. In the interrupt program, the P1.2 8032 ended output pulse signal to stop, set bit trigger DFF2, Q-2 low-side outputs, blocking the door 2,3,4, T0, T1 and stop counting. Interrupt the program while reading speed signal pulses and timing signal pulses m1 m2, in the main program, in accordance with m1, m2, P and f calculated speed n = 60fm1/pm2, and converted to BCD code sent to the digital look-up table display, complete a data collection and display.
In the regular method, due to the timing signal generated 1 s, while the maximum time the system 131 ms, it is the law in time to take 10 consecutive 100 ms time method, when the time to 100 ms, the timer T2 overflow interrupt to the 8032 application. Interrupt in the interrupt process of the cumulative number of times, if the cumulative number of times until they break 10, not to make any operation on the return, T2 to the next 100ms the time, T0 to count speed pulse, when the interrupt when the number reached 10 in interrupt the program, set bit P1.2, stop counting, and reading the count value T0 m1, corresponding in the main program to calculate the speed of operation, and converted to BCD code, send LED display. Time here with 16-bit counter with auto-loading feature of the T2 counter, when T2 overflow interrupt the same time, the counter counts automatically reload the initial value, continue to regularly. So it's time is continuous, without interruption and response procedures for dealing with the impact of disruption. If not overloaded by features such as timers T0 or T1, then when the timer overflow, it should be in response to failure, reset the timer interrupt program, the initial value. Timer timing is intermittent, the impact of timing accuracy, thereby affecting measurement precision. Visible by 8032 in the T2 counter timer is a feature of the system, it can significantly improve measurement precision. The guns range in 0-49r/min accuracy up to ± 0.1 r / min, at 50-99 999r/min range of accuracy up to ± 1 r / min.
The gun can measure the number of different pole pulse generator pulse occurs, such as infrared detectors above, when changing the rotating body attached to the amount of reflection paper, issued by the rotor per revolution pulse number p is also changed accordingly, At this point, if still in accordance with the procedures in the original p value calculation, calculation error will be. Therefore, the system provides very few of the features set the scene: P3.0 I take very few set selector switch, when P3.0 is high time that need to set the pole, then the system waiting for input into the mouth by the P3.1 pulse signal, each pulse makes the system very few register value plus 1, and displayed in the LED digital tube.
Velocity measurement at the time, and when not to n = 60m1 / p the operators directly to the speed of 1 s pulses m1 transformed into BCD code shows that the value obtained is obviously the input pulse frequency. Therefore, the system set up speed frequency options. P3.3 port access speed frequency select switch S3, when P3.3 is high time that test frequency.
Meanwhile, the system software has set a number of logical fault diagnosis functions, such as speeds above 99 999 r / min, the system will display PPPPP, that go beyond the scope of this gun is measured, and as if the M / T velocity measurement, the Select the measurement frequency, it shows EEEEE, prompts the user error and so on.
As the gun is generally in the industrial field in the working environment of sources of interference, so in the design, using anti-jamming measures, such as power supply filtering, decoupling, pay attention to the trend of ground, then the locations and other hardware interference approach to CPU, RAM self-test, software redundancy, software, software such as anti-jamming technology trap.
Figure 2 Circuit Digital Speed Meter
From: Document Type and Number: United States Patent 5442592
Publication Date: 08/15/1995
Primary Examiner: Lobo, Ian J.
數(shù)字式轉(zhuǎn)速測(cè)量?jī)x
1 轉(zhuǎn)速測(cè)量?jī)x原理
本測(cè)速儀的測(cè)速敏感器件采用紅外線傳感器,由專門的探測(cè)裝置發(fā)射紅外線,同時(shí)接受從被測(cè)物體反射回來(lái)的紅外線,通過光電轉(zhuǎn)換變?yōu)殡娒}沖信號(hào),不影響物體的轉(zhuǎn)動(dòng)。發(fā)射管和接受管都固定在探測(cè)架上,通過透鏡聚焦,半透明膜既能使反射的紅外光線射向轉(zhuǎn)動(dòng)物體,又能使由轉(zhuǎn)動(dòng)物體反射回來(lái)的紅外線通過半透明膜射向接受管。在轉(zhuǎn)動(dòng)體上沿圓周均勻貼上若干反射紙,它能定向反射紅外線,使接受管接受到反射回來(lái)的紅外線。
光電轉(zhuǎn)換原理見圖1。在光電三極管3DU5C上加一適當(dāng)偏壓,當(dāng)3DU5C受紅外線照射時(shí),處于導(dǎo)通狀態(tài),A點(diǎn)為低壓電平,3DG6截止,B點(diǎn)為高電平;當(dāng)沒有紅外線照射時(shí),光電三極管截止,A點(diǎn)呈現(xiàn)高電平,使3DG6集電極B點(diǎn)為低電平,B點(diǎn)的脈沖信號(hào)經(jīng)過反相器1、2的整形,再經(jīng)門3反相,便得到頻率與轉(zhuǎn)速大小相應(yīng)成比例變化的轉(zhuǎn)速脈沖信號(hào)。轉(zhuǎn)速脈沖信號(hào)送入8032單片機(jī)的定時(shí)/計(jì)數(shù)器,經(jīng)過單片機(jī)的軟件處理計(jì)算出轉(zhuǎn)速。
圖1 光電轉(zhuǎn)換原理圖
本機(jī)在測(cè)量轉(zhuǎn)速時(shí)采用了M/T法和定時(shí)法兩種方法。M/T法是在檢測(cè)時(shí)間Tc內(nèi),根據(jù)轉(zhuǎn)速脈沖m1和計(jì)時(shí)脈沖m2來(lái)計(jì)算轉(zhuǎn)速。如在固定周期Tc內(nèi),計(jì)取轉(zhuǎn)動(dòng)脈沖fp和計(jì)時(shí)脈沖fc的脈沖個(gè)數(shù)分別為m1和m2,計(jì)時(shí)脈沖的頻率為f,轉(zhuǎn)動(dòng)體每轉(zhuǎn)輸出的脈沖數(shù)為p,則轉(zhuǎn)速n=60fm1/pm2(r/min)。定時(shí)法是在給定的時(shí)間間隔1 s內(nèi),對(duì)轉(zhuǎn)速脈沖進(jìn)行計(jì)數(shù)。如在1 s內(nèi)測(cè)得的轉(zhuǎn)速脈沖數(shù)為m1,轉(zhuǎn)動(dòng)體每轉(zhuǎn)輸出的脈沖個(gè)數(shù),即極數(shù)為p,則轉(zhuǎn)速n=60m1/p(r/min)。
2 轉(zhuǎn)速測(cè)量?jī)x的硬件結(jié)構(gòu)
圖2為由8032單片機(jī)構(gòu)成的轉(zhuǎn)速測(cè)量?jī)x電路圖。8032屬于MCS-51系列單片機(jī),與常用的8031芯片相比,8032多了一個(gè)功能較強(qiáng)的T2定時(shí)/計(jì)數(shù)器和128字節(jié)內(nèi)部RAM,其中T2計(jì)數(shù)器具有16位自動(dòng)重載和捕獲能力,既可作定時(shí)/計(jì)數(shù)用,又可作為波特率發(fā)生器用。本系統(tǒng)T2用于定時(shí),即計(jì)取定時(shí)脈沖信號(hào),定時(shí)脈沖信號(hào)直接從8032芯片的地址鎖存信號(hào)端ALE引出,并經(jīng)過74LS74雙D觸發(fā)器兩分頻后獲得。當(dāng)晶振采用6 MHz時(shí),定時(shí)脈沖的頻率fc為0.5 MHz。T0計(jì)數(shù)器計(jì)取轉(zhuǎn)速脈沖fp,T1計(jì)數(shù)器用于計(jì)取定時(shí)脈沖fc,觸發(fā)器DFF1,DFF2和與門1,2,3,4組成計(jì)數(shù)控制電路,能使T0和T1計(jì)數(shù)器同時(shí)啟停。系統(tǒng)采用動(dòng)態(tài)顯示方式。P0口通過帶允許控制端的8D鎖存器74LS377擴(kuò)展了一個(gè)8位輸出口,作為5位LED數(shù)碼管顯示的段選碼數(shù)據(jù)線。P1.3-P1.75根口線作為五位LED顯示的位選線。P3.0、P3.1接S1和S4開關(guān),S1為極數(shù)P設(shè)定選擇開關(guān),S4為極數(shù)輸入脈沖鍵。P3.2和P3.3分別接S2和S3開關(guān),S2開關(guān)為測(cè)速方法選擇鍵,選擇用M/T法測(cè)速,還是用定時(shí)法測(cè)速。S3為轉(zhuǎn)速/頻率選擇開關(guān),用來(lái)選擇測(cè)轉(zhuǎn)速還是測(cè)頻率。當(dāng)用定時(shí)法測(cè)轉(zhuǎn)速時(shí),系統(tǒng)可以很方便地測(cè)出所測(cè)頻率。
3 軟件設(shè)計(jì)及抗干擾措施
系統(tǒng)的程序設(shè)計(jì)主要包括主程序、中斷程序、代碼轉(zhuǎn)換子程序、顯示子程序等。兩種測(cè)速方法硬件結(jié)構(gòu)完全相同,只是軟件流程不同,通過P3.2口來(lái)設(shè)定測(cè)速方法。下面分別論述兩種測(cè)速方法的工作原理。
M/T法中,首先由8032的P1.1端輸出啟動(dòng)脈沖信號(hào),該啟動(dòng)脈沖清零DFF1和DFF2兩個(gè)觸發(fā)器,使Q1端輸出低電平,封鎖門2、3、4,Q-1端為高電平打開門1,而觸發(fā)器DFF2的Q-2端輸出為高電平,為啟動(dòng)工作做好準(zhǔn)備。當(dāng)接受到轉(zhuǎn)速脈沖信號(hào)fp的上升沿時(shí),觸發(fā)器DFF1翻轉(zhuǎn),Q-1為低電平,封鎖門1,Q1為高電平,打開門2、3、4,從而使T2開始定時(shí),m1,m2同時(shí)開始計(jì)數(shù)。當(dāng)T2定時(shí)到100 ms時(shí),向8032申請(qǐng)中斷。在中斷程序中,8032的P1.2端輸出停止脈沖信號(hào),置位觸發(fā)器DFF2,Q-2端輸出低電平,封鎖門2、3、4,T0、T1同時(shí)停止計(jì)數(shù)。同時(shí)在中斷程序中讀出轉(zhuǎn)速信號(hào)脈沖數(shù)m1和定時(shí)信號(hào)脈沖數(shù)m2,在主程序中根據(jù)m1、m2,P和f算出轉(zhuǎn)速n=60fm1/pm2,并轉(zhuǎn)換為BCD碼,查表送至數(shù)碼管顯示,完成一次數(shù)據(jù)的采集和顯示。
在定時(shí)法中,由于要產(chǎn)生1 s的定時(shí)信號(hào),而本系統(tǒng)中定時(shí)最大值為131 ms,故在定時(shí)法中,采取連續(xù)定時(shí)10次100 ms的方法,當(dāng)?shù)搅?00 ms定時(shí)時(shí),定時(shí)器T2溢出向8032申請(qǐng)中斷。在中斷程序中對(duì)中斷次數(shù)進(jìn)行累計(jì),如果累計(jì)中斷次數(shù)未到10次,則不作任何運(yùn)算就返回,T2繼續(xù)下一次的100ms的定時(shí),T0繼續(xù)計(jì)數(shù)轉(zhuǎn)速脈沖,當(dāng)中斷次數(shù)達(dá)到10次時(shí),在中斷程序中,置位P1.2,停止計(jì)數(shù),并且讀出T0的計(jì)數(shù)值m1,在主程序中進(jìn)行相應(yīng)運(yùn)算算出轉(zhuǎn)速,并轉(zhuǎn)換為BCD碼,送LED顯示。這里定時(shí)計(jì)數(shù)器采用了具有16位自動(dòng)重裝載功能的T2計(jì)數(shù)器,當(dāng)T2溢出產(chǎn)生中斷的同時(shí),計(jì)數(shù)器自動(dòng)重載計(jì)數(shù)初值,繼續(xù)定時(shí)。因此它的定時(shí)是連續(xù)的,不受響應(yīng)中斷和處理中斷程序的影響。而如果采用沒有重載功能的定時(shí)器如T0或T1,則當(dāng)定時(shí)器溢出時(shí),須在響應(yīng)中斷后,在中斷程序中重置定時(shí)器初值。定時(shí)器的定時(shí)是斷續(xù)的,影響定時(shí)精度,繼而影響測(cè)速精度??梢姴捎?032中的T2計(jì)數(shù)器定時(shí)是本系統(tǒng)一個(gè)特點(diǎn),它能顯著提高測(cè)速精度。本測(cè)速儀在0-49r/min范圍內(nèi),精度可達(dá)±0.1 r/min,在50-99 999r/min范圍內(nèi),精度可達(dá)±1 r/min。
本測(cè)速儀可以測(cè)量不同極數(shù)的脈沖發(fā)生器發(fā)生的脈沖,如前述的紅外線探測(cè)器,當(dāng)改變貼在轉(zhuǎn)動(dòng)體上反射紙的數(shù)量時(shí),轉(zhuǎn)動(dòng)體每轉(zhuǎn)發(fā)出的脈沖數(shù)p也相應(yīng)改變,此時(shí)如果仍按照程序中原定的p值進(jìn)行計(jì)算,就會(huì)運(yùn)算出錯(cuò)。因此本系統(tǒng)提供了現(xiàn)場(chǎng)設(shè)置極數(shù)的功能:P3.0口接極數(shù)設(shè)定選擇開關(guān),當(dāng)P3.0高電平時(shí),表明需要設(shè)置極數(shù),此時(shí)系統(tǒng)等待由P3.1口輸進(jìn)的脈沖信號(hào),每一個(gè)脈沖信號(hào)可使系統(tǒng)的極數(shù)寄存器數(shù)值加1,并顯示在LED數(shù)碼管上。
在定時(shí)法測(cè)速時(shí),當(dāng)不進(jìn)行n=60m1/p的運(yùn)算,直接將1 s內(nèi)的轉(zhuǎn)速脈沖數(shù)m1變換為BCD碼顯示,所得的數(shù)值顯然就是輸入脈沖信號(hào)的頻率。因此系統(tǒng)設(shè)置了轉(zhuǎn)速/頻率選擇功能。P3.3口接轉(zhuǎn)速/頻率選擇開關(guān)S3,當(dāng)P3.3為高電平時(shí),表示測(cè)頻率。
同時(shí),系統(tǒng)軟件還設(shè)置了一些邏輯錯(cuò)誤診斷功能,如當(dāng)轉(zhuǎn)速超過99 999 r/min,系統(tǒng)將顯示PPPPP,表示超出本測(cè)速儀所測(cè)范圍,又如當(dāng)在M/T法測(cè)速時(shí),選擇了測(cè)頻率,則顯示EEEEE,提示用戶出錯(cuò)等。
由于測(cè)速儀一般都在工業(yè)生產(chǎn)現(xiàn)場(chǎng)工作,工作環(huán)境干擾來(lái)源多,因此在設(shè)計(jì)中,采用了抗干擾措施,如電源濾波、去耦、注意地線的走向,接地點(diǎn)的安排等硬件抗干擾辦法,以CPU、RAM自檢、軟件冗余、軟件陷阱等軟件抗干擾技術(shù)。
圖2 數(shù)字式轉(zhuǎn)速測(cè)量?jī)x電路圖
出處:文件類型和編號(hào):美國(guó)專利5442592
出版日期:1995年8月15日
主審查員:羅保.伊恩j.
收藏