新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > FPGA設計的SPI自動發送模塊技術

        FPGA設計的SPI自動發送模塊技術

        作者: 時間:2010-06-20 來源:網絡 收藏

        begin
        if _WR='1' then
        counter8=10001;
        elsif LCD_SCLSS='1' and LCD_SCLSS'event then
        if counter8>0 then
        counter8=counter8-1;
        LCD_SCLSS8=LCD_SCLSSS;
        end if;
        end if;
        end process;
        --16bit 時鐘采集生成
        counter16_u:process(LCD_SCLSS)
        begin
        if _WR='1' then
        counter16=100001;
        elsif LCD_SCLSS='1' and LCD_SCLSS'event then
        if counter16>0 then
        counter16=counter16-1;
        LCD_SCLSS16=LCD_SCLSSS;
        end if;
        end if;
        end process;
        --24bit SPI 時鐘采集生成
        counter24_u:process(LCD_SCLSS)
        begin
        if SPI_WR='1' then
        counter24=110011;
        elsif LCD_SCLSS='1' and LCD_SCLSS'event then
        if counter24>0 then
        counter24=counter24-1;
        if (counter24=000000)or(counter24=000001)or
        (counter24=110011)or(counter24=000010)then
        LCD_SCLSS24='0';
        else
        LCD_SCLSS24=LCD_SCLSSS;
        end if;
        end if;
        end if;
        end process;
        --8bit 數據移位
        DB8BIT_U:process(shift,SPI_WR,DBINOUTS)
        begin
        if SPI_WR='1' then
        DB8BIT_reg=DBINOUTS(7 downto 0);
        else
        if shift='1' and shift'event then
        LCD_SDIS_8BIT=DB8BIT_reg(0);
        DB8BIT_reg(6 downto 0)=DB8BIT_reg(7 downto 1);
        end if;
        end if;
        end process;
        --16bit 數據移位模塊
        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 shift'event then
        LCD_SDIS_16BIT=DB16BIT_reg(0);
        DB16BIT_reg(14 downto 0)=DB16BIT_reg(15 downto 1);
        end if;
        end if;
        end process;
        --24bit 數據移位模塊
        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 shift'event then
        LCD_SDIS_24BIT=DB24BIT_reg(0);
        DB24BIT_reg(22 downto 0)=DB24BIT_reg(23 downto 1);
        end if;
        end if;
        end process;
        end;

        本文引用地址:http://www.104case.com/article/151797.htm

        五、仿真波形圖



        六、編譯后資源占用情況

        七、結束語
        本文旨在給學習可編程的人們提供一個參考,起到拋磚引玉的作用。望閱讀過此文的讀者提供更好的方法,與所有的學習者共享,共勉!


        上一頁 1 2 下一頁

        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 怀远县| 永仁县| 任丘市| 沿河| 讷河市| 高州市| 洛南县| 井研县| 德州市| 龙海市| 鄂伦春自治旗| 玉门市| 安顺市| 潜山县| 平安县| 桐梓县| 金山区| 邛崃市| 巴彦县| 始兴县| 双城市| 临颍县| 福泉市| 米泉市| 兰溪市| 南昌县| 昆明市| 册亨县| 敦煌市| 焉耆| 休宁县| 东方市| 清水县| 华阴市| 黄大仙区| 五家渠市| 英吉沙县| 腾冲县| 浦北县| 龙海市| 赤城县|