ep240--all

在这里插入图片描述
openlight

module openlight(sh,q,clk);
		input sh;
		input clk;
		output q;
		
		reg q;
		reg[10:0] counter;
		
		always@(posedge clk ) //sh=550us period
			begin
				if(sh==1'b0)
					begin
						counter<=11'b0;
						q<=1'b0;
					end
				else
					begin
						counter<=counter+1'b1;  //640ns
						if(counter<11'd500)
							begin
								q<=1'b0;
							end
						else if(counter<11'd858)           //550/0.64=860count 
							begin
								q<=1'b1;
							end
						else
							begin
								q<=1'b0;
								counter<=11'b0;
							end
					end
			end
		
endmodule
		


adclk

module ADCLK(clk,q,en); //en is fai2 
	input clk;// 50m
	input en;
	output q;
	reg q;
	reg[3:0] counter;
	always@(posedge clk)
		begin
			if(en==1'b1)
				begin
					q<=1'b0;
					counter<=4'b0;
				end
			else 
				begin
					if(counter<4'd2)
						begin
							counter<=counter+1'b1;
							q<=1'b1;
						end
					else
						begin
							q<=1'b0;
							counter<=counter;
						end					
				end
		end
endmodule

autoint

module autoint(fai1en,fai1,q);
		input fai1;
		input fai1en;
		output q;
		reg q;
		reg[11:0] counter;
		
		always@(posedge fai1 or negedge fai1en)
			begin
				if(fai1en==1'b0)
					begin
						counter<=12'b0;
						
					end
				else
					begin
						counter<=counter+1'b1;
						if(counter<12'd2150)
							begin
								
								q<=1'b0;
							end
						else if((counter>12'd2149) && (counter<12'd2350) ) //200*160ns=32us time for stm32
							begin
								q<=1'b1;  //          auto  clear   ,when finsh,q=1,and wait for 2us
							end
						else
							begin
								q<=1'b0;
								counter<=12'b0;
							end
					end
			end



endmodule

statusccd

module statusccd(clk,sh,fai1,fai1en,light,busy);
	input clk; // clk50m 
	//output[7:0] q; // output led 
	output sh;
	output light;
	output fai1;
	output fai1en;
	output busy;
	reg busy;
	reg light;
	reg sh;
	reg fai1;
	reg fai1en;
	//reg[7:0] q;
	reg[15:0] counter;
	reg[3:0] status;
	always@(posedge clk)  //20ns
		begin
			
			if(counter<16'd27501)   //max period about 550 us 
				begin
					
					counter<=counter+1'b1;
					
				end
			else                    // loop
				begin
					counter<=16'd0;
				end
			//*******************************************
			if((counter>16'd1) && (counter<16'd7))// 120ns for reset all singal
				begin
					status<=4'b0001;
					
				end
			else if((counter>16'd6) && (counter<16'd17)) // 100 ns for fai1 before SH
				begin
					status<=4'b0010;
				end
			else if((counter>16'd16) && (counter<16'd85)) // 1300 ns for  SH is high 66*20=1320ns
				begin
					status<=4'b0011;
				end
			else if((counter>16'd84) && (counter<16'd107)) // 520 ns for  fai1 goes to low before SH
				begin
					status<=4'b0100;
					
				end
			else if((counter>16'd106) && (counter<16'd17307)) // 344us ns for  SH is low to shift data to OS
				begin                                          // 216us for led light
					status<=4'b0101;
					
				end
			else if((counter>16'd17306) && (counter<16'd28105)) // 216us for low ,waiting for next loop
				begin
					status<=4'b0110;  //ide time 
					
					
				end
			else
				begin
					status<=4'b0000;
				end
		end
//--------------------------------------------------------------------------------------------
		always@(posedge clk)
			begin
				case(status[3:0])
				4'b0000:begin
							sh<=1'b0;
							fai1<=1'b0;
							fai1en<=1'b0;
							light<=1'b0;//   turn off light
							busy<=1'b0;
						end
				4'b0001:begin
							sh<=1'b0;
							fai1<=1'b0;
							fai1en<=1'b0;
							//light<=1'b0;//   turn off light
							//busy<=1'b0;
						end
				4'b0010:begin
							fai1<=1'b1;
							fai1en<=1'b1;
						end
				4'b0011:begin
							sh<=1'b1;
							fai1<=1'b1;
							fai1en<=1'b1;
						end
				4'b0100:begin
							sh<=1'b0;
							fai1<=1'b1;
							fai1en<=1'b1;
						end
				4'b0101:begin
							light<=1'b1;//   turn on light
							fai1<=1'b0;
							fai1en<=1'b1;
						end
				4'b0110:begin
							sh<=1'b0;
							fai1<=1'b0;
							fai1en<=1'b1;
							busy<=1'b1;
							light<=1'b0;//   turn off light
						end
				default:begin
							sh<=1'b0;
							fai1<=1'b0;
							fai1en<=1'b0;
							busy<=1'b0;
							light<=1'b0;//   turn off light
						end
				endcase

			end
endmodule

eom

module eom(clk,d77,ccdlight,meastime);
	input clk;//clk50m
	input d77;// ad msb d7
	input ccdlight; //light time 
	output meastime;// test time 
	reg meastime; //reg
	reg[15:0] cnt; //count time
	
	always@(posedge clk)
	begin
	if(ccdlight==1'b0)
		begin
			cnt<=16'b0;
			meastime<=1'b0;
		end
	else if((cnt>10'd270)&&(cnt<16'd16400)) 
		begin
			meastime<=1'b1;
		end
	else
		begin
			meastime<=1'b0;
			cnt<=cnt+1'b1;
	    end
	    
	 end

endmodule

RS

module RS(clk,q,en); //en is fai2 
	input clk;// 50m
	input en;
	output q;
	reg q;
	reg[1:0] counter;
	always@(posedge clk)
		begin
			if(en==1'b0)
				begin
					q<=1'b0;
					counter<=2'b0;
				end
			else
				begin
					counter<=counter+1'b1;
					if(counter<2'd1)
						begin
							
							q<=1'b0;
						end
					else if( counter<2'd3)
						begin
							
							q<=1'b1;
						end
					else
						begin
							q<=1'b0;
						end
					
			
				end
		end

endmodule

CP

module CP(clk,q,en); //en is fai2 
	input clk;// 50m
	input en;
	output q;
	reg q;
	reg[1:0] counter;
	always@(posedge clk)
		begin
			if(en==1'b0)
				begin
					q<=1'b0;
					counter<=2'b0;
				end
			else
				begin
					counter<=counter+1'b1;
					if(counter<2'd2)
						begin
							
							q<=1'b0;
						end
					else if(counter<2'd3)
						begin
							q<=1'b1;
						end
					else
						begin
							
							q<=1'b0;
						end
					
			
				end
		end

endmodule
MAX32660-TQFN是一种小尺寸的芯片封装,适用于MAX32660微控制器。这种封装的引脚布局为TQFN,封装尺寸为5mm x 5mm,引脚间距为0.5mm。MAX32660-TQFN芯片在温度范围-40°C至115°C内工作,适用于各种应用场景。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [MAX96705COAXEVKIT-MAX96711COAXEVKIT.pdf](https://download.csdn.net/download/lhf_1230/12548311)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [stm32f103c8t6-max31865-pt100测温](https://download.csdn.net/download/worf__/11572321)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [TQFN20-EP_5x5 三维3D封装,MAX31865 PCB封装](https://download.csdn.net/download/qq_21748809/24871509)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值