导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→虚心求教:用 FPGA 做高速 AD 转换时突然终止??

* 40309: 虚心求教:用 FPGA 做高速 AD 转换时突然终止??

   yang547 
yang547发表的帖子 

 虚心求教:用 FPGA 做高速 AD 转换时突然终止??
向各位大侠紧急求救!
打算让 fpga 接受到 start 信号后控制 adc 一次完成 2K 个数据的采集并送入双口 ram ,但有时会中途停止,不知道是不是程序上的问题?希望高手不吝赐教!(副VHDL程序)

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

entity ad_vhd_final1 is
port(reset : in std_logic;
     start : in std_logic;
     clk   : in std_logic;
     data_in : in std_logic_vector(7 downto 0);
     data_out: out std_logic_vector(7 downto 0);
     addr  : out std_logic_vector(10 downto 0);
     flag  : out std_logic;
     encode_out : out std_logic;
     ce    : out std_logic;
     we       : out std_logic;
     oe    : out std_logic);
end ad_vhd_final1;

architecture a of ad_vhd_final1 is
signal encode : std_logic;
signal data : std_logic_vector(7 downto 0);
signal count: std_logic_vector(10 downto 0);
type states is (s0,s1,s2,s3);
signal state : states;
begin
    encode_out   <= encode;
    data_out   <= data;
    addr   <= count;
    
----------------------------------- ad ouput data latch ----------------------------------
    process(reset,encode)
    begin
        if reset='1' then data   <= "00000000";
        elsif encode'event and encode='0' then data   <= data_in;
        end if;
    end process;
----------------------------------- state generate ---------------------------------------    
    process(reset,start,clk)
    begin
        if reset='1' then state   <= s0;
        elsif clk'event and clk='0' then 
            case state is
            when s0 =>   if start='0' then state   <= s1;
                       else state   <= s0;
                       end if;
            when s1 =>   count   <= "00000000000";
                       if start='1' then state   <= s2; 
                       else state   <= s1;
                       end if;
            when s2 =>   if count  <2047 then count   <= count + 1;
                                          state   <= s2;
                       else state   <= s3;
                       end if;
            when s3 =>   if start='0' then state   <= s1;
                       else state   <= s3;
                       end if;
            end case;
        end if;
    end process;
----------------------------------- signal value -----------------------------------------
    flag   <= '1' when (state=s3) else
            '0';
    ce   <=  clk when (state=s2) else
          '1';
    oe   <= '1';
    we   <=  clk when (state=s2) else
          '1';
    encode   <= clk when (state=s2) else
              '0';

end a;


发表时间:2003年8月18日14:55:50

  
回复该帖

本主题共有 3 帖,分页:>>>>>该主题的所有内容[3]条

 *树形目录 只列出部分跟帖的标题以及简单的摘要信息 该主题的部分跟帖如下:

  40347.[详细]程序本身没有问题,是不是你的时钟太高了?这样你的状态机就不稳定还有,你这个模块式结合外围电路的,是..
摘要:程序本身没有问题,是不是你的时钟太高了?这样你的状态机就不稳定 还有,你这个模块式结合外围电路的,是不是外围电路的干扰,比如reset等等 你再看看吧,程序本身没毛病......(161字)
- [imwj][1049次] 2003年8月18日

  40384.[详细]谢谢这位大哥指教!我也觉得可能是 RESET 的问题。用示波器的逻辑分析功能观..
摘要:谢谢这位大哥指教! 我也觉得可能是 RESET 的问题。 用示波器的逻辑分析功能观察后,发现采样中断后回到 S0,有两种可能: 1。由于电路干扰,错误的另程序复位。 2。......(365字)
- [yang547][975次] 2003年8月19日

[上一篇帖子]:谢谢!能给些资料吗?[quote][b]以下是引用[i]guest在2003-8-18 1
[下一篇帖子]:PDIUSBD12 philips的呵呵~