DAC7744 FPGA控制 实际产品拷机测试过

	源码来自:https://bbs.21ic.com/icview-3013746-1-1.html

`timescale 1ns / 1ps
	//-----------------------------------------------------------
	module DAC_CTRL(
	input FCLK_50M,
	input rst_n,
	input [15:0] dac_dataout,
	output reg [1:0] DAC_ADR,
	output reg DAC_LOAD,
	output DAC_RST,
	output reg DAC_CS_N,
	output reg [15:0] DAC_DAT,
	//
	input [15:0] dac_value1,
	input [15:0] dac_value2,
	input [15:0] dac_value3,
	input [15:0] dac_value4
	);
	 
	//-----------------------------------------------------------
	//posedge is active for reset.
	assign DAC_RST = rst_n;
	//-----------------------------------------------------------
	
	
	//-----------------------------------------------------------
	reg [5:0] wr_state;
	always @(posedge FCLK_50M)
	begin
		if(~rst_n) wr_state <= 6'b0;
		else wr_state <= wr_state + 1;
	end
	//
	always @(posedge FCLK_50M)
	begin
		if(~rst_n) DAC_CS_N <= 1'b1;
		else
			begin
			case(wr_state)
			6'd1 :	begin 
						DAC_CS_N <= 1'b0 ; 
						DAC_ADR <= 2'b00; 
						DAC_LOAD <= 1'b0; 
						DAC_DAT <= dac_value1;
						end
			6'd2 : DAC_CS_N <= 1'b0 ;
			6'd3 : DAC_CS_N <= 1'b1 ; 
			6'd4 : begin DAC_CS_N <= 1'b1 ; DAC_LOAD <= 1'b1; end



 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值