实验室板子soc-de1自带的7928芯片,下面记录一下它的参数

吞吐速率 : 1MSPS

吞吐速率 : 是指ADC器件单位时间内能处理的任务数或输出结果的数量。单位:SPS(Samples per second)

通信协议·:SPI协议   四根线 SCLK  DIN  SOUT  CS_N

引脚配置和功能描述:

SCLK    串行时钟

DIN       数据输入,在SCLK的下降沿写入寄存器

CS_n    片选控制,在低电平时,数据有效

REFin    AD7928的基准电压输入。

Vin0至Vin7  模拟输入0到模拟输入7.通过控制ADD2到ADD0来选择通道,输入电压范围0~REFin 或者 0~2REFin

DOUT    数据输出。AD7928的转换结果在SCLK的下降沿逐个输出。输出的数据流包含一个前置的0和3个地址位

       然后是12个转换数据位(MSB优先)。输出的数据可以是二进制或者二进制的补码。

控制寄存器

每次数据传输需要16个串行时钟,只有在前12个SCLK的下降沿,提供的信息才会写入被控制的寄存器。MSB在前

WRITE :  1 后续的11位写入寄存器     0 则不写入

SEQ,SHADOW :  0 0 的话,序列功能未被使用,每次转换的通道由上一次的通道地址ADD2 ~ ADD0决定。

PM1,PM0   :    1  1 正常工作

RANGE      :  0 则模拟输入的范围为 0 ~ 2XREFin        1则0~REFin

CODING    :  0为二进制的补码方式,1则标准的二进制

下面给AD9854的时序控制图

驱动程序

/*-----------------------------------------------------------------------

Date                :        2017-08-01
Description : Design for AD7928. -----------------------------------------------------------------------*/ module ad7928
(
//global clock
input clk, //system clock
input rst_n, //sync reset //ad7928 interface
output reg sclk_ad,
output reg din, //逻辑输入
input dout, //逻辑输出
output reg cs_n, //片选使能端 //user interface output reg [:] ad_data // ); //--------------------------------
//Funtion : 10M 分频
parameter CLK_10M = 'd5;
reg [:] cnt_clk; always @(posedge clk or negedge rst_n)
begin
if(!rst_n)
cnt_clk <= 'd0;
else if(cnt_clk >= CLK_10M - 'b1)
cnt_clk <= 'd0;
else
cnt_clk <= cnt_clk + 'b1;
end wire clk_10m_value = (cnt_clk >= CLK_10M - 'b1) ? 1'b1 : 'b0; //--------------------------------
//Funtion : ad7928 参数定义
parameter SPI_DATA = 'b100_000_11_0001_0000;
parameter ONE_S = 'd10;//_000_000; //--------------------------------
//Funtion : spi state
reg [:] spi_state;
reg [:] cnt_wait;
reg [:] ad_ser_data;
always @(posedge clk or negedge rst_n)
begin
if(!rst_n)
begin
spi_state <= 'd0;
ad_ser_data <= 'd0;
cnt_wait <= 'd0;
sclk_ad <= 'd0;
din <= 'd0;
cs_n <= 'd0;
end
else if(clk_10m_value)
begin
case(spi_state)
//上电等待
'd0 :
begin
if(cnt_wait >= ONE_S - 'b1)
spi_state <= 'd1;
else
cnt_wait <= cnt_wait + 'b1;
end 'd1 :
begin
sclk_ad <= 'b1;
cs_n <= 'b1;
spi_state <= 'd2;
ad_ser_data <= 'd0;
end 'd2 :
begin
cs_n <= 'b0;
spi_state <= 'd3;
end
//
'd3 :
begin
din <= SPI_DATA[];
spi_state <= 'd4;
end 'd4 :
begin
sclk_ad <= 'b0;
spi_state <= 'd5;
end
//
'd5 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd6;
end 'd6 :
begin
sclk_ad <= 'b0;
spi_state <= 'd7;
end
//
'd7 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd8;
end 'd8 :
begin
sclk_ad <= 'b0;
spi_state <= 'd9;
end
//
'd9 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd10;
end 'd10 :
begin
sclk_ad <= 'b0;
spi_state <= 'd11;
end
//
'd11 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd12;
end 'd12 :
begin
sclk_ad <= 'b0;
spi_state <= 'd13;
end
//
'd13 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd14;
ad_ser_data <= dout; //[7]
end 'd14 :
begin
sclk_ad <= 'b0;
spi_state <= 'd15;
ad_ser_data <= ad_ser_data << 'b1;
end
//
'd15 :
begin
sclk_ad <= 'b1;
ad_ser_data <= ad_ser_data + dout; //[6]
din <= SPI_DATA[];
spi_state <= 'd16;
end 'd16 :
begin
sclk_ad <= 'b0;
spi_state <= 'd17;
ad_ser_data <= ad_ser_data << 'b1;
end
//
'd17 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd18;
ad_ser_data <= ad_ser_data + dout; //[5]
end 'd18 :
begin
sclk_ad <= 'b0;
spi_state <= 'd19;
ad_ser_data <= ad_ser_data << 'b1;
end
//
'd19 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd20;
ad_ser_data <= ad_ser_data + dout; //[4]
end 'd20 :
begin
sclk_ad <= 'b0;
spi_state <= 'd21;
ad_ser_data <= ad_ser_data << 'b1;
end
//
'd21 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd22;
ad_ser_data <= ad_ser_data + dout; //[3]
end 'd22 :
begin
sclk_ad <= 'b0;
spi_state <= 'd23;
ad_ser_data <= ad_ser_data << 'b1;
end
//
'd23 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd24;
ad_ser_data <= ad_ser_data + dout; //[2]
end 'd24 :
begin
sclk_ad <= 'b0;
spi_state <= 'd25;
ad_ser_data <= ad_ser_data << 'b1;
end
//
'd25 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd26;
ad_ser_data <= ad_ser_data + dout;//[1]
end 'd26 :
begin
sclk_ad <= 'b0;
spi_state <= 'd27;
ad_ser_data <= ad_ser_data << 'b1;
end
//
'd27 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd28;
ad_ser_data <= ad_ser_data + dout;//[0]
end
'd28 :
begin
sclk_ad <= 'b0;
spi_state <= 'd29;
end
//
'd29 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd30;
end
'd30 :
begin
sclk_ad <= 'b0;
spi_state <= 'd31;
end
//
'd31 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd32;
end
'd32 :
begin
sclk_ad <= 'b0;
spi_state <= 'd33;
end
//
'd33 :
begin
sclk_ad <= 'b1;
din <= SPI_DATA[];
spi_state <= 'd34;
end 'd34 :
begin
sclk_ad <= 'b0;
spi_state <= 'd1;
end default : ;
endcase
end
end //--------------------------------
//Funtion : ad_data
//reg [7:0] ad_data; always @(posedge clk or negedge rst_n)
begin
if(!rst_n)
ad_data <= 'd0;
else if(spi_state == 'd34)
ad_data <= ad_ser_data;
end endmodule

AD7928的更多相关文章

随机推荐

  1. Cordova各个插件使用介绍系列(五)—$cordovaGeolocation获取当前位置

    详情请看:http://www.ncloud.hk/%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/cordova-5-cordovageolocation/ $cordov ...

  2. EJB系列 - 会话Bean基础知识

    本人博客文章网址:https://www.peretang.com/basic-knowledge-of-session-bean/ 什么是会话 有限的时间周期内,客户端和服务器之间的连接 为什么使用 ...

  3. Xamarin开发笔记—设备类&第三方弹窗的使用和注意事项

    一.设备类是Xamarin重要开发组成部分,下面介绍一下设备类的主要用法: //唤醒打电话 Device.OpenUri(new Uri("tel:180xxxxxxxx")); ...

  4. B. Karen and Coffee

    B. Karen and Coffee time limit per test 2.5 seconds memory limit per test 512 megabytes input standa ...

  5. java源码学习(五)LinkedList

    LinkedList [TOC] 一.定义 public class LinkedList<E> extends AbstractSequentialList<E> imple ...

  6. springboot(十四):springboot整合shiro-登录认证和权限管理

    这篇文章我们来学习如何使用Spring Boot集成Apache Shiro.安全应该是互联网公司的一道生命线,几乎任何的公司都会涉及到这方面的需求.在Java领域一般有Spring Security ...

  7. Gist - ES6 Iterator

    Introduction Iterator is one of the most common design modes in daily development. Let's explore the ...

  8. laydate时间插件更换皮肤

    <script> ;!function(){ laydate.skin('molv'); laydate({ elem: '#demo' }) }();</script>

  9. 用mybatis实现dao的编写或者实现mapper代理

    一.mybatis和hibernate的区别和应用场景hibernate:是一个标准的ORM框架(对象关系映射).入门门槛较高的,不需要写sql,sql语句自动生成了.对sql语句进行优化.修改比较困 ...

  10. Spring Boot1.5.4 连接池 和 事务

    原文:https://github.com/x113773/testall/issues/10 默认连接池---spring Boot中默认支持的连接池有Tomcat.HikariCP .DBCP . ...