⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fen1250.vhd

📁 用硬件VHDL语言实现的串口通信的试验代码
💻 VHD
字号:
----------------------------------------------------
--芳元电子工作室,版权所有,严禁用于商业用途
--实体名:fen1250
--功  能:波特率发生器
--接  口:clk -时钟输入,为24MHz,波特率为4800,由于
--        时钟为波特率的4倍,所以分频系数为
--            24000000/4800/4=1250
--        qout-波特率输出
--作  者:Justin Xu
--日  期:2005-06-21
----------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;

entity fen1250 is
port
(clk  : in  std_logic;
 qout : out std_logic
);
end fen1250;

architecture behave of fen1250 is
constant counter_len:integer:=1249;
begin
  process(clk)
  variable cnt:integer range 0 to counter_len;
  begin
    if clk'event and clk='1' then
       if cnt=counter_len then
          cnt:=0;
       else
          cnt:=cnt+1;
       end if;
       
       case cnt is
         when 0 to counter_len/2=>qout<='0';
         when others=>qout<='1';
       end case;
    end if;
  end process;
end behave;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -