第一篇:畢業設計開題報告(出租車計價器).
畢業設計開題報告 題 目 新型出租車計價器控制電路設計 姓 名 牛敏 學 號 120433322 專 業 班 級 電氣 123 指 導 老 師 黃俊梅
電子工程系電氣自動化教研室 2014年 12月 2 日 一.選題背景和意義
隨著我國經濟的迅速發展, 人民生活水平的顯著提高, 我國出租汽車行業迅 猛發展,出租汽車已經成為我國城 市公共交通的重要組成部分和現代化城市必 備的基礎設施, 成為人們工作、生活中不可缺少的交通工具。出租汽車服務行業 和出租汽車計價器緊密相關, 因為出租汽車必須安裝出租汽車計價器才能投入營 運。出租汽車計價器是一種能根據乘客乘坐汽車行駛距離和等候時間的多少進行 計價, 并直接顯示車費值的計量器具。計價器是出租汽車的經營者和乘坐出租汽 車的消費者之間用于公平貿易結算的工具, 因而計價器計價準確與否, 直接關系 到經營者和消費者的經濟利益。依據國家有關法律、法規, 出租汽車計價器是列 入國家首批強制檢定的工作計量器具之一, 也是近年來國家質量技術監督部門強 化管理的六類重點計量器具之一。
二、國內外研究現狀、發展動態
出租車行業在我國是八十年代初興起的一項新興行業,隨著我國國民經濟 的高速發展, 出租汽車已成為城市公共交通的重要組成部分。多年來國內普遍使 用的計價器只具備單一的計量功能。目前全世界的計價器中有 90%為臺灣所生 產?,F今我國生產計價器的企業有上百家,主要是集中在北京,上海,沈陽和廣 州等地。當單片機出現并應用于計價器后, 現代出租車計價器的模型也就基本具 備了,它可以完成計程,計價,顯示等基本工作。單片機以及外圍芯片的不斷發 展促進了計價器的發展。出租車計價器在最初使用時具備的主要功能是根據行駛 里程計價,要求精度高,可靠性好。
三、研究的內容及可行性分析 1.研究的內容 : 計價器顯示的營運金額是營運里程與價格的函數(等候時間一般折算成一 定比例的里程來計算。出租車計價器通過傳感器與行駛車輛連接。出租汽車的 實際里程通過傳感器的脈沖信號在計價器里折算成一定的計價營運里程。針對這 一點我們來利用單片機作為控制核心,設計一款出租車計價器,具有計價顯示、等待時間計價,公里數顯示,時間顯示等相關功能。
2設計要求 :(1 4位數碼管用于實時顯示行車里程數(0.0,單位為公里;4位數碼管用 于實時顯示金額數(000.0,單位為元。
(2規定白天出租車單程價格為 1.5元 /公里 , 往返則價格為 1.0元每公里。夜間出租車單程價格為 1.8元 /公里 , 往返則價格為 1.2元每公里。設置單程往返 按鍵。
(3 起步公里數為 3公里, 價格為 10元, 若實際運行大于 3公里, 按 “基 本要求 2”計算價格。
2.設計任務 :
1.單片機控制電路原理與設計
2.鍵盤電路原理與設計---按鈕來實現乘車方式、狀態操作、查詢、清除、參數 調整等操作。
3.車速檢測與里程計算電路原理與設計---霍爾傳感器輸出的里程信號經過光耦 隔離后送到計量 CPU 的外部中斷 1, 計量 CPU 通過中斷計數并和 K 值進行相關運 算得出行駛里程和車速。
4.數碼管顯示電路原理與設計;5.蜂鳴提示原理與設計---利用普通蜂鳴器來進行語音提示;為了避免司機由于 工作緊張而無法確定是否按下各個按鈕,我們增加了蜂鳴提示功能。6.軟件編程, protues 仿真模擬 四總體設計方案
實驗箱有六個數碼管,故起步價、大的費用以及單價均由 P4、P5(即最左 邊兩個數碼管顯示,里程由 P2、P3(即中間兩個數碼管顯示,脈沖計數由 P0、P1(即最右邊兩個數碼管顯示。由于缺少霍爾傳感器,因此只能通過輸入 脈沖模擬。因此電路由時鐘脈沖電路(8MHZ 接 P1.0、復位電路、數碼管顯示電 路構成。
2-1 出租車計價器總體設計圖
2-2 單片機單元框圖 五計價器設計思想 5.1具體設計思想
利用 80C51單片機控制出租車計價系統工作。
單片機 P1.0口作為脈沖輸入。8255的 PB 口連接一個 74LS245芯片(雙向 總線驅動器 ,再與外部六個數碼管連接, PB 口連接一個 74LS245芯片與 6個數 碼管的公共 COM 端連接, 用于選擇數據輸出的地址, 這樣就可以實現起始價、單 價、里程、脈沖計數的動態顯示,并且節省了端口數。數碼管的段控制信號是由 8255的 PB 口經 74LS245緩沖器后輸出得到, 6位位控制信號由 8255的 PA 口經 74LS245緩沖器后輸出得到。鍵盤電路由 8255構成,其中 8255的 PC0-PC3作為 矩陣式鍵盤行掃描線, 8255的 PA 口為矩陣鍵盤列入線。
5.2計價器相應控制
通過軟件編程實現計價器起始價、單價、脈沖技術的顯示以及按下相應鍵實 現開始暫停、設置單價、復位功能,各個鍵按下的功能如表 2-2所示。
在白天,不用調節價格,當里程超過 3公里即按照每公里 1.5元計算, 3公 里以內則均按起始價 10元計費。操作如下:白天只要顧客上車,就按下 0鍵, 到達目的地按下 E 鍵,然后讀數碼管上的 L6、L5(最左邊兩位數碼管即為費 用,中間兩位即為里程。顧客付費完后按下 F 鍵復位,恢復起始價格,等待下一 個顧客的到來。
在晚上, 由于夜間行車風顯以及司機加班狀態, 3公里內還是按照起始價 10元計費;超過 3公里則按照每公里 1.2元計價。操作如下:按下 2鍵顯示單程 1.8元 /公里,按下 3鍵確定往返是 1.2元 /公里并恢復起始價 10元,待顧客上 車按 0鍵開始計價,到達目的地按下 E 鍵,然后讀數碼管上的 L6、L5(最左邊
兩位數碼管即為費用,中間兩位即為里程。顧客付費完后按下 F 鍵復位,恢復 起始價格,等待下一個顧客的到來。
5.3出租車計價顯示電路
出租車計價器顯示電路主要由代碼實現。顯示電路如下圖所示。
圖 3-7 出租車計價器顯示電路
六、工作進度
1.查閱資料,撰寫開題報告 第 1周~第 2周 2.英文資料翻譯 第 3周~第 4周
3.查閱相關資料,設計總體方案 第 5周~第 6周
4.熟悉單片機控制系統,設計系統硬件電路 第 7周~第 10周 5.熟悉 proteus 或 protel 電路設計軟件,畫出電路圖 第 11周~第 13周 6.編寫并調試程序,模擬實現部分控制功能 第 14周~第 15周 7.畢業設計審查、畢業答辯 第 16周~第 17周
七、參考文獻
[1].馮先成, 常翠芝.單片機應用系統設計 [M].北京:北京航空航天大學出版社, 2009.[2].元增民.模擬電子技術 [M].北京:中國電力出版社, 2009.[3].南建輝等.MCS-51單片機原理及應用實例 [M].北京:清華大學出版社, 2004.3.[4] 王幸之等.單片機應用系統抗干擾技術 [M].北京:北京航空航天大學出版 社,2000.[5] 童詩白,等.仿真電子技術基礎[M].北京:高等教育出版社,2001.[6] 張毅剛.單片機原理及應用.北京:高等教育出版社,2004.[7] 李秉操.單片機接口技術及在工業控制中的應用[M].陜西:陜西電子出版 社,1992.[8] 丁元杰.單片微機原理及應用(第二版.北京:機械工業出版社,2002 [9] 蔡惟錚.集成電子技術.哈爾濱:哈爾濱工業大學出版社,2003.[10]馮博情,吳寧.微型計算機原理與接口技術.北京:清華大學出版社,2010.題目 新型出租車計價器控制電路 進 度 安 排(1)2014 年 10 月——2014 年 11 月:進一步收集和閱讀與論文相關的 資料。(2)2014 年 10 月——2014 年 11 月:根據閱讀的資料,構思畢業設計 框架。(3)2014 年 11 月——20114 年 12 月:初步設計出 kappa 值軟測量數 學模型。(4)2014 年 11 月——20114 年 12 月:根據老師的安排安排思路。(5)2014 年 11 月——20114 年 12 月:實驗、分析實驗結果,改進數學 模型。(6)2014 年 11 月——20114 年 12 月:確定論文最終方案及完成論文 的撰寫。(7)2014 年 12 月:準備答辯。指導老師意見: 簽字: 年 月 日
第二篇:出租車計價器畢業設計外文資料
ABSTRACT In this paper, a multi-channel taximeter that is able to deal with more than one passenger simultaneously is proposed.In order to demonstrate the theory of operation of the proposed system, a complete design for an experimental three-channel taximeter(whose prototype has been built under grant from the Egyptian Academy for Scientific and Technological Research)is presented.System location, outline, block diagrams as well as detailed circuit diagrams for the experimental taximeter are also included.1.INTRODUCTION Transporting people in the morning from their homes to their works and back in the afternoon has become a big problem in big cities especially in undeveloped countries.As a partial solution of this problem, the authorities in some countries had, unofficially, left the taxicab drivers to carry different passengers to different places at the Same time.For example, a taxicab with four seats may carry four different passengers without any relation between them except that their way of travelling is the same.Accordingly, it has become very difficult to rely on the present conventional single-channel taximeter to determine the fare required from each passenger separately.Accordingly, an unfair financial relation was created between the taxicab driver, owner, passengers and the state taxation department.Under these circumstances, taxicab drivers force the passengers to pay more than what they should pay.In some cases passengers had to pay double fare they should pay.With the present conventional single-channel taximeter, taxicab owners are not able to determine the daily income of their taxicab.In some cases(a taxicab with four seats)they may only get one quarter of the income of the taxicab(collected by the taxicab driver).From which they should pay the salary of the taxicab driver as well as the cost of fuel, minor and major repairs in addition to the car depreciation.As a matter of fact the position of the taxicab owners is not so bad as it seems.A general agreement has been reached between the taxicab drivers and owners such that the drivers should guarantee a fixed daily income to the owners as well as the paying for the cost of fuel as well as the minor repaires.Even though the taxicab drivers still share the large portion ofthe income of the taxicab.Also with the presence of the single-channel taximeter, it has become very difficult for the state taxation department to know the yearly income of the taxicab and accordingly it has become very difficult to estimate the taxes to be paid by the taxicab owners.In order to face this problem, the state taxation department had to impose a fixed estimated taxes for each seat of the taxicab whatever the income of the taxicab.In this paper, we introduced a multichannel taximeter that can deal with more than one passenger simultaneously.I t should be pointed out that by the term passenger we mean a one person or a group of related persons.I t should also be pointed out that our proposed multi-channel taximeter is not, simply, a multi display readouts.As a matter of fact it contains logic circuits that automatically changes the fare per killometer of travelling distance or per minutes of 'waiting time according to the number of passengers hiring the taxicab.In the following part and as an example, we will present a complete design for a three-channel taximeter.Block diagrams as well as detailed circuit diagrams of the experimental three-channel taximeter are also included.A prototype has been built under grant from the Egyptian Academy for Scientific and Technological Research.2.AN EXPERIMENTAL THREECHANNEL TAXIMETER Theory of operation of our experimental device to work as an electronic digital taximeter is based on t h e fact thathe speedometer cable rotates one revolution for each meter of travelling distance.Accordingly, if the speedometer cable is coupled with a speed sensor that generates a single pulse for each meter of travelling distance, then our taximeter could be three up counter modules associated with a speed sensor unit.However, our experimental taximeter is not simply a three display readouts.As a matter offact it contains logic circuits that automatically changes the fare per kilometer of travelling distance or per minutes of waiting time according to the number of passengers hiring the taxicab.The device may be splitted into two main parts: The first is the speed sensor unit which may be located anywhere in the taxicab such that an easy coupling to the speedometer cable can be achieved.The second unit contains the main electronic circuit, the displayand control panel.The unit should be located somewhere in front of both the driver and the passengers.A possible components locations is shown in Figure 1.A.Speed Sensor Unit The main function of this unit is to supply train of pulses whose frequency is proportional to the angular rotation of the wheels.A possible form of a speed sensor is shown in Figure 2.If may consist of a tj.pica1 permanent magnet sine wave generator with its output connected to a pulse shapping circuit(two general purpose silicon diodes, 1K ohms resistor and a schmit trigger inverter).In order to find some way to detect the movement of the taxicab, the output of the sine wave generator is rectified through a general purpose silicon diode Dl then smoothed by a 1000 F capacitor.The output voltage at terminal Q is then limited to the value of 4.7 volts by using a Ik ohms resistor as well as a zener diode ZD.The level of the voltage at terminal Q would be high whenever the taxicab is moving and will be zero otherwise.This voltage can be used for the automatic switching from distance fare to time fare.B.Main Electronic and Display Unit A suggested shape for the main electronic and display unit is shown in Figure 3.The control and display panel contains all ' controls necessary for operating the taximeter as well as four readout displays.The first channel will give the sum of money required from the first passenger, while the second and third readouts are for the second and third passengers, respectively.The fourth readout will give the total income of the taxicab.The contents of the last readout should be nonvolatile and be able to be retained even during parking the taxicab.The channel rotary selector switchs 1 , 2 and 3 have fully clockwise/anticlockwise positions.In the fully anticlockwise position, the counter of the corresponding readout is blancked and disabled.In the fully clockwise position, the counter is unblanked, cleared to zero and enabled to be ready for counting the sum of money required from the first, second and third passengers, respectively.Pushing the total sum pushbutton 4 unblanks the fourth readout enabling any person to retain the readout corresponding to the total income.After the release of the pushbutton, the fourth readout will be blanked again.This unit also contains the main electronic circuit which will be fully described in the following section.3.DESCRIBTION OF THE MAIN ELECTRONIC CIRCUIT The general block diagram of the main electronic circuit is shown in Figure 4.It consists of five subcircuits designated by the symboles CTI up to CT4supporting circuits, these are: The number of passenger deticition circuit CTI, travelling distance scaling circuit CT2, waiting time scaling circuit CT3, circuit CT4 which generates clock pulses for the display circuit.A.Number of Passengers Detection Circuit CT1 As shown from the general block diagram, the circuit CTI has three inputs I, 2 and 3 as well as three outputs J, K and L.The function of the circuit is to supply a high level voltage at terminals J, K or L if and only if one, two or three passengers are hiring the taxicab, respectively.The term passenger, here, means one person or a group of related persons.When a passenger is getting into the cab, we simply turn on a free readout display by turning the corresponding rotary selector switch to a fully clockwise direction.This will automatically disconnect the corresponding terminal I, 2 or 3 from ground.The logical relation between various input terminals I, 2 and 3 and the output terminals J, K and L is shown in Table 1.As a combinational circuit we start the design by deriving a set of boolean functions.A possible simplified boolean functions that gives minimum number of inputs to gates may be obtained from Table I.A possible logical diagram that is based on the above derived expressions is shown in Figure 5.It consists of two inverters, four 2-input AND, to3-input AND two 3-input OR gates B.Tavelling Distance Scaling Circuit CT2 As shown from the block diagram of Figure 4, the circuit CT2 has four input J, K, L and E and one output M.The function of the circuit is to supply a single pulse at the output M for a certain number of pulses generated at the output of the speed sensor(certain number of meters travelled by the taxicab), according to the number of passengers hiring the car.A suggested fare per kilometer of travelling distance is shown in colomn two of Table 2.the circuit, in this case, should supply a single pulse at the output M for every 100, 125 or 143 pulses generated at the input terminal E according to the level of voltage at input terminale 3, K or L, respectively.Our circuit could be, as shown in Figure 5, three decade counters, connected as a three digit frequency divider whose dividing ratios 100, 125 and 143 are automatically selected by the voltage level at terminals J, K and L, respectively.A possible circuit diagram that may verify the above function is shown in Figure 6.It consists of three decade counters type 7490, one BCD-to decimal decoder type 7445, three 4-input AND, one 3-input ANDone 2-input AND two 3-input OR gates.C.Time Scaling Circuit CT3 As shown in the block diagram, the time scalingcircuit will have four inputs J, K, L and F and one output N.The function of this circuit and accordingto colomn three of Table 2(fare per 2 minuts of waiting time)is to supply a single pulse at the output N for every 120, 240 or 360 pulses supplied at the input terminal F from the I Hz clock according to level of voltage at inputs J, K and L, respectively.Time scaling circuit would be similar to the distance scaling circuit but with different diving ratios.A Possible circuit diagram is shown in figure 7.It consists, in this case, of three decade counter type 7490, two 3-input AND, one 5-input AND, one 2-input AND one 3-input OR gates.D.Circuit CT4 Which Generates Clock Pulses for Display Circuit The function of this circuit is to supply one, two or three pulses at the output terminal R for each pulse generated at any of the terminals N or M, according to the voltage level at the input terminals J, K or L, respectively.The output P will receive a pulse for each pulse generated at any of the input terminals N or M.This function can be performed by the circuit shown in Figure 8, it consists of one ripple counter type 7493, one half of a dual JK masterslave flip-flops circuit type 7476, three inverters, three 2-input AND, one 3-input AND, one 2-input OR and one 3-input OR gates.When a pulse is generated at either input terminals N or M, a high level voltage will be generated at the output Q of the flip-flop.This will g a t e t h e I Khz signal to be connected to the input A of the ripple counter as well as to the output terminal R.When one, two or three pulses are counted by the ripple counter, according to the level of voltage at the input terminals J, K and L, respectively, a high is generated to reset the counter and change the state of the flip-flopsuch that Q becomes low.Hence, the 1 KHz signal is disabled to reach the outputerminal R or the input A of the ripple counter.In order to ensure the proper function of the circuit, the flip-flop should be cleared whenever a new channel is operated.This has been achieved by the input 5 and will be explained later when describing the function of the channels rotary selector switchs.E.Display Circuit As shown in Figure 2, the display panel would contain three 4-digit displays that give the sum of money required from each passenger separately as well as a one six-digit display that gives the total income of the taxicab.A possible wiring diagram for the display circuit is shown in Figure 9.Rotating any of the rotary selector switches to fully clockwise direction will supply the corresponding display by5 volts through terminals 1, 2 and 3, respectively.The corresponding display will be unblanked by supplying a low level of voltage through terminals A, C and G, respectively.Keeping terminals 8, D and H, respectively, at low level will keep them reset to zero.The corresponding display is then enabled by removing the low voltage from terminals B, D, and H, respectively, to be ready for counting the sum of money required from the corresponding passenger starting from zero.The counting pulses for these three displays are supplied through terminal P.The total sum display will be enabled whenever any of the three displays is enabled(this is done by a 3-input OR gate as shown in Figure 8).Retaining the contents of the last display will be done by unblanking it by supplying a low level of voltage to terminal I as shown in Figure 10 b.F.Changing Over Between Time and Distance Fares In the following part, two different methods for changing over between time andistance fares are suggested: The first is to switch to time fare whenever the distance fare is less than the time fare.Hence, a simple look to fares table(Table 2)can show that time fare should be used whenever the taxicab moves with speed less than 50 m/min.A possible circuit that can perform this switching action is shown in Figure IO c.It contains one rpm limit switch and a one inverter as well as two 2-input AND gates.The contacts of the limit switch are normally closed and will be opened whenever the angular speed of the speedometer cablexceeds 50 rmp.The second alternation is to connect the input of the inverter in Figure 10 c.to the output terminal Q of the speedometer circuit, Figure 2.In this case, the switching into time fare will be done whenever the taxicab is at stand still.G.Function of the Rotary Selector Switches The voltage levels that should be supplied by the terminals of the rotary selector switches in order to ensure proper operation by the electronic circuit are given in Table 3.Connection of three rotary selector switches each witb four decks of five poles each, that satisfy the logic function of Table 3, is shown in Figure 10 a.Rotating any of the three switches into fully clockwise direction will pass through five positions.The function of the rotary selector switches can be described starting from the first position passing through variousteps until reaching the final position as follows: Initial position: In this position a low voltage level is applied to terminals I, 2 and 3, this will disconnect the 5 volts supply from the three first displays, set the three inputs of the number of passenger detection circuit CTI to low level.A low voltage level is applied to terminals 8, D and H, this is to ensure that the total income display is disabled.Voltage levels at terminals A, C, G and S are at no care condition.Step I: Rotating any of the rotary selector switches one step toward clockwise direction will supply 5 volts to the corresponding display, provides a high level voltage at terminals 1, 2 or 3 indicating that one passenger have entered the taxicab.A high level voltage should be applied to terminals A, C or G in order to ensure that the corresponding display is still blanked.Other terminals B, D, H and S are kept unchanged.Step 2: Rotating the rotary selector switch one step further, will change the state of voltages at terminal A, C or G to be at low level and unblanks the corresponding display.States of voltages at terminals I, 2, 3 and S are remained unchanged.Terminals B, D and H should be remained at low level to ensure that the corresponding readout is cleared to zero while unblanking the display.
第三篇:出租車計價器畢業設計中英文翻譯
ABSTRACT 1.INTRODUCTION Transporting people in the morning from their homes to their works and back in the afternoon has become a big problem in big cities especially in undeveloped countries.As a partial solution of this problem, the authorities in some countries had, unofficially, left the taxicab drivers to carry different passengers to different places at the Same time.For example, a taxicab with four seats may carry four different passengers without any relation between them except that their way of travelling is the same.Accordingly, it has become very difficult to rely on the present conventional single-channel taximeter to determine the fare required from each passenger separately.Accordingly, an unfair financial relation was created between the taxicab driver, owner, passengers and the state taxation department.Under these circumstances, taxicab drivers force the passengers to pay more than what they should pay.In some cases passengers had to pay double fare they should pay.With the present conventional single-channel taximeter, taxicab owners are not able to determine the daily income of their taxicab.In some cases(a taxicab with four seats)they may only get one quarter of the income of the taxicab(collected by the taxicab driver).From which they should pay the salary of the taxicab driver as well as the cost of fuel, minor and major repairs in addition to the car depreciation.As a matter of fact the position of the taxicab owners is not so bad as it seems.A general agreement has been reached between the taxicab drivers and owners such that the drivers should guarantee a fixed daily income to the owners as well as the paying for the cost of fuel as well as the minor repaires.Even though the taxicab drivers still share the large portion ofthe income of the taxicab.Also with the presence of the single-channel taximeter, it has become very difficult for the state taxation department to know the yearly income of the taxicab and accordingly it has become very difficult to estimate the taxes to be paid by the taxicab owners.In order to face this problem, the state taxation department had to impose a fixed estimated taxes for each seat of the taxicab whatever the income of the taxicab.In this paper, we introduced a multichannel taximeter that can deal with more than one passenger simultaneously.I t should be pointed out that by the term passenger we mean a one person or a group of related persons.I t should also be pointed out that our proposed multi-channel taximeter is not, simply, a multi display readouts.As a matter of fact it contains logic circuits that automatically changes the fare per killometer of travelling distance or per minutes of 'waiting time according to the number of passengers hiring the taxicab.In the following part and as an example, we will present a complete design for a three-channel taximeter.Block diagrams as well as detailed circuit diagrams of the experimental three-channel taximeter are also included.A prototype has been built under grant from the Egyptian Academy for Scientific and Technological Research.2.AN EXPERIMENTAL THREECHANNEL TAXIMETER Theory of operation of our experimental device to work as an electronic digital taximeter is based on t h e fact thathe speedometer cable rotates one revolution for each meter of travelling distance.Accordingly, if the speedometer cable is coupled with a speed sensor that generates a single pulse for each meter of travelling distance, then our taximeter could be three up counter modules associated with a speed sensor unit.However, our experimental taximeter is not simply a three display readouts.As a matter offact it contains logic circuits that automatically changes the fare per kilometer of travelling distance or per minutes of waiting time according to the number of passengers hiring the taxicab.The device may be splitted into two main parts: The first is the speed sensor unit which may be located anywhere in the taxicab such that an easy coupling to the speedometer cable can be achieved.The second unit contains the main electronic circuit, the displayand control panel.The unit should be located somewhere in front of both the driver and the passengers.A possible components locations is shown in Figure 1.A.Speed Sensor Unit The main function of this unit is to supply train of pulses whose frequency is proportional to the angular rotation of the wheels.A possible form of a speed sensor is shown in Figure 2.If may consist of a tj.pica1 permanent magnet sine wave generator with its output connected to a pulse shapping circuit(two general purpose silicon diodes, 1K ohms resistor and a schmit trigger inverter).In order to find some way to detect the movement of the taxicab, the output of the sine wave generator is rectified through a general purpose silicon diode Dl then smoothed by a 1000 F capacitor.The output voltage at terminal Q is then limited to the value of 4.7 volts by using a Ik ohms resistor as well as a zener diode ZD.The level of the voltage at terminal Q would be high whenever the taxicab is moving and will be zero otherwise.This voltage can be used for the automatic switching from distance fare to time fare.B.Main Electronic and Display Unit A suggested shape for the main electronic and display unit is shown in Figure 3.The control and display panel contains all ' controls necessary for operating the taximeter as well as four readout displays.The first channel will give the sum of money required from the first passenger, while the second and third readouts are for the second and third passengers, respectively.The fourth readout will give the total income of the taxicab.The contents of the last readout should be nonvolatile and be able to be retained even during parking the taxicab.The channel rotary selector switchs 1 , 2 and 3 have fully clockwise/anticlockwise positions.In the fully anticlockwise position, the counter of the corresponding readout is blancked and disabled.In the fully clockwise position, the counter is unblanked, cleared to zero and enabled to be ready for counting the sum of money required from the first, second and third passengers, respectively.Pushing the total sum pushbutton 4 unblanks the fourth readout enabling any person to retain the readout corresponding to the total income.After the release of the pushbutton, the fourth readout will be blanked again.This unit also contains the main electronic circuit which will be fully described in the following section.3.DESCRIBTION OF THE MAIN ELECTRONIC CIRCUIT The general block diagram of the main electronic circuit is shown in Figure 4.It consists of five subcircuits designated by the symboles CTI up to CT4supporting circuits, these are: The number of passenger deticition circuit CTI, travelling distance scaling circuit CT2, waiting time scaling circuit CT3, circuit CT4 which generates clock pulses for the display circuit.A.Number of Passengers Detection Circuit CT1 As shown from the general block diagram, the circuit CTI has three inputs I, 2 and 3 as well as three outputs J, K and L.The function of the circuit is to supply a high level voltage at terminals J, K or L if and only if one, two or three passengers are hiring the taxicab, respectively.The term passenger, here, means one person or a group of related persons.When a passenger is getting into the cab, we simply turn on a free readout display by turning the corresponding rotary selector switch to a fully clockwise direction.This will automatically disconnect the corresponding terminal I, 2 or 3 from ground.The logical relation between various input terminals I, 2 and 3 and the output terminals J, K and L is shown in Table 1.As a combinational circuit we start the design by deriving a set of boolean functions.A possible simplified boolean functions that gives minimum number of inputs to gates may be obtained from Table I.A possible logical diagram that is based on the above derived expressions is shown in Figure 5.It consists of two inverters, four 2-input AND, to3-input AND two 3-input OR gates B.Tavelling Distance Scaling Circuit CT2 As shown from the block diagram of Figure 4, the circuit CT2 has four input J, K, L and E and one output M.The function of the circuit is to supply a single pulse at the output M for a certain number of pulses generated at the output of the speed sensor(certain number of meters travelled by the taxicab), according to the number of passengers hiring the car.A suggested fare per kilometer of travelling distance is shown in colomn two of Table 2.the circuit, in this case, should supply a single pulse at the output M for every 100, 125 or 143 pulses generated at the input terminal E according to the level of voltage at input terminale 3, K or L, respectively.Our circuit could be, as shown in Figure 5, three decade counters, connected as a three digit frequency divider whose dividing ratios 100, 125 and 143 are automatically selected by the voltage level at terminals J, K and L, respectively.A possible circuit diagram that may verify the above function is shown in Figure 6.It consists of three decade counters type 7490, one BCD-to decimal decoder type 7445, three 4-input AND, one 3-input ANDone 2-input AND two 3-input OR gates.C.Time Scaling Circuit CT3 As shown in the block diagram, the time scalingcircuit will have four inputs J, K, L and F and one output N.The function of this circuit and accordingto colomn three of Table 2(fare per 2 minuts of waiting time)is to supply a single pulse at the output N for every 120, 240 or 360 pulses supplied at the input terminal F from the I Hz clock according to level of voltage at inputs J, K and L, respectively.Time scaling circuit would be similar to the distance scaling circuit but with different diving ratios.A Possible circuit diagram is shown in figure 7.It consists, in this case, of three decade counter type 7490, two 3-input AND, one 5-input AND, one 2-input AND one 3-input OR gates.D.Circuit CT4 Which Generates Clock Pulses for Display Circuit The function of this circuit is to supply one, two or three pulses at the output terminal R for each pulse generated at any of the terminals N or M, according to the voltage level at the input terminals J, K or L, respectively.The output P will receive a pulse for each pulse generated at any of the input terminals N or M.This function can be performed by the circuit shown in Figure 8, it consists of one ripple counter type 7493, one half of a dual JK masterslave flip-flops circuit type 7476, three inverters, three 2-input AND, one 3-input AND, one 2-input OR and one 3-input OR gates.When a pulse is generated at either input terminals N or M, a high level voltage will be generated at the output Q of the flip-flop.This will g a t e t h e I Khz signal to be connected to the input A of the ripple counter as well as to the output terminal R.When one, two or three pulses are counted by the ripple counter, according to the level of voltage at the input terminals J, K and L, respectively, a high is generated to reset the counter and change the state of the flip-flopsuch that Q becomes low.Hence, the 1 KHz signal is disabled to reach the outputerminal R or the input A of the ripple counter.In order to ensure the proper function of the circuit, the flip-flop should be cleared whenever a new channel is operated.This has been achieved by the input 5 and will be explained later when describing the function of the channels rotary selector switchs.E.Display Circuit As shown in Figure 2, the display panel would contain three 4-digit displays that give the sum of money required from each passenger separately as well as a one six-digit display that gives the total income of the taxicab.A possible wiring diagram for the display circuit is shown in Figure 9.Rotating any of the rotary selector switches to fully clockwise direction will supply the corresponding display by5 volts through terminals 1, 2 and 3, respectively.The corresponding display will be unblanked by supplying a low level of voltage through terminals A, C and G, respectively.Keeping terminals 8, D and H, respectively, at low level will keep them reset to zero.The corresponding display is then enabled by removing the low voltage from terminals B, D, and H, respectively, to be ready for counting the sum of money required from the corresponding passenger starting from zero.The counting pulses for these three displays are supplied through terminal P.The total sum display will be enabled whenever any of the three displays is enabled(this is done by a 3-input OR gate as shown in Figure 8).Retaining the contents of the last display will be done by unblanking it by supplying a low level of voltage to terminal I as shown in Figure 10 b.F.Changing Over Between Time and Distance Fares In the following part, two different methods for changing over between time andistance fares are suggested: The first is to switch to time fare whenever the distance fare is less than the time fare.Hence, a simple look to fares table can show that time fare should be used whenever the taxicab moves with speed less than 50 m/min.A possible circuit that can perform this switching action is shown in Figure IO c.It contains one rpm limit switch and a one inverter as well as two 2-input AND gates.The contacts of the limit switch are normally closed and will be opened whenever the angular speed of the speedometer cablexceeds 50 rmp.The second alternation is to connect the input of the inverter in Figure 10 c.to the output terminal Q of the speedometer circuit, Figure 2.In this case, the switching into time fare will be done whenever the taxicab is at stand still.G.Function of the Rotary Selector Switches The voltage levels that should be supplied by the terminals of the rotary selector switches in order to ensure proper operation by the electronic circuit are given in Table 3.Connection of three rotary selector switches each witb four decks of five poles each, that satisfy the logic function of Table 3, is shown in Figure 10 a.Rotating any of the three switches into fully clockwise direction will pass through five positions.The function of the rotary selector switches can be described starting from the first position passing through variousteps until reaching the final position as follows: Initial position: In this position a low voltage level is applied to terminals I, 2 and 3, this will disconnect the 5 volts supply from the three first displays, set the three inputs of the number of passenger detection circuit CTI to low level.A low voltage level is applied to terminals 8, D and H, this is to ensure that the total income display is disabled.Voltage levels at terminals A, C, G and S are at no care condition.Step I: Rotating any of the rotary selector switches one step toward clockwise direction will supply 5 volts to the corresponding display, provides a high level voltage at terminals 1, 2 or 3 indicating that one passenger have entered the taxicab.A high level voltage should be applied to terminals A, C or G in order to ensure that the corresponding display is still blanked.Other terminals B, D, H and S are kept unchanged.Step 2: Rotating the rotary selector switch one step further, will change the state of voltages at terminal A, C or G to be at low level and unblanks the corresponding display.States of voltages at terminals I, 2, 3 and S are remained unchanged.Terminals B, D and H should be remained at low level to ensure that the corresponding readout is cleared to zero while unblanking the display.二、中文翻譯.導言
在不發達的國家,早上把人們從他們家送到工作的地方,然后下午送回來已成為一個大問題,尤其是在大城市。
作為解決這個問題的一個部分,在某些國家出租車用來解決這個問題,送人們從一個地方到另外一個地方。例如,出租車的四個席位可攜帶四個不同的沒有任何關系的乘客,除了他們的路線是相同的。
因此,依靠目前的傳統的單車道計價以確定所需的票價,把每個乘客的計費分開,這已成為一個非常困難的問題。因此,在出租車司機,車主,乘客和國家稅務部門之間存在著不公平的財政關系。
在這種情況下,出租車司機強迫乘客支付多于他們所應付的。在某些情況下乘客支付了他們應付車費的雙倍。
本常規單頻道計程車,出租車司機不能夠確定出租車日常收入。在某些情況下(出租車的4個席位),他們可能只有出租車四分之一的收入(大部分的出租車司機)。從這些支付工資的出租車司機以及作為燃料費用外,還要維修以及汽車折舊等費用。事實上,出租車業主并非似乎如此糟糕。一項在出租車司機和車主之間的協議已經達成,司機應保證每天固定收入,以及向業主支付燃料以及維修的費用。即使如此,還是有的出租車司機的很大一部分份額之收入的出租車?,F在還存在的單聲道計價,已經變得非常,國家稅務部門也知道這種困難 每年估計出租車業主的收入支出,以及應支付的稅務也很困難。
為了應對這一問題,國家稅務部已實行固定估計稅,每個座位的出租車不論收入。在本文中,我們介紹了多通道的士計程表,可處理超過一名乘客同時進行的情況。我應該指出,我所說的長期旅客指一個人或一組相關的人。我同時也應指出,我們提出的多渠道的計價,不是簡單地說,一個多顯示讀數。作為一個先進的事項,事實上它包含邏輯電路,可以自動計算變化的車費以及每公里行走距離或每分鐘的候車時間按照乘客人數雇用出租車。在下面的部分,我舉出一個例子,我們將介紹一個完整的三通道計價??驁D以及詳細的電路圖,實驗三通道計價功能也包括在內。原型下已建成 埃及贈款科學學院 和技術研究。2.實驗
出租車計價器理論的運作我們的實驗裝置從事電子數字計價依據。事實上速度電纜旋轉1 圈的每米距離行駛。因此,如果車速電纜耦合與速度傳感器,產生一個單脈沖每平方米的旅行距離,那么,我們的的士可以三倍于反模塊相與速度傳感器的單位。然而,我們的實驗是計價而不僅僅是只顯示三個讀數。事實上,它包含邏輯電路,可以根據每公里的行駛距離或每分鐘等候時間按照乘客人數雇用出租車來自動改變車費。該裝置可能會分成兩個主要部分組成:第一是速度傳感器,這個傳感器可位于任何地方,在出租車內進行這樣一個簡單的耦合車速電纜是可以實現的。
單位包含了主要的電子電路,顯示器以及控制面板。該單位應位于前排的司機和乘客之間。
A. 速度傳感器
其主要職能是本單位提供脈沖的培訓,這個脈沖的頻率會于旋轉角度相適合。一種可能的形式一個速度傳感器。如果可以包含正弦波發生器的輸出連接到脈沖整形電路的永磁器件(2通用芯片二極管,1000歐姆的電阻和施密特觸發逆變器)。
為了找到某種方式來檢測出租車的運動,正弦波發生器的輸出是糾正通過一個通用的硅二極管延胡索乙然后平滑的1000年F電容。那個輸出電壓在終端Q是當時限于價值4.7伏特用益歐姆的電阻以及一個齊納二極管ZD。出租車的終端電壓在終端Q將高電壓降為零。這電壓可作為改變出租車從距離計費到時間計費方式的開關電壓。
主要的電子和顯示單元
一個建議是主要形式的電子和顯示單元??刂坪惋@示器面板包含所有'控制所必需的經營的士以及四個可讀顯示器。第一頻道將給出從第一乘客,第二乘客,第三乘客分別應付的費用,第四個會給出總收入給予出租車。最后讀出的數據會包括停車的費用等等費用。頻道選擇器開關1,第2和第3個,按順時針/逆時針的立場。在充分逆時針的立場,反相應的讀出是未標明和殘疾人。以順時針方向則是未定義的,清除為零,對于第一第二第三的乘客分別計費。第四號推進總鈕第四次讀出,使任何人保留讀出相應的總收入。經過釋放按鈕,第四次讀出將再次保留。這個單位還包含主要電子電路將在下一節充分描述。
描述的主要電子電路
電路一般框圖主要電子電路。它由五個部分指定的電腦符號與電話系統整合成為4個支撐電路,它們是:判斷乘客數量電路CT1,旅行距離電路CT2,等待時間電路CT3,時鐘脈沖顯示電路CT4。
乘客人數檢測電路CT1,該電路電腦與電話系統整合有三個輸出:1,2和3相對應于三個輸出J,K和L。
這個循環電路函數包含高電壓的終端 J,K或L,如果有1個或者2,3個乘客分別租用出租車。這個組里的任意乘客都是一組相關的人。當一個乘客進入出租車后,我們只是表示這樣一種情況,自由讀出顯示在談到相應的旋轉選擇開關,以一個完全順時針方向。這將自動斷開相應的終端1,2或3個從地面。邏輯關系各種輸入端子之間第1,第2和第3個輸出端J,K和L是列于表1。作為一個組合電路,我們開始設計產生了一系列布爾函數。
一種可能的邏輯圖的基礎上,上述源性表達。它包括兩個變頻器,4個2輸入和3輸入以及2個3輸入或門。B.行駛距離標量環路CT2 如圖所示的方框圖圖4,電路CT2有4個輸入J,K,L及E和1個輸出M,輸出功能的電路是供應單脈沖的輸出M的某一些脈沖產生的輸出的速度傳感器(出租車行駛了一定得距離),根據乘客的人數租用的汽車。我們建議票價按每公里行駛距離顯示在兩個表格2里面。
這個環路,在這種情況下,應提供單脈沖的輸出M的每100,125或143脈沖所產生的輸入端根據級別的電壓輸入終端3,K或L。
我們的電路顯示,三個十年的計數器,作為一個三位數分頻器的分比率100,125和143個自動選定的電壓一級終端J,K和L分別。一種可能的線路圖可被驗證,上述功能如圖6。它包括三個十年的計數器7490,一個聲BCD-以杜威解碼器輸入7445,3個4輸入和1個3輸入以及1個2輸入和2個3輸入或門。
時間縮放電路CT3.時間縮放電路含有4個輸入端 J,K,L及F和一個輸出端N,這個電路的函數根據表格2的意思(車費每2分鐘的等待時間)是在J,K和L分別供應單脈沖到輸出端N時,提供單脈沖的輸出N。時間縮放電路將類似于距離標量環路,但是有不同的行駛比率。它包括3個十進制計數器7490,2個3輸入與門和一個5輸入與門,1個2輸入與門和一個3輸入或門。
電路產生時鐘脈沖的顯示電路CT4 這條電路的作用根據電壓電平在輸入終端J、K或者L,分別供應1,2或者脈沖在每脈沖的輸出終端R引起在任何終端N或M。無論輸入端N或者M中的誰發送脈沖,都只有一個脈沖能被輸出端P接收。它由一個反向計數器7493構成,其中一半是雙JK主從觸發器電路,型號為7476,包括三個變頻器,三個2輸入與門,一個3輸入與門,1 2輸入或門以及一個3輸入或門。當脈沖引起在輸入的終端N或M,觸發器的輸入Q上將產生高級電壓。這個門信號將被連接到計數器的輸入A并且連接到輸出終端R。當第一,第二或第三個脈沖由漣波計數器開始計數,J,K,L端會分別根據電壓的大小來使產生重置或者翻轉來改變狀態,然后Q端變為輸出低電壓。因此,1 KHz信號沒有能力到達輸出端R或是計數器的輸入端A。為了確保電路的函數準確無誤,當切換到新頻道時,觸發器要清零。對于功能選擇開關旋轉渠道的描述,稍后會以一個成功的5輸入門函數來解釋。
顯示電路
該顯示面板將包含三個4位數顯示器,這樣可以給出每個乘客應付車費的總和,一個六位數顯示器可以給出出租車的總收入。一種可能的接線圖的顯示電路。以順時針方向旋轉所選擇的開關將提供相應的顯示,這可以通過5伏電壓來分別控制1,第2和3終端。對應的顯示通過供應低級電壓通過終端A、C和G,分別。保持終端D和H在低級狀態下重置為零對應的顯示分別通過終端B,D,H而改變低壓狀態,并準備好從對應的乘客那里計算出相應的計數款額,計數脈沖這三個顯示器通過終端提供總額。計數器還將通過終端P為3個顯示器提供脈沖只要這三個顯示器中任意一個是正常的,那么總額將被顯示出來。
時間和距離變化時車費的改變
在下面的部分,兩種不同的方法使得時間和距離改變從而導致車費發生變化,有如下建議:首先是當以路程計價的費用低于以時間計費的費用時,采用時間計費。從此,一個簡單的票價表顯示當出租車移動速度小于50米/分時應該采用時間計費方式。一種可能的電路可以執行此開關行動,它包含一個轉速限位開關和一個反轉器以及兩個2輸入與門。接觸的限位開關通常是封閉,只有當角速度超過50RMP的時候才會打開。第二個改變將中斷連接到圖10C的輸入端,輸出端Q連接速度的電路。在這種情況下,只要出租車的狀態保持靜止,那么計費開關就會處于關閉狀態。
功能選擇旋轉開關
功能選擇開關旋轉的電壓應提供的該終端的旋轉選擇開關,以確保正常運行的電子電路列于表3。每5個桿就有4個板連接著3個旋轉選擇開關,每個符合邏輯功能表3,旋轉任何三個切換到完全順時針方向將通過5個職位。功能的旋轉選擇開關可以說是從第一的位置通過直到達到最后的立場如下:
初始位置:在這個位置上的低電壓電平適用于第一第二和第三終端,浙江斷開來自三個中一個顯示器的5伏特電壓供應,設置三個顯示器,乘客檢測電路并與電路系統整合到較低的水平。終端D,H采用低電壓,這是為了確保顯示的總收入選項已被禁用。
步驟1:以順時針方向旋轉任何旋轉選擇開關一格將提供5伏特電壓到相應的顯示,提供一個高等級的電壓終端1,2或3,這表明一名乘客已經進入了出租車。終端C,G應為高電平,以確保相應的顯示仍然是籠罩。其他端口,如D,H端口保持不變。
步驟2:旋轉旋轉選擇開關1,然后將在終端A,C或G上改變電壓使其處于低電壓狀態,并會產生相應的顯示。終端1,2,3以及S上的電壓狀態保持不變。終端B,D和H應保持在較低水平,以確保當顯示為無數據時相應的讀出清除為零。
第四篇:出租車計價器調試報告
出租車計價器調試報告
本設計可分為單片機主控模塊、鍵盤、顯示器、溫度檢測、狀態指示、時鐘日歷、語音收錄播報、分頻器電路、脈沖信號發生器等9部分。仔細分析系統的工作原理,分別按照模塊在系統中的作用,對各個模塊分別單獨調試,最后形成該系統的用戶程序,實現功能要求。
一、接通電源
調試要求:1.首先仔細檢查該系統板的電源和地是否有短路問題,在未接入電源輕快下,使用萬用表檢驗電源和地檢查是否短路,如果沒有短路,再仔細核查電源極性后予以通電,觀察電源指示燈D1是否點亮。如果電源指示的燈不亮應立即關閉電源,并用手觸摸各個芯片,檢查是否用某芯片發熱。如果沒有發熱的器件,很可能是電源指示二極管極性安裝錯誤,或者是該發光二極管的串聯電阻阻值偏大。
2.黑板上調試要求:(1)焊接好電路板加電前,用萬用表測量板上Vcc 和
GND之間的電阻,應大于1KΩ
(2)加電后測量電路板上各電壓,應大于4.2V 調試結果:1.經萬用表檢驗,電路板無短路問題。
2.通電后,D1指示燈點亮。
3.測量Vcc 與 地之間的電阻,1.14KΩ > 1KΩ
4.測量Vcc與 地之間的電壓:4.28V > 4.20V
二、測試狀態指示
本系統中狀態指示二極管共有3個,它們分別是D1、D2、D3。D1是指示電源的,可以在電源接通時直接看到,D2用于指示語音芯片的工作狀態,留作語音模塊調試時觀察。D3是可以由單片機的引腳控制的。
編寫測試D3的程序: #include
sbit a_c=P1^0;extern serial_initial();
main(){ serial_initial();a_c=0;while(1);}
測試結果: 1.2.三、脈沖信號發生器測試
測試要求:該模塊由5G555芯片構成一個多諧振蕩器,使用示波器觀察該芯片的第3引腳的波形,并調節電位器W1,觀察輸出波形及頻率變化。
測試結果:
調整W1前,f=147.1Hz
調整W1后,f=130.5Hz
四、分頻電路測試
測試要求:該模塊由一個4位二進制計數器74HC161和一個多路選擇器74HC153構成。調試時可以利用由5G555芯片構成一個多諧振蕩器的輸出,或信號發生器作為計數器74HC161的計數輸入信號。值得注意的是控制多路選擇器74HC153的S0、S1與單片機調試時所使用的引腳復用,要采取特殊措施才能正確試驗檢測。
測試結果:利用函數信號發生器生成一個方波,周期/頻率如圖:
其在輸出端輸出的波形為:
f1=3.881kHz
f2 =1.235kHz 分頻功能無誤。
五、鍵盤測試
測試要求:本系統相對比較簡單,僅有5個按鍵,其中4個為系統功能鍵,它們分別是S1、S2、S3、S4,另一個是系統復位按鍵S6。對于系統復位按鍵S6可以在上電之后,使用萬用表予以檢查,按下該按鍵,單片機的第9腳應該為高電平,釋放后應該為點電平。
對于系統功能鍵,編寫如下程序予以測試檢查:
#include
#define BIT_LED XBYTE[0x0a000] void display();sbit k1=P1^0;sbit k2=P1^1;sbit k3=P1^2;sbit k4=P1^3;unsigned char a;unsigned
char table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67,0x40,0x00,0x63,0x39,};void delay(unsigned int i);main(){ while(1){ if(k1==0)a=0x06;if(k2==0)a=0x5b;if(k3==0)a=0x4f;if(k4==0)a=0x66;display();} } 測試結果:對于復位鍵S6,按下前應為低電平,按下后應為高電平
按下前
按下后
對于S1—S4,按下前為高電平,按下后為低電平。其測試結果均符合預期。
六、動態數碼管測試
測試要求:本系統中的數碼管的原理采用的是動態掃描方式,即某一時刻只用一個數碼管在顯示,利用人的視覺暫留特性,讓數碼管高速輪流顯示,達到完整顯示的目的。
編寫如下程序進行測試: #include
#define BIT_LED XBYTE[0x0a000] void displayhello();sbit k1=P1^0;sbit k2=P1^1;sbit k3=P1^2;sbit k4=P1^3;unsigned char a;unsigned char table[]={0x06,0x06,0x3f,0x3e,0x79,0x6e,0x3f,0x3e,0x7f,0x67,0x40,0x00,0x63,0x39,};void delayms(unsigned int i);main(){ while(1){ displayhello();} }
void displayhello(){
unsigned char BIT=1;
unsigned int i;
BIT_LED=1;
for(i=0;i<=7;i++)
{
SEGMENT=table[i];
BIT_LED=BIT;
BIT=BIT<<1;
delayms(1);
}
} void delayms(unsigned int i){ unsigned int n;while(i--){
for(n=0;n<125;n++);
} }
測試結果:顯示“I love you”
由于是動態顯示,所以按下復位鍵后,只有一個數碼管點亮
七、溫度傳感器測試
測試要求:本系統使用的是一款單線溫度傳感器(DS18B20),可將溫度穿換成12的數字量,以表示溫度。
編寫如下程序予以測試檢查: #include
//段碼寄存器地址 #define BIT_LED XBYTE[0x0a000]
//位碼寄存器地址 #define fosc 11.0592
unsigned char table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67,0x40,0x00,0x63,0x39,};//分別顯示0 1 2 3 4 5 6 7 8 9-o C
unsigned char table1[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef};//分別顯示0.1.2.3.4.5.6.7.8.9.unsigned char table2[]={0x76,0x79,0x38,0x38,0x3f};sbit k1=P1^0;sbit k2=P1^1;sbit k3=P1^2;unsigned char data display_buffer[13];unsigned char bdata data_ds1302;
unsigned char disbuf[]={0,0,0,0};sbit k4=P1^3;
sbit TMDAT=P3^4;
//溫度入口
void dmsec(unsigned int count);void tmreset(void);
//ds18b20 reset void tmstart(void);
// void tmrtemp(void);void Disbuf(unsigned int temper);void displaytemper();void delay(unsigned int);main(){ display_buffer[0]=0x01;
display_buffer[1]=0x00;
display_buffer[2]=0x00;display_buffer[3]=0x08;
display_buffer[4]=0x05;
display_buffer[5]=0x00;display_buffer[6]=0x01;
display_buffer[7]=0x04;
display_buffer[8]=0x00;display_buffer[9]=0x05;
display_buffer[10]=0x00;
display_buffer[11]=0x01;
display_buffer[12]=0x04;while(1){ tmstart();
tmrtemp();
displaytemper();} }
void tmreset(void){
unsigned int i;
TMDAT = 0;
i = 103;while(i>0)i--;
TMDAT = 1;
i = 4;while(i>0)i--;}
void tmpre(void){
unsigned int i;
while(TMDAT);
while(~TMDAT);
i = 4;while(i>0)i--;}
bit tmrbit(void){
// ds1820
// Reset TX
unsigned int i;
bit dat;
TMDAT = 0;i++;
TMDAT = 1;i++;i++;
dat = TMDAT;
i = 8;while(i>0)i--;
return(dat);}
unsigned char tmrbyte(void){
unsigned char i,j,dat;
dat = 0;
for(i=1;i<=8;i++){
j = tmrbit();
dat =(j << 7)|(dat >> 1);
}
return(dat);}
void tmwbyte(unsigned char dat){
unsigned int i;
unsigned char j;
bit testb;
for(j=1;j<=8;j++){
testb = dat & 0x01;
dat = dat >> 1;
if(testb){
TMDAT = 0;
i++;i++;
TMDAT = 1;
i = 8;while(i>0)i--;
}
else {
TMDAT = 0;
i = 8;while(i>0)i--;
TMDAT = 1;
i++;i++;
}
} }
void tmstart(void){
tmreset();
tmpre();
// ds1820
displaytemper();//delay(100);
tmwbyte(0xcc);
tmwbyte(0x44);
}
void tmrtemp(void){
unsigned char a,xiao,b,y1,y2,y3;
tmreset();
tmpre();
delay(1);
tmwbyte(0xcc);
tmwbyte(0xbe);
a = tmrbyte();
b = tmrbyte();
xiao=a&0x0f;//小數部分
y1=a>>4;
y2=b<<4;
y3=y1|y2;if((b&0x0f8)==0x0f8)
{y3=~y3+1;
disbuf[0]=10;//顯示符號
disbuf[1]=y3/10;
disbuf[2]=y3%10;
disbuf[3]=xiao*10*0.0625;} else
disbuf[0]=11;//不顯示
disbuf[1]=y3/10;
disbuf[2]=y3%10;
disbuf[3]=xiao*10*0.0625;}
void displaytemper()
//溫度顯示函數
{ unsigned int i;unsigned char e=0x01;//<<1;for(i=1;i<6;i++)
{ switch(i)
{
case 1:{SEGMENT=table[disbuf[1]];BIT_LED=e;break;}
case 2:{SEGMENT=table1[disbuf[2]];BIT_LED=e;break;}
case 3:{SEGMENT=table[disbuf[3]];BIT_LED=e;break;}
case 4:{SEGMENT=table[12];BIT_LED=e;break;}
case 5:{SEGMENT=table[13];BIT_LED=e;break;}
}
e=e<<1;
delay(80);
}
BIT_LED=0;
}
void delay(unsigned int i)
//delay函數 {
while(i--);}
測試結果:
經傳感器及數碼管延時,溫度重新顯示
八、時鐘日歷測試
測試要求:本系統使用了時鐘日歷專用芯片,該芯片是以串行方式實現控制和數據傳輸的。
編寫如下程序進行測試: #include
//段碼寄存器地址 #define BIT_LED XBYTE[0x0a000]
//位碼寄存器地址 #define fosc 11.0592
unsigned char table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67,0x40,0x00,0x63,0x39,};unsigned char table1[]={0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef};unsigned char table2[]={0x76,0x79,0x38,0x38,0x3f};sbit k1=P1^0;sbit k2=P1^1;sbit k3=P1^2;sbit k4=P1^3;//利用開關量實現切換
//頻率變量及子函數預定義 void displayfreq();void read_freq();unsigned char tcount=0,timecount=0;unsigned long freq=0.0;bit freqflag=0;unsigned char fr[6];unsigned int i=0,x=0;
//日期變量及子函數預定義 sbit SCL_ds1302=P2^0;sbit IO_ds1302=P2^1;sbit RST_ds1302=P2^2;
unsigned char data display_buffer[13];unsigned char bdata data_ds1302;
//傳輸符
unsigned char disbuf[]={0,0,0,0};void open_write_bit();void initial_ds1302();unsigned char read_ds1302(char command);void close_write_bit();void read_time();void set_time();void delay(unsigned int i);void delayms(unsigned int i);void displaytime();void displaydate();main(){ initial_ds1302();
//上電走時
read_time();
//讀取當前時間,放到數組中
display_buffer[0]=0x01;
display_buffer[1]=0x05;
display_buffer[2]=0x01;display_buffer[3]=0x07;
display_buffer[4]=0x04;
display_buffer[5]=0x00;display_buffer[6]=0x01;
display_buffer[7]=0x06;
display_buffer[8]=0x00;display_buffer[9]=0x05;
display_buffer[10]=0x00;
display_buffer[11]=0x01;
display_buffer[12]=0x04;
set_time();
//設置時間
while(1){
if(k1==0)
{
while(1){
read_time();
displaytime();
if(k2==0)break;
}
}
read_time();
displaydate();} }
void close_write_bit()//close write { unsigned int i;
SCL_ds1302=0;
_nop_();
RST_ds1302=1;_nop_();_nop_();data_ds1302=0x8e;
for(i=1;i<=8;i++){
SCL_ds1302=0;
IO_ds1302=(data_ds1302&0x01);
_nop_();
SCL_ds1302=1;
data_ds1302=data_ds1302>>1;} data_ds1302=0x80;
IO_ds1302=0;for(i=1;i<=8;i++){
SCL_ds1302=0;
IO_ds1302=(data_ds1302&0x01);
_nop_();
SCL_ds1302=1;
data_ds1302=data_ds1302>>1;} }
void open_write_bit()//open write { unsigned int i;SCL_ds1302=0;_nop_();
//打開寫保護//關閉寫保護
RST_ds1302=1;_nop_();_nop_();data_ds1302=0x8e;for(i=1;i<=8;i++){
SCL_ds1302=0;
IO_ds1302=data_ds1302&0x01;
_nop_();SCL_ds1302=1;
data_ds1302=data_ds1302>>1;} data_ds1302=0x00;
//0x00,書上為0x80 IO_ds1302=0;for(i=1;i<=8;i++){
SCL_ds1302=0;
IO_ds1302=data_ds1302&0x01;
_nop_();SCL_ds1302=1;
data_ds1302=data_ds1302>>1;} }
void initial_ds1302()
//初始化函數 { unsigned int i;SCL_ds1302=0;_nop_();RST_ds1302=1;_nop_();_nop_();data_ds1302=0x8e;
for(i=1;i<=8;i++){
SCL_ds1302=0;
IO_ds1302=data_ds1302&0x01;
_nop_();SCL_ds1302=1;
data_ds1302=data_ds1302>>1;} IO_ds1302=0;data_ds1302=0x00;
for(i=1;i<=8;i++){
SCL_ds1302=0;
IO_ds1302=data_ds1302&0x01;
_nop_();SCL_ds1302=1;
data_ds1302=data_ds1302>>1;} RST_ds1302=0;SCL_ds1302=0;_nop_();RST_ds1302=1;_nop_();_nop_();data_ds1302=0x90;
for(i=1;i<=8;i++){ SCL_ds1302=0;IO_ds1302=data_ds1302&0x01;_nop_();SCL_ds1302=1;data_ds1302=data_ds1302>>1;}
data_ds1302=0x0a4;
for(i=1;i<=8;i++){ SCL_ds1302=0;IO_ds1302=data_ds1302&0x01;_nop_();SCL_ds1302=1;data_ds1302=data_ds1302>>1;} RST_ds1302=0;_nop_();SCL_ds1302=0;_nop_();RST_ds1302=1;
data_ds1302=0x8e;
for(i=1;i<=8;i++){ SCL_ds1302=0;IO_ds1302=data_ds1302&0x01;_nop_();SCL_ds1302=1;data_ds1302=data_ds1302>>1;}
data_ds1302=0x80;
for(i=1;i<=8;i++){ SCL_ds1302=0;IO_ds1302=data_ds1302&0x01;_nop_();SCL_ds1302=1;data_ds1302=data_ds1302>>1;} RST_ds1302=0;_nop_();SCL_ds1302=0;}
unsigned char read_ds1302(char command)
//read函數 { unsigned int i;data_ds1302=command;SCL_ds1302=0;_nop_();RST_ds1302=1;for(i=1;i<=8;i++){
SCL_ds1302=0;IO_ds1302=data_ds1302&0x01;_nop_();SCL_ds1302=1;data_ds1302=data_ds1302>>1;}
SCL_ds1302=1;for(i=1;i<=8;i++){
SCL_ds1302=0;
if(IO_ds1302)data_ds1302=(data_ds1302>>1)|0x80;
//送入到data_ds1302中,準備送出
else data_ds1302>>=1;SCL_ds1302=1;} RST_ds1302=0;_nop_();SCL_ds1302=0;return(data_ds1302);}
void write_ds1302(unsigned char address,unsigned char numb){
unsigned int i;
SCL_ds1302=0;
RST_ds1302=0;
RST_ds1302=1;
data_ds1302=address;for(i=1;i<=8;i++){
SCL_ds1302=0;
IO_ds1302=data_ds1302&0x01;
//送入寫地址
_nop_();SCL_ds1302=1;
data_ds1302=data_ds1302>>1;} data_ds1302=numb;for(i=1;i<=8;i++){
SCL_ds1302=0;
IO_ds1302=data_ds1302&0x01;
_nop_();SCL_ds1302=1;
data_ds1302=data_ds1302>>1;} } void read_time(){ unsigned char second,minte,hour,d,date,month,year,zhou;second=0x81;
//讀秒
d=read_ds1302(second);display_buffer[5]=d&0x0f;display_buffer[4]=d>>4;minte=0x83;
//讀分
d=read_ds1302(minte);display_buffer[3]=d&0x0f;display_buffer[2]=d>>4;hour=0x85;
//讀時
d=read_ds1302(hour);display_buffer[1]=d&0x0f;display_buffer[0]=d>>4;year=0x8d;
//讀年
d=read_ds1302(year);display_buffer[7]=d&0x0f;display_buffer[6]=d>>4;month=0x89;
//讀月
d=read_ds1302(month);display_buffer[9]=d&0x0f;display_buffer[8]=d>>4;
//送入寫的內容
zhou=0x8b;
//讀周d=read_ds1302(zhou);display_buffer[12]=d;date=0x87;
//讀日期
d=read_ds1302(date);display_buffer[11]=d&0x0f;display_buffer[10]=d>>4;}
void set_time(){ unsigned char data temp;unsigned char data hour_address=0x84,minte_address=0x82,second_address=0x80,date_address=0x86,month_address=0x88,zhou_address=0x8a,year_address=0x8c;//各個時間量的地址
open_write_bit();
temp=(display_buffer[0]<<4)|display_buffer[1];write_ds1302(hour_address,temp);
//寫小時
temp=(display_buffer[2]<<4)|display_buffer[3];write_ds1302(minte_address,temp);
//寫分鐘
temp=(display_buffer[4]<<4)|display_buffer[5];write_ds1302(second_address,temp);
//寫秒
temp=(display_buffer[6]<<4)|display_buffer[7];write_ds1302(year_address,temp);
//寫年
temp=(display_buffer[8]<<4)|display_buffer[9];write_ds1302(month_address,temp);
//寫月
temp=display_buffer[12];write_ds1302(zhou_address,temp);
//寫周temp=(display_buffer[10]<<4)|display_buffer[11];write_ds1302(date_address,temp);
//寫日期
close_write_bit();
}
void delay(unsigned int i)
//delay函數 {
while(i--);}
void delayms(unsigned int i){ unsigned int n;while(i--){
for(n=0;n<125;n++);
} }
void displaytime(){ unsigned char e=0x01;unsigned int i;BIT_LED=0;
for(i=0;i<=5;i++){
if(i==5||i%2==0||i==11)
SEGMENT=table[display_buffer[i]];
else
SEGMENT=table1[display_buffer[i]];
BIT_LED=e;
e<<=1;
delayms(1);
}
}
void displaydate(){ unsigned char e=0x01;unsigned int i;BIT_LED=0;
for(i=6;i<=13;i++){
if(i==7||i==9)
SEGMENT=table1[display_buffer[i]];
else if(i==12)
SEGMENT=table[10];
else if(i==13)
SEGMENT=table[display_buffer[i-1]];
else
SEGMENT=table[display_buffer[i]];
BIT_LED=e;
e<<=1;delayms(1);
}
}
測試結果:
S1,S2實現年月日周與時分秒的切換
九、語音收錄播報測試:
測試要求:本系統中使用的是語音專用芯片IDS1760芯片,該芯片是以串行方式實現控制和數據傳輸的。
編寫如下程序進行測試: #include
unsigned char bdata SR0_L;unsigned char bdata SR0_H;unsigned char bdata SR1;unsigned char APCL=0,APCH=0;unsigned char PlayAddL=0,PlayAddH=0;unsigned char RecAddL=0,RecAddH=0;
sbit CMD=SR0_L^0;sbit FULL=SR0_L^1;sbit PU=SR0_L^2;sbit EOM=SR0_L^3;sbit INTT=SR0_L^4;sbit RDY=SR1^0;sbit ERASE=SR1^1;sbit PLAY=SR1^2;sbit REC=SR1^3;
unsigned char ISD_SendData(unsigned char dat);void ISD_PU(void);void ISD_Rd_Status(void);void ISD_WR_APC2(unsigned char apcdatl,apcdath);void ISD_SET_PLAY(unsigned char Saddl,Saddh,Eaddl,Eaddh);void ISD_SET_Rec(unsigned char Saddl,Saddh,Eaddl,Eaddh);void ISD_SET_Erase(unsigned char Saddl,Saddh,Eaddl,Eaddh);
sbit SS=P1^4;sbit SCK=P1^7;sbit MOSI=P1^5;sbit MISO=P1^6;
void Cpu_Init(void);void ISD_Init(void);void delay(unsigned int t);
void main(){ Cpu_Init();ISD_Init();
while(1){ ISD_SET_Erase(0,0,9,0);ISD_SET_Rec(0,0,9,0);ISD_SET_PLAY(0,0,9,0);} }
void Cpu_init(void){ P0=P1=P2=P3=0xff;TMOD=0x01;EA=0;} void ISD_Init(void){ uchar i=2;SS=1;SCK=1;MOSI=0;do { ISD_PU();//上電 delay(50);ISD_Rd_Status();//讀取狀態
}while(CMD||(!PU));
//if(CMD_Err==1||(PU!+1))則再次發送上電指令 ISD_WR_APC2(0x40,0x04);//將0x0440寫入APC寄存器
do { ISD_Rd_Status();}while(RDY==0);do { delay(300);delay(300);i--;}while(i>0);}
//向cpu讀回或發送數據
unsigned char ISD_SendData(unsigned char dat){ unsigned char i,j,BUF_ISD=dat;SCK=1;SS=0;for(j=4;j>0;j--){;}
for(i=0;i<8;i++){ SCK=0;for(j=2;j>0;j--){;} if(BUF_ISD&0x01)
{MOSI=1;} else
{MOSI=0;} BUF_ISD>>=1;if(MISO)
{BUF_ISD|=0x80;} SCK=1;for(j=6;j>0;j--){;} } MOSI=0;return(BUF_ISD);} void ISD_PU(void){
ISD_SendData(0x01);
ISD_SendData(0x00);
SS=1;} void ISD_Rd_Status(void){ unsigned char i;ISD_SendData(0x05);ISD_SendData(0x00);ISD_SendData(0x00);SS=1;for(i=2;i>0;i--){;} SR0_L=ISD_SendData(0x05);SR0_H=ISD_SendData(0x00);SR1=ISD_SendData(0x00);SS=1;}
void ISD_WR_APC2(unsigned char apcdatl,apcdath){ ISD_SendData(0x65);ISD_SendData(apcdatl);ISD_SendData(apcdath);SS=1;}
void ISD_SET_PLAY(unsigned char Saddl,Saddh,Eaddl,Eaddh){ ISD_SendData(0x80);ISD_SendData(0x00);ISD_SendData(Saddl);ISD_SendData(Saddh);ISD_SendData(Eaddl);ISD_SendData(Eaddh);ISD_SendData(0x00);SS=1;}
void ISD_SET_Rec(unsigned char Saddl,Saddh,Eaddl,Eaddh){
ISD_SendData(0x81);ISD_SendData(0x00);ISD_SendData(Saddl);ISD_SendData(Saddh);ISD_SendData(Eaddl);ISD_SendData(Eaddh);ISD_SendData(0x00);SS=1;}
void ISD_SET_Erase(unsigned char Saddl,Saddh,Eaddl,Eaddh){ ISD_SendData(0x82);ISD_SendData(0x00);ISD_SendData(Saddl);ISD_SendData(Saddh);ISD_SendData(Eaddl);ISD_SendData(Eaddh);ISD_SendData(0x00);SS=1;} void delay(unsigned int t){ for(;t>0;t--){ TH0=0xfc;TL0=0x18;TR0=1;while(TF0!=1){;} TF0=0;TR0=0;} }
測試結果:需要在程序中設置斷點,完成錄音,放音再錄音放音的循環操作。
測試功能正常。
十、單片機模塊調試
測試要求:該模塊的調試很復雜,牽扯面也很多。其實通過前面各個模塊的調試,已經大部分得到了間接地驗證。例如在“動態數碼管測試”和“串行通訊測試”中就是用到了定時器。
如有必要可以再編寫一些測試程序。例如檢測單片機的某一口線的功能是否正常、測試某段程序運行時間,等等。
測試結論:因單片機大部分功能在前調試方案中大部分已使用過,此處不再進行其余調試。
第五篇:《基于單片機的出租車計價器的設計》開題報告
《基于單片機的出租車計價器的設計》開題報告
關鍵詞:出租車計價器 浙江師范大學應用電子技術專業開題報告范文 杭州論文 開題報告
一.選題背景和意義
隨著我國經濟的迅速發展,人民生活水平的顯著提高,城市的交通日趨完善,出租車計價器的應用也越來越廣泛。雖然私家車的擁有量在大幅度地提高,但是出租車還是在我國的交通運輸中承擔著重要的角色,出租車計價器是出租車上必不可少的重要儀器,它是負責出租車營運收費的專用智能化儀表。用戶不僅要求計價器性能穩定、計價準確而且對它的要求也越來越高。
近年來,我國出租汽車行業迅猛發展,出租汽車已經成為我國城市公共交通的重要組成部分和現代化城市必備的基礎設施,成為人們工作、生活中不可缺少的交通工具。出租汽車服務行業和出租汽車計價器緊密相關,因為出租汽車必須安裝出租汽車計價器才能投入營運。出租汽車計價器是一種能根據乘客乘坐汽車行駛距離和等候時間的多少進行計價,并直接顯示車費值的計量器具。計價器是出租汽車的經營者和乘坐出租汽車的消費者之間用于公平貿易結算的工具,因而計價器計價準確與否,直接關系到經營者和消費者的經濟利益。依據國家有關法律、法規,出租汽車計價器是列入國家首批強制檢定的工作計量器具之一,也是近年來國家質量技術監督部門強化管理的六類重點計量器具之一。
出租車行業在我國是八十年代初興起的一項新興行業,隨著我國國民經濟的高速發展,出租汽車已成為城市公共交通的重要組成部分。多年來國內普遍使用的計價器只具備單一的計量功能。目前全世界的計價器中有90%為臺灣所生產?,F今我國生產計價器的企業有上百家,主要是集中在北京,上海,沈陽和廣州等地。
在出租車是城市交通的重要組成部分,行業健康和發展也獲得越來越多的關注。汽車計價器是乘客與司機雙方的交易準則,它是出租車行業發展的重要標志,是出租車中最重要的工具。它關系著交易雙方的利益。具有良好性能的計價器無論是對廣大出租車司機朋友還是乘客來說都是很必要的。
二、國內外研究現狀、發展動態
出租車行業在我國是八十年代初興起的一項新興行業,隨著我國國民經濟的高速發展,出租汽車已成為城市公共交通的重要組成部分。多年來國內普遍使用的計價器只具備單一的計量功能。目前全世界的計價器中有90%為臺灣所生產?,F今我國生產計價器的企業有上百家,主要是集中在北京,上海,沈陽和廣州等地。
我國的第一家生產計價器企業是重慶市起重機廠,最早的計價器全部采用機械齒輪結構,只能完成簡單的計程功能,可以說早期的計價器就是一個里程表。
隨著科學技術的發展,產生了第二代計價器。它采用了手搖計算機與機械結構相結合的方式,實現了半機械半電子化。此時它在計程的同時還可以完成計價的工作。
大規模集成電路的發展又產生了第三代計價器,也就是全電子化的計價器。它的功能也在不斷完善.當單片機出現并應用于計價器后,現代出租車計價器的模型也就基本具備了,它可以完成計程,計價,顯示等基本工作。單片機以及外圍芯片的不斷發展促進了計價器的發展。出租車計價器在最初使用時具備的主要功能是根據行駛里程計價,要求精度高,可靠性好。
三、研究的內容及可行性分析 1.研究的內容:
計價器顯示的營運金額是營運里程與價格的函數(等候時間一般折算成一定比例的里程來計算)。出租車計價器通過傳感器與行駛車輛連接。出租汽車的實際里程通過傳感器的脈沖信號在計價器里折算成一定的計價營運里程。針對這一點我們來利用單片機作為控制核心,設計一款出租車計價器,具有計價顯示、等待時間計價,公里數顯示,時間顯示等相關功能。設計要求:
(1)、計價要求:3公里以內10元,夜晚三公里以外每公里2.2元,白天三公里以外每公里1.8元;
(2)、能夠實時顯示公里數和等待時間;等待時間計價要求為:等待3分鐘以內不計價,3分鐘以外每分鐘0.5元;
(3)、具備起步和下車的語音提示;
2.可行性分析:
本設計采用AT89C51單片機為主控器,以A44E霍爾傳感器測距,實現對出租車的多功能的計價設計,并采用掉電存儲單元AT24C02來實現在系統掉電的時候保存單價和系統時間等信息,輸出采用8段數碼顯示管。本電路設計的計價器不但能實現基本的計價,而且還能根據白天,黑夜,中途等待來調節單價,但同時在不計價的時候還能作為時鐘為司機同志提供方便。
四、論文擬解決的關鍵問題及難點
1.關鍵問題:
1)解決里程檢測電路精度問題;
2)解決計價器的掉電存儲能力和顯示的驅動能力; 3)解決多次計價的累加和顯示問題。2.難點: 對數據的采集及顯示。
五、研究方法與技術路線
本設計由硬件設計和軟件設計兩部分組成。系統的硬件主要由以下幾個部件組成:單片機AT89S51、AT24C02 掉電存儲控制、里程計算單元、總金額及單價顯示部件、串口顯示驅動電路、鍵盤控制部件、語音播報電路等,其方框原理圖如圖1所示。
1.硬件設計 1.1 單片機模塊:
AT89C51是一種帶4K字節閃爍可編程可擦除只讀存儲器的低電壓、高性能CMOS8位微處理器,俗稱單片機。單片機的可擦除只讀存儲器可以反復擦除100次。該器件采用ATMEL高密度非易失存儲器制造技術制造,與工業標準的MCS-51指令集和輸出管腳相兼容。由于將多功能8位CPU和閃爍存儲器組合在單個芯片中,ATMEL的89C51是一種高效微控制器。AT89C2051是它的一種精簡版本,AT89C2051是美國ATMEL公司生產的低電壓,高性能CMOS8位單片機,片內含2K字節的可反復擦寫的只讀程序存儲器和128bytes的隨機存取數據存儲器,器件采用ATMEL公司的高密度、非易失性存儲技術生產,兼容標準MCS-51指令系統,片內置通用8位中央處理器和Flash存儲單元。因為在的程序中有讀取、計算、顯示等單元,2K字節的ROM可能不夠,因此我們采用AT89C51作為單片機模塊。
1.2 AT24C02 掉電存儲單元: 掉電
存儲單元的作用是在電源斷開的時候,存儲當前設定的單價信息。AT24C02 是ATMEL公司的2KB 字節的電可擦除存儲芯片,采用兩線串行的總線和單片機通訊,電壓最低可以到2.5V,額定電流為1mA,靜態電流10Ua(5.5V),芯片內的資料可以在斷電的情況下保存40 年以上,而且采用8 腳的DIP 封裝,使用方便。
AT24C02的外圍電路中有R1、R2 兩個上拉電阻,其作用是減少AT24C02 的靜態功耗,由于AT24C02 的數據線和地址線是復用的,采用串口的方式傳送數據,所以只用兩根線SCL(移位脈沖)和SDA(數據/地址)與單片機傳送數據。
每當設定一次單價,系統就自動調用存儲程序,將單價信息保存在芯片內;當系統重新上電的時候,自動調用讀存儲器程序,將存儲器內的單價等信息,讀到緩存單元中,供主程序使用。
1.3 里程計算、計價單元的設計:
里程計算是通過安裝在車輪旁的霍爾傳感器A44E檢測到的信號,送到單片機,經處理計算,送給顯示單元的。其原理如圖2傳感器測距示意圖所示。
圖 2 傳感器測距示意圖
由于A44E 屬于開關型的霍爾器件,其工作電壓范圍比較寬(4.5~18V),其輸出的信號符合TTL 電平標準,可以直接接到單片機的IO 端口上,而且其最高檢測頻率可達到1MHZ。
A44E 集成霍耳開關由穩壓器A、霍耳電勢發生器(即硅霍耳片)B、差分放大器C、施密特觸發器D 和OC 門輸出E 五個基本部分組成。
在輸入端輸入電壓CC V,經穩壓器穩壓后加在霍耳電勢發生器的兩端,根據霍耳效應原理,當霍耳片處在磁場中時,在垂直于磁場的方向通以電流,則與這二者相垂直的方向上將會產生霍耳電勢差H V 輸出,該H V 信號經放大器放大后送至施密特觸發器整形,使其成為方波輸送到OC 門輸出。當施加的磁場達到工作點(即OP B)時,觸發器輸出高電壓(相對于地電位),使三極管導通,此時OC 門輸出端輸出低電壓,通常稱這種狀態為開。當施加的磁場達到釋放點(即rP B)時,觸發器輸出低電壓,三極管截止,使OC 門輸出高電壓,這種狀態為關。這樣兩次電壓變換,使霍耳開關完成了一次開關動作。
我們選擇了P3.2 口作為信號的輸入端,內部采用外部中斷0(這樣可以減少程序設計的麻煩),車輪每轉一圈(我們設車輪的周長是1 米),霍爾開關就檢測并輸出信號,引起單片機的中斷,對脈計數,當計數達到1000 次時,也就是1 公里,單片機就控制將金額自動的加增加,其計算公式:當前單價×公里數=金額。
1.4 數據顯示單元:
由于設計要求有單價(2 位)、路程(2 位)、總金額(3 位)顯示輸出,加上我們另外擴展了時鐘顯示(包含時分秒的顯示),若采用LCD 液晶段碼顯示,在距離屏幕1 米之外就無法看清數據,不能滿足要求,而且在白天其對比度也不能夠滿足要求,因此我們采用6 位LED數碼管的分屏顯示,如圖 4 采用6 位LED數碼管的分屏顯示所示:
時鐘顯示(圖中顯示為12 點0 分46 秒)
圖 4 采用6 位LED數碼管的分屏顯示
數據的分屏的顯示是通過按鍵S1 來實現切換的,如圖 5 S1切換顯示屏所示。
圖 5 S1切換顯示屏
在出租車不走的時候,按下S1,可以實現數據的分屏顯示;車在行走的時候只有總金額和單價顯示屏在顯示,當到達目的地的時候,客戶要求查看總的里程的時候,就可以按下S1 切換到里程和單價顯示屏,供客戶查詢。顯示電路的電路原理圖如圖 7 所示。
1.5 串口顯示驅動電路
從單片機串口輸出的信號先送到右邊的移位寄存器(74HC164),由于移位脈沖的作用,使數據向右移,達到顯示的目的。移位寄存器74HC164還兼作數碼管的驅動,插頭1(header1)接數據和脈沖輸出端,插頭2(header2)接電源。電路中的三個整流管D1~D3 的作用是降低數碼管的工作電壓,增加其使用壽命。
1.6 鍵盤控制部件 1)S1按鍵的功能
在出租車不走的時候,按下S1,可以實現數據的分屏顯示;車在行走的時候只有總金額和單價顯示屏在顯示,當到達目的地的時候,客戶要求查看總的里程的時候,就可以按下S1切換到里程和單價顯示屏,供客戶查詢。
2)S2按鍵的功能
在按下S1按鍵之后,若接著按下S2鍵則進行單價調整(默認為調整白天單價),當接著按下S1時,則進行晚上單價調整,再次按下S1可進行中途等待單價調整。當單價調整結束后,可以通過按下S2按鍵進行時間調整,默認為調整小時,接著按下S1可進行調整分鐘,分鐘調整后再接下S1可進行秒調整。當時間調整完成后,若接著按下S2則又可進行單價調整。3)S3按鍵的功能
在顯示金額及單價時,若按下S3鍵則顯示路程和單價,再次按下S3,可返回顯示金額及單價。
4)S4按鍵的功能
在按下S1按鍵之后,若接著按下S4按鍵,則進行設定默認晚上單價,并啟動計價器,若沒有按下S4則可設定默認單價(白天),并啟動計價器。當設定默認晚上單價結束后,再次接下S4按鍵,則可設定默認中途等待單價,并啟動計價器。當設定默認中途等待單價后,若還按一次S4,則返回系統時間的顯示。
1.7 語音播報電路
主要用于向乘客致歡迎詞,以提高服務質量。語音芯片選用ISD4004,該系列工作電壓3V,單片錄放時間4~8min,音質好。芯片采用CM0S技術,內含振蕩器、防混淆濾波器、平滑濾波器、音頻放大器、自動靜噪及高密度多電平閃爍存貯陣列。當乘客上車時,播報內容為:乘客您好,歡迎您乘坐本公司出租車。當到達目的地時,播報內容為:車已到達目的地,請按計價器上顯示的金額付款,謝謝!
2.軟件設計
2.1系統整體程序流程
在主程序模塊中,需要完成對各接口芯片的初始化、出租車起價和單價的初始化、中斷向量的設計以及開中斷、循環等待等工作。當按下S1時,就啟動計價,將根據里程寄存器中的內容計算和判斷出行駛里程是否已超過起價公里數。若已超過,則根據里程值、每 本論文由無憂論文網www.tmdps.cn整理提供
公里的單價數和起價數來計算出當前的累計價格,并將結果存于價格寄存器中,然后將時間和當前累計價格送顯示電路顯示出來。當到達目的地的時候,由于霍爾開關沒有送來脈沖信號,就停止計價,顯示當前所應該付的金額和對應的單價,到下次啟動計價時,系統自動對顯示清零,并重新進行初始化過程。主程序流程圖如圖8 所示。
2.2 定時中斷服務程序
在定時中斷服務程序中,每100ms 產生一次中斷,當產生10 次中斷的時候,也就到了一秒,送數據到相應的顯示緩沖單元,并調用顯示子程序實時顯示。其程序流程如圖9所示。
2.3 里程計數中斷服務程序
每當霍爾傳感器輸出一個低電平信號就使單片機中斷一次,當里程計數器對里程脈沖計滿1000 次時,使微機進入里程計數中斷服務程序中。在該程序中,需要完成當前行駛里程數和總額的累加操作,并將結果存入里程和總額寄存器中。2.4 中途等待中斷服務程序
當在計數狀態下霍爾開關沒有輸出信號,片內的T1 定時器便被啟動,每當計時到達3分鐘,就對當前金額加上中途等待的單價,以后每3分鐘都自動加上中途等待的單價。當中途等待結束的時候,也就自動切換到正常的計價。2.5 顯示子程序服務程序
由于是分屏顯示數據,所以就要用到4 個顯示子程序,分別是:時分秒顯示子程序、金額單價顯示子程序、路程單價顯示子程序、單價調節子程序。2.6 鍵盤服務程序
鍵盤采用查詢的方式,放在主程序中,當沒有按鍵按下的時候,單片機循環主程序,一旦有按鍵按下,便轉向相應的子程序處理,處理結束再返回。
六、論文的進度安排 2010.07 下達任務書
2010.07——2010.09 完成選題和資料收集,準備開題 2010.09.26 開題
2010.10——2011.02 完成硬件設計和軟件編程 2011.02——2011.03 進行調試 2011.03——2011.04 撰寫論文準備答辯
七、主要參考文獻
[1] 張友德,趙志英,涂時亮.http://www.tmdps.cn/ktbgfw/ 單片微型機原理、應用與實驗.上海:復旦大學出版社 2005,12.[2] 徐光翔.單片機原理接口及應用.南京大學出版社.[3] 張淑清等.單片微型計算機接口技術及其應用.北京:國防工業出版社.[4] 王曉君等.MCS-51及兼容單片機原理與選型.北京:電子工業出版社.[5] 張鑫,華臻,陳書謙.《單片機原理及應用》[M].電子工業出版社, 2005.P110~136.[6] 丁元杰、吳大偉《單片微機實題集與實驗指導書》.[M].機械工業出版社, 2004.P124~125.