有没有做过FPGA通过SPI对ADC进行读写操作?

2019-07-15 21:51发布

选了一款ADI公司的AD4000  2MSPS 16bitADC,看文档的时候 感觉里面给的时序很简单。
然后真正写的时候,就遇到好多麻烦。
我要使用AD4000的TURBO模式,因此,需要在开启ADC之后对ADC内的寄存器进行依次写操作,在写的同时也要读取数据。
我选择的使4线TURBO模式,无busy indicator。
有没有用过这款ADC的,可以把代码发给我借鉴一下?(673347062@qq.com




友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
3条回答
hwaming
1楼-- · 2019-07-16 02:56
你用什么语言呢,晚上回家给你发个vhdl的
hwaming
2楼-- · 2019-07-16 07:28
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

Entity AD_RD is

  Port (
                clk,io,st:in std_logic;
                sclk,ce:buffer std_logic;
                dat:out integer range 0 to 255
        );
End AD_RD;

Architecture main of AD_RD is
signal sp:integer range 0 to 31:=0;
signal sp2:integer range 0 to 1;
signal temst:std_logic:='0';
begin
process(clk)
        variable temdat:std_logic_vector(0 to 7):="00000000";

       
        begin

        if clk'event and clk='1' then
           case sp2 is
                        when 0 =>
                                if st='1' then
                                        temst <= '1';
                                        sp2<=1;
                                end if;
                        when 1 =>
                                if st='0' then
                                sp2<=0;
                                end if;
                        end case;
       
        if temst = '1' then
                sp<=sp+1;
                case sp is
                        when 0 =>
                                ce<='0';
                        when 5 =>
                                sclk <='1';
                                temdat(0):=io;
                        when 6 =>
                                sclk <='0';
                        when 7 =>
                                sclk <='1';
                                temdat(1):=io;
                        when 8 =>
                                sclk <='0';
                        when 9 =>
                                sclk <='1';
                                temdat(2):=io;
                        when 10 =>
                                sclk <='0';
                        when 11 =>
                                sclk <='1';
                                temdat(3):=io;
                        when 12 =>
                                sclk <='0';
                        when 13 =>
                                sclk <='1';
                                temdat(4):=io;
                        when 14 =>
                                sclk <='0';
                        when 15 =>
                                sclk <='1';
                                temdat(5):=io;
                        when 16 =>
                                sclk <='0';
                        when 17 =>
                                sclk <='1';
                                temdat(6):=io;
                        when 18 =>
                                sclk <='0';
                        when 19 =>
                                sclk <='1';
                                temdat(7):=io;
                        when 20 =>
                                sclk <='0';
                        when 21 =>
                                dat<= conv_integer(temdat);
                        when 22 =>
                                ce<='1';
                                temst <= '0';
                                sp<=0;
                        when others => null;
                end case;
        end if;
        end if;
end process;

end main;
zpccx
3楼-- · 2019-07-16 11:49
hwaming 发表于 2017-4-10 17:43
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

不好意思。。有没有verilog语言的

一周热门 更多>