I2C clock specifications的时钟是100 me,我需要在400 the下运行它,所以为了得到400 the的时钟,我除以100 me/(2^8)=390625(接近400 the)(请告诉我一个更好的时钟分频方式)这里8是no。因此,我制作了一个计数器(8减到0),并将它的第8位(索引)作为i2c通信进程(VHDL语言)的时钟。请指导我如何生成所需的时钟。谢谢
signal count:std_logic_vector(8 downto 0);
signal sign:std_logic;
process(clk,rst)
begin
if rst='1' then
count<=(others=>'0');
elsif rising_edge(clk) and rst='0' then
count<=count+1;
end if;
sign<=count(8);
end process;发布于 2021-10-12 07:26:36
你可以将时钟除以250,得到400 the的时钟。大致是这样的:
signal count : integer range 0 to 250;
signal clk400 : std_logic;
process (clk100, rst)
begin
if rst ='1' then
count <= 0;
clk400 <= '0';
elsif rising_edge(clk100) then
count <= count +1;
if count = 249 then
count <= 0;
clk400 <= not clk400;
end if;
end if;
end process;或者,根据您的FPGA和工具,您可以使用PLL。
https://stackoverflow.com/questions/69535827
复制相似问题