【正文】
因此編程時(shí)要注意在選芯片之前,要先將計(jì)算出的數(shù)據(jù)信號(hào)先放到數(shù)據(jù)總線上。 基于 FPGA 的電梯控制器設(shè)計(jì) 第 25 頁(yè) 共 31 頁(yè) 第 4 章各部件仿真結(jié)果 到達(dá)樓下信號(hào)仿真圖 圖 5 樓下信號(hào)仿真圖 超重警告仿真如圖 圖 6 超重信號(hào)仿真圖 基于 FPGA 的電梯控制器設(shè)計(jì) 第 26 頁(yè) 共 31 頁(yè) 外人請(qǐng)求信號(hào): 注解:由 2HZ 時(shí)鐘信號(hào)充當(dāng)敏感信號(hào),觸發(fā)各個(gè)上升或者下降請(qǐng)求,在電梯內(nèi)外各有數(shù)碼管顯示樓層、請(qǐng)求和電梯運(yùn)動(dòng)方向信號(hào),由電梯門控制信號(hào)控制電梯到達(dá)樓層的開、關(guān)門,電梯設(shè)有超載、關(guān)門中斷、提前關(guān)門、和看們狗等警報(bào)系統(tǒng),硬件上使用 FPGA 來(lái)實(shí)現(xiàn), FPGA 在實(shí)現(xiàn)電梯控制方面比較靈活,可以通過(guò)對(duì)程序的修改來(lái)達(dá)到控制多個(gè)樓層,能夠滿足一般的載客電梯的工作功能需要。 begin if(rising_edge(clk50)) then if(num=2) then num:=0。 程序如下: library ieee。 led_i_a=dd。downo4amp。upo2amp。amp。ina6amp。 elsif down10=39。039。 then downo4=down4。 if down2=39。 then upo7=up7。 elsif up5=39。039。 elsif a10=39。039。 then ina4=a4。 對(duì)電梯內(nèi)人請(qǐng)求信號(hào)進(jìn)行檢測(cè)和寄存 elsif a2=39。 end if。 opendoor=39。 then ina10=39。039。 opendoor=39。 then ina9=39。139。139。039。139。139。 end if。 elsif dd_cc0011111111 then en_up=39。 or upo8=39。 end if。 elsif dd_cc0001000000 then en_dw=39。 or downo7=39。039。139。 then led_c_f=1111000。039。139。 opendoor=39。 opendoor=39。 then if ina6=39。 opendoor=39。opendoor=39。 elsif ina5=39。139。039。 elsif gate5=39。139。039。 elsif dd_cc0000001000 then en_dw=39。 upo4=39。 電梯到達(dá) 4 樓,數(shù)碼管顯示 4 if updown=39。 elsif dd_cc0000000111 then en_up=39。 downo3=39。039。139。039。039。139。039。 opendoor=39。 then ina2=39。039。有當(dāng)前層的請(qǐng)求,則電梯進(jìn)入開門狀態(tài) elsif dd_cc0000000001 then en_up=39。 or upo1=39。door=00。 elsif q1=6 then door=00。 then 下降預(yù)操作 if close=39。139。q2=q2+1。down=39。139。 q1=0。 then q1=0。 電梯內(nèi)外請(qǐng)求信號(hào)寄存器 signal opendoor:std_logic。 電機(jī)控制信 號(hào)和電梯運(yùn)動(dòng) end 。 到達(dá)樓層信號(hào) door : out std_logic_vector(1 downto 0)。 use 。考慮到系統(tǒng) I/O資源需求, 4 個(gè)按鍵值采用掛在 PORTB 口。一般情況下,電梯工作起始點(diǎn)是第一層,起始狀態(tài)是等待狀態(tài),啟動(dòng)條件是收到上升請(qǐng)求。變壓變頻調(diào)速控制電梯速度調(diào)節(jié)平滑,獲 得十分良好的乘坐舒適感,并且能降低電動(dòng)機(jī)的起制動(dòng)電流,與其他類型交流調(diào)速系統(tǒng)相比運(yùn)行效率高、節(jié)能效果顯著。 綜合上述:方案一不需要增加外圍電路,利用軟件的方法來(lái)濾去抖動(dòng)脈沖,這使程序負(fù)擔(dān)加重,影響電梯的實(shí)時(shí)性。數(shù)碼管能顯示 0— 9 的數(shù)字,顯示亮度大,顏色單一。 方案二:采用超聲波測(cè)距技術(shù)測(cè)量電梯的位置。 在 FPGA 內(nèi)部設(shè)置一個(gè)電梯運(yùn)行方向標(biāo)志位,取名位 dir。 這種方案可以節(jié)約很多能源,當(dāng)電梯廂處于低樓層時(shí),配重處于高樓層,這時(shí)配重具有重力勢(shì)能。 (三)獨(dú)立性 VHDL 的硬件描述與具體的工藝技術(shù)和硬件結(jié)構(gòu)無(wú)關(guān)。 VHDL 與 VerilogHDL 一起成為業(yè)界主選的硬件描述語(yǔ)言。主要用于描述離散電子系 統(tǒng)的結(jié)構(gòu)和行為。這樣,同一片F(xiàn)PGA,不同的編程數(shù)據(jù),可以產(chǎn)生不同的電路功能。 FPGA 采用高速 CHMOS 工藝,功耗低,可以與 CMOS、 TTL電平兼容。簡(jiǎn)單來(lái)說(shuō)就是依賴功能強(qiáng)大的計(jì)算機(jī),在 EDA 工具軟件平臺(tái)上,對(duì)以硬件描述語(yǔ)言 HDL 為系統(tǒng)邏輯描述手段完成的設(shè)計(jì)文件,自動(dòng)地完成邏輯編譯、邏輯化簡(jiǎn)、邏輯分割、 邏輯綜合、結(jié)構(gòu)綜合(布局布線),以及邏輯優(yōu)化和仿真測(cè)試,直至實(shí)現(xiàn)既定的電子線路系統(tǒng)功能。 基于 FPGA 的電梯控制器設(shè)計(jì) 第 6 頁(yè) 共 31 頁(yè) EDA 技術(shù)介紹 EDA 技術(shù)是 20 世紀(jì) 90 年代初從計(jì)算機(jī)輔助設(shè)計(jì)( Computer Aided Design)、計(jì)算機(jī)輔助制造( Computer Aided Manufacture)、計(jì)算機(jī)輔助測(cè)試( Computer Aided Testing)和計(jì)算機(jī)輔助工程( Computer Aided Engineering)的概念發(fā)展而來(lái)的。繼電器控制系統(tǒng)由于故障率高、可靠性差、控制方式不靈活以及消耗功率大等缺點(diǎn),目前已逐漸被淘汰。本設(shè)計(jì)就是基于電子設(shè)計(jì)自動(dòng)化( Electronic Design Automation)技術(shù)中的甚高速集成電路硬件描述語(yǔ)言( Very High Speed Integrated Circuit Hardware Description Language)語(yǔ)言所開發(fā)的六層電梯控制程序 。 關(guān)鍵詞:控制器; EDA;電梯 基于 FPGA 的電梯控制器設(shè)計(jì) 第 4 頁(yè) 共 31 頁(yè) Abstract This Elevator as a product of modern civilization, as early as in the last century into our lives. The design is based on the electronic design automation (Electronic Design Automation) very high speed integrated circuit hardware description language (Very in High Speed Integrated Circuit Hardware Description Language) six elevator control program development language. VHDL has the features and the specific hardware circuit design is independent and platform independent, and has the ability to describe the behavior of the circuit is described and the system is good, and in the aspects of language readability and hierarchical structure design, demonstrated strong vitality and potential applications. This design introduced the design of elevator controller based on VHDL language, and gives the circuit synthesis and simulation. The controller to follow the direction of the principle of priority, operation provides 6 floors of the passenger service and more user instructions for elevator. Through the program debugging and running the simulation, results show that, the design can be done: elevator floor indicator, elevator running direction, overload alarm, fault alarm etc.. Keywords: controller, EDA, elevator 基于 FPGA 的電梯控制器設(shè)計(jì) 第 5 頁(yè) 共 31 頁(yè) 第 1 章 緒論 選題背景 隨著科學(xué)技術(shù)的發(fā)展、近年來(lái),我國(guó)的電梯生產(chǎn)技術(shù)得到了迅速發(fā)展.一些電梯廠也在不斷改進(jìn)設(shè)計(jì)、修改工藝。因此對(duì)電梯控制技術(shù)進(jìn)行研究,尋找適合我國(guó)老式電梯的改 造方法具有十分重要的意義。設(shè)計(jì)者可以利用 HDL 程序來(lái)描述所希望的電路系統(tǒng),規(guī)定其結(jié)構(gòu)性和電路的行為方式;然后利用 EDA 工具將此程序變成能控制場(chǎng)效應(yīng)可編程門陣列( Field Programmable Gate Array) /復(fù)雜可編程邏輯器件( Complex Programmable Logic Device)內(nèi)部結(jié)構(gòu)并實(shí)現(xiàn)相應(yīng)邏輯功能的門級(jí)或更底層的結(jié)構(gòu)網(wǎng)表文件和下載文件。 FPGA 可做其它全定制或半定制 ASIC 電路的中試樣片。掉電后, FPGA 恢復(fù)成白片,內(nèi)部邏輯關(guān)系消失,因此, FPGA能夠反復(fù)使用。本章在 VHDL 的特性之后,從這兩個(gè)角度簡(jiǎn)要介紹VHDL 的語(yǔ)法基礎(chǔ)。 1993 年該標(biāo)準(zhǔn)增修為 IEEE1164 標(biāo)準(zhǔn)。 (二)可移植性 VHDL 語(yǔ)言是一個(gè)標(biāo)準(zhǔn)語(yǔ)言,其設(shè)計(jì)描述可以為不同的 EDA 工 具支持。使其在任何大系統(tǒng)的設(shè)計(jì)中,隨時(shí)可對(duì)設(shè)計(jì)進(jìn)行仿真模擬。 這種機(jī)構(gòu)巧妙地應(yīng)用電梯廂(包括乘客)的重力勢(shì)能和配重的重力勢(shì)能的相互轉(zhuǎn)換,達(dá)到節(jié)約能源的目的。 方案一:采用金屬接近開關(guān)檢測(cè)電梯層數(shù)。所以方案二更好。從亮度和成本考慮,本系統(tǒng)選擇方案二。 方案二:使用變頻器驅(qū)動(dòng)電機(jī),隨著電力電子技術(shù)和微電子技術(shù)的發(fā)展,交流調(diào) 速技術(shù)取得了巨大的發(fā)展。 2)信號(hào)存儲(chǔ)模塊 電梯控制器的請(qǐng)求輸入信號(hào)有 27 個(gè)(電梯外有 9個(gè)上升請(qǐng)求和 9 個(gè)下降請(qǐng)求的用戶輸入端口,電梯內(nèi)有 9 個(gè)請(qǐng)求用戶輸入端口),由于系統(tǒng)對(duì)內(nèi)、外請(qǐng)求沒(méi)有設(shè)置優(yōu)先級(jí),各樓層的內(nèi)、外請(qǐng)求信號(hào)被采集后可先進(jìn)行運(yùn)算,再存到存儲(chǔ)器內(nèi)。其模塊電路如圖 2所示: 基于 FPGA 的電梯控制器設(shè)計(jì) 第 15 頁(yè) 共 31 頁(yè) 1 2 3 4 5 6ABCD654321DCBAT i t l eN u m be r R e v i s i o nS i z eBD a t e : 2 S e p 2 0 0 8 S he e t o f F i l e : C : \ D oc u m e n t s a nd S e t t i ng s \ A d m i n i s t r a t o r \ 桌面 \8 月 26 改板電梯 \8 月 26 改板電梯 .d d bD r a w n B y:4MC1 3 0pC2 3 0pV C CR01kR14 7k11223344S09 10 115 6 71 2 3l e d 0 l e d 1 l e d 2 l e d 3 l e d 4 l e d 5 l e d 6 l e d 7R D 11KR D 21KR D 31KR D 41KR D 51KR D 61KR D 71KD0 D1 D2 D3 D4 D5 D6 D7R D 01KR21kL E DV C CR31 0KR41 0KR51 0KR61 0KR71 0KR81 0KV C CV C C13 14 15 161284R91 0KR 1 01 0Kl e d 8 l e d 9 l e d 10 l e d 11 l e d 12 l e d 13 l e d 14 l e d 15RC01KRC11KRC21KRC31KRC41KRC51KRC61KRC71KC0 C1 C2 C3 C4 C5 C