![FPGA設(shè)計(jì)的SPI自動(dòng)發(fā)送模塊技術(shù)_第1頁(yè)](http://file4.renrendoc.com/view/383552d5141b19c49bc3bd30a74260e8/383552d5141b19c49bc3bd30a74260e81.gif)
![FPGA設(shè)計(jì)的SPI自動(dòng)發(fā)送模塊技術(shù)_第2頁(yè)](http://file4.renrendoc.com/view/383552d5141b19c49bc3bd30a74260e8/383552d5141b19c49bc3bd30a74260e82.gif)
![FPGA設(shè)計(jì)的SPI自動(dòng)發(fā)送模塊技術(shù)_第3頁(yè)](http://file4.renrendoc.com/view/383552d5141b19c49bc3bd30a74260e8/383552d5141b19c49bc3bd30a74260e83.gif)
![FPGA設(shè)計(jì)的SPI自動(dòng)發(fā)送模塊技術(shù)_第4頁(yè)](http://file4.renrendoc.com/view/383552d5141b19c49bc3bd30a74260e8/383552d5141b19c49bc3bd30a74260e84.gif)
![FPGA設(shè)計(jì)的SPI自動(dòng)發(fā)送模塊技術(shù)_第5頁(yè)](http://file4.renrendoc.com/view/383552d5141b19c49bc3bd30a74260e8/383552d5141b19c49bc3bd30a74260e85.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、【W(wǎng)ord版本下載可任意編輯】 FPGA設(shè)計(jì)的SPI自動(dòng)發(fā)送模塊技術(shù) 一、 SPI 接口應(yīng)用十分廣泛,在很多情況下,人們會(huì)用軟件模擬的方法來(lái)產(chǎn)生SPI 時(shí)序或是采用帶SPI 功能模塊的MCU。但隨著可編程邏輯技術(shù)的發(fā)展,人們往往需要自己設(shè)計(jì)簡(jiǎn)單的SPI 發(fā)送模塊。本文介紹一種基于FPGA 的將并行數(shù)據(jù)以SPI 串行方式自動(dòng)發(fā)送出去的方法。 二、關(guān)鍵字: VHDL、FPGA、SPI、串行數(shù)據(jù)輸出選擇模塊、移位脈沖產(chǎn)生模塊、SPI 時(shí)鐘采集信號(hào)和無(wú)相移的SPI 基準(zhǔn)時(shí)鐘產(chǎn)生模塊、SPI 時(shí)鐘輸出選擇模塊、8bit SPI 時(shí)鐘采集生成模塊、16bit SPI 時(shí)鐘采集生成模塊、24bit SPI
2、時(shí)鐘采集生成模塊、8bit 數(shù)據(jù)移位模塊、16bit 數(shù)據(jù)移位模塊、24bit 數(shù)據(jù)移位模塊。 三、功能框圖: SPI_MODES 為輸入模式選擇端口: -01is 8bit 傳輸模式 -10is 16bit 傳輸模式 -11is 24bit 傳輸模式 CLKS 為整個(gè)模塊的基準(zhǔn)時(shí)鐘 DBINOUTS 為并行數(shù)據(jù)輸入端口: -8bit 模式為DBINOUTS(7 downto 0) -16bit 模式為DBINOUTS(15 downto 0) -24bit 模式為DBINOUTS(23 downto 0) SPI_WR 為啟動(dòng)SPI 傳輸?shù)男盘?hào) 整個(gè)功能模塊可工作在 8bit、16bit、2
3、4bit SPI 猝發(fā)傳輸狀態(tài)。對(duì)其開(kāi)展軟件操作的步驟相當(dāng)簡(jiǎn)單: -此模塊軟件操作流程如下 -1、SPI_MODES=xx 設(shè)定串口操作模式 -2、DBINOUTS=xxxxxxxxxxxxxxxxxxxxxxxx 輸入要發(fā)射的數(shù)據(jù) -3、SPI_WR=0 -4、SPI_WR=1 -5、SPI_WR=0 -8bit 模式延時(shí)2*8*4*CLKS -16bit 模式延時(shí)2*1*CLKS -24bit 模式延時(shí)2*24*4*CLKS -6、DBINOUTS=xxxxxxxxxxxxxxxxxxxxxxxx 輸入下一個(gè)要發(fā)射的數(shù)據(jù) 四、VHDL 描述解讀 -以下描述的是一個(gè)SPI 自動(dòng)發(fā)射模塊 -在
4、很多情況下,人們會(huì)用軟件模擬的方法來(lái)產(chǎn)生SPI 時(shí)序 -這里采用硬件的方法,即使軟件操作更為簡(jiǎn)單,有提高了傳輸?shù)乃俣?-此模塊軟件操作流程如下 -1、SPI_MODES=xx 設(shè)定串口操作模式 -2、DBINOUTS=xxxxxxxxxxxxxxxxxxxxxxxx 輸入要發(fā)射的數(shù)據(jù) -3、SPI_WR=0 -4、SPI_WR=1 -5、SPI_WR=0 -8bit 模式延時(shí)2*8*4*CLKS -16bit 模式延時(shí)2*1*CLKS -24bit 模式延時(shí)2*24*4*CLKS -6、DBINOUTS=xxxxxxxxxxxxxxxxxxxxxxxx 輸入下一個(gè)要發(fā)射的數(shù)據(jù) library
5、ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity SPI_interface is port(CLKS :in std_logic; -基準(zhǔn)時(shí)鐘 LCD_SCLS :out std_logic;-SPI 發(fā)射時(shí)鐘,上升沿有效 LCD_SDIS :out std_logic;-SPI 數(shù)據(jù)串行輸出口 SPI_MODES :in std_logic_vector(1 downto 0); -串口操作模式選擇 -01is 8bit trans mode -10is 16bit trans mode -
6、11is 24bit trans mode SPI_WR :in std_logic; -啟動(dòng)串口發(fā)送信號(hào) DBINOUTS :in std_logic_vector(23 downto 0); -背發(fā)送數(shù)據(jù)的并行輸入口 -8bit mode use DBINOUTS(7 downto 0) -16bit mode use DBINOUTS(15 downto 0) -24bit mode use DBINOUTS(23 downto 0) end; architecture SPI_interface_behav of SPI_interface is signal DB8BIT_reg :
7、std_logic_vector(7 downto 0); -8bit 數(shù)據(jù)移位存放器 signal DB16BIT_reg :std_logic_vector(15 downto 0);-16bit 數(shù)據(jù)移位存放器 signal DB24BIT_reg :std_logic_vector(23 downto 0);-24bit 數(shù)據(jù)移位存放器 signal counter4 :std_logic_vector(3 downto 0); -移位脈沖產(chǎn)生計(jì)數(shù)器 signal counter4s :std_logic_vector(1 downto 0); -SPI 時(shí)鐘生成計(jì)數(shù)器 signal
8、counter8 :std_logic_vector(4 downto 0); -8bit SPI 時(shí)鐘控制計(jì)數(shù)器 signal counter16 :std_logic_vector(5 downto 0); -16bit SPI 時(shí)鐘控制計(jì)數(shù)器 signal counter24 :std_logic_vector(5 downto 0); -24bit SPI 時(shí)鐘控制計(jì)數(shù)器 signal shift :std_logic;-移位時(shí)鐘脈沖 signal LCD_SCLSS :std_logic;-SPI 時(shí)鐘采集信號(hào) signal LCD_SCLSSS :std_logic;-無(wú)相移的SP
9、I 基準(zhǔn)時(shí)鐘 signal LCD_SCLSS8 :std_logic;-8bit SPI 時(shí)鐘信號(hào) signal LCD_SCLSS16 :std_logic;-16bit SPI 時(shí)鐘信號(hào) signal LCD_SCLSS24 :std_logic;-24bit SPI 時(shí)鐘信號(hào) signal LCD_SDIS_8BIT :std_logic;-8bit SPI 數(shù)據(jù)信號(hào) signal LCD_SDIS_16BIT :std_logic;-16bit SPI 數(shù)據(jù)信號(hào) signal LCD_SDIS_24BIT :std_logic;-24bit SPI 數(shù)據(jù)信號(hào) begin -串行數(shù)據(jù)輸
10、出選擇模塊 u1:process(LCD_SDIS_8BIT,LCD_SDIS_16BIT,LCD_SDIS_24BIT,SPI_MODES) begin if SPI_MODES=01 then -選擇8bit 串行數(shù)據(jù)輸出 LCD_SDIS0 then counter80 then counter160 then counter24=counter24-1; if (counter24=000000)or(counter24=000001)or (counter24=110011)or(counter24=000010)then LCD_SCLSS24=0; else LCD_SCLSS2
11、4=LCD_SCLSSS; end if; end if; end if; end process; -8bit 數(shù)據(jù)移位模塊 DB8BIT_U:process(shift,SPI_WR,DBINOUTS) begin if SPI_WR=1 then DB8BIT_reg=DBINOUTS(7 downto 0); else if shift=1 and shiftevent then LCD_SDIS_8BIT=DB8BIT_reg(0); DB8BIT_reg(6 downto 0)=DB8BIT_reg(7 downto 1); end if; end if; end process;
12、 -16bit 數(shù)據(jù)移位模塊 DB16BIT_U:process(shift,SPI_WR,DBINOUTS) begin if SPI_WR=1 then DB16BIT_reg(15 downto 0)=DBINOUTS(15 downto 0); else if shift=1 and shiftevent then LCD_SDIS_16BIT=DB16BIT_reg(0); DB16BIT_reg(14 downto 0)=DB16BIT_reg(15 downto 1); end if; end if; end process; -24bit 數(shù)據(jù)移位模塊 DB24BIT_U:process(shift,SPI_WR,DBINOUTS) begin if SPI_WR=1 then DB24BIT_reg(23 downto 0)=DBINOUTS(23 downto 0); else if shift=1 and shiftevent then LCD_SDIS_24BIT=
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 車(chē)險(xiǎn)行業(yè)中的個(gè)性化需求挖掘與滿足
- 校園文化在培養(yǎng)學(xué)生道德品質(zhì)中的作用
- 科技賦能校園緊急避險(xiǎn)智慧教育探索
- 日常習(xí)慣養(yǎng)成與疾病預(yù)防的關(guān)系
- 2025年青果丸項(xiàng)目可行性研究報(bào)告
- 語(yǔ)文字詞教學(xué)課堂互動(dòng)藝術(shù)
- 2025年煤礦用風(fēng)筒項(xiàng)目可行性研究報(bào)告
- 2025年己唑醇項(xiàng)目可行性研究報(bào)告
- 2025年壓皺圍巾項(xiàng)目可行性研究報(bào)告
- 2025至2030年黑色聚酯薄膜項(xiàng)目投資價(jià)值分析報(bào)告
- (正式版)HG∕T 20644-2024 彈簧支吊架選用標(biāo)準(zhǔn)
- 項(xiàng)目采購(gòu)管理培訓(xùn)
- (高清版)DZT 0399-2022 礦山資源儲(chǔ)量管理規(guī)范
- 面試官面試技巧(精簡(jiǎn)版)課件
- 中央空調(diào)節(jié)能改造方案
- 高校圖書(shū)館服務(wù)
- 環(huán)衛(wèi)一體化運(yùn)營(yíng)方案
- 科技進(jìn)步類現(xiàn)代軌道交通綜合體設(shè)計(jì)理論與關(guān)鍵技術(shù)公
- 源代碼審計(jì)報(bào)告模板
- 干式變壓器知識(shí)大全課件
- 重大危險(xiǎn)源公示牌(完整)-2
評(píng)論
0/150
提交評(píng)論