Cyclone2 FPGA读写DAC_TLC5620实验Verilog逻辑源码Quartus工程文件 module DA_TLC5620 ( //input input sys_clk , //system clock; input sys_rst_n , //system reset, low is active; //output output reg DA_IO_CLK , output reg DA_LOAD , output reg DA_LDAC , output reg DA_OUT_DATA , output reg [7:0] LED ); //Reg define reg [6:0] div_cnt ; reg da_clk ; reg [4:0] ctrl_cnt ; reg [15:0] delay_cnt ; reg [ 7:0] analog_data ; //Wire define //************************************************************************************ //** Main Program //** //************************************************************************************ // counter used for div osc clk to da ctrl clk 50M/64 = 0.78Mhz always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) div_cnt <= 6'b0; else div_cnt <= div_cnt + 6'b1; end //gen da_clk always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) da_clk <= 1'b0 ; else if ( div_cnt <= 6'd31 ) da_clk <= 1'b1 ; else da_clk <= 1'b0 ; end // da ctrl signal gen // ctrl_cnt 0 - 32 is for da ctrl always @(posedge da_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) ctrl_cnt <= 5'b0; else ctrl_cnt <= ctrl_cnt + 5'b1; end always @(posedge da_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) DA_IO_CLK <= 1'b0; else if ( ctrl_cnt == 5'd6 || ctrl_cnt == 5'd8 || ctrl_cnt == 5'd10 || ctrl_cnt == 5'd12 || ctrl_cnt == 5'd14 || ctrl_cnt == 5'd16 || ctrl_cnt == 5'd18 || ctrl_cnt == 5'd20 || ctrl_cnt == 5'd22 || ctrl_
cyclone4 FPGA读写DAC芯片TLC5615实验Verilog逻辑源码Quartus11.0工程文件, FPGA型号为EP4CE6E22C8,可以做为你的学习设计参考。 module TLC5615_display (clk, //�ڲ�ʱ�� sclk, //TLC5615 sclkʱ�ӽ� din, //TLC5615 din���ݽ� cs); //TLC5615 csƬѡ input clk; output din; output cs; output sclk; reg din; reg cs; reg sclk; reg[3:0] count1,count2,count3; reg[9:0] din_reg; //10λ���ݼĴ��� initial //��ʼ�� begin cs=1; din=0; count1=0; count2=0; count3=0; din_reg=10'd250; //ʵ���߿��Ը�����Ҫ�޸�10Ϊ�������� end /*** sclk��Ƶ������Ϊ2.5MHz ***/ always@(posedge clk) begin if(count3==4'd9) begin sclk<=~sclk; count3<=0; end else count3=4'd12&&count1<4'd15) begin cs<=1; //���Ƭѡ count1<=count1+4'd1; end else if(count1==4'd15) begin count1<=0; end else begin cs<=0;