- 1
- 2
- 3
- 4
- 5
基于FPGA设计的不同频率PWM蜂鸣器控制实验Verilog逻辑源码Quartus工程文件+文档说明
资料介绍
基于FPGA设计的不同频率PWM蜂鸣器控制实验Verilog逻辑源码Quartus工程文件+文档说明,用 PWM 控制蜂鸣器,用丌同频率的 pwm 让蜂鸣器发出丌一样的响声,FPGA型号Cyclone4E系列中的EP4CE6F17C8,Quartus版本17.1。
module buzzer_pwm_test(
input clk,
input rst_n,
input key1,
output buzzer
);
parameter IDLE = 0;
parameter BUZZER = 1;
wire button_negedge;
wire pwm_out;
reg[31:0] period;
reg[31:0] duty;
reg[3:0] state;
reg[31:0] timer;
assign buzzer = ~(pwm_out & (state == BUZZER));//buzzer low active
always@(posedge clk or negedge rst_n)
begin
if(rst_n == 1'b0)
begin
period <= 32'd0;
timer <= 32'd0;
duty <= 32'd429496729;
state <= IDLE;
end
else
case(state)
IDLE:
begin
if(button_negedge)
begin
period <= 32'd8590; //The pwm step value
state <= BUZZER;
duty <= duty + 32'd429496729;
end
end
BUZZER:
begin
if(timer >= 32'd12_499_999) //buzzer effictive time 250ms
begin
state <= IDLE;
timer <= 32'd0;
end
else
begin
timer <= timer + 32'd1;
end
end
default:
begin
state <= IDLE;
end
endcase
end
ax_debounce ax_debounce_m0
(
.clk (clk),
.rst (~rst_n),
.button_in (key1),
.button_posedge (),
.button_negedge (button_negedge),
.button_out ()
);
ax_pwm#
(
.N(32)
)
ax_pwm_m0(
.clk (clk),
.rst (~rst_n),
.period (period),
.duty (duty),
.pwm_out (pwm_out)
);
endmodule
部分文件列表
| 文件名 | 大小 | 
| 07.PWM蜂鸣器实验.pdf | |
| 07_buzzer_pwm_test/ | |
| 07_buzzer_pwm_test/ax301_ax4010_base.tcl | 1KB | 
| 07_buzzer_pwm_test/buzzer_pwm_test.jdi | |
| 07_buzzer_pwm_test/buzzer_pwm_test.qpf | |
| 07_buzzer_pwm_test/buzzer_pwm_test.qsf | 2KB | 
| 07_buzzer_pwm_test/buzzer_pwm_test.qws | |
| 07_buzzer_pwm_test/buzzer_pwm_test_assignment_defaults.qdf | |
| 07_buzzer_pwm_test/db/ | |
| 07_buzzer_pwm_test/db/.cmp.kpt | |
| 07_buzzer_pwm_test/db/buzzer_pwm_test.db_info | |
| ... | |
最新上传
- 
          21ic小能手 打赏15.00元 1天前 
- 
          21ic小能手 打赏10.00元 1天前 
- 
          21ic小能手 打赏15.00元 1天前 
- 
          21ic小能手 打赏15.00元 1天前 
- 
          21ic小能手 打赏10.00元 1天前 
- 
          21ic小能手 打赏15.00元 1天前 
- 
          21ic小能手 打赏10.00元 1天前 资料:PD协议mini加热台 
- 
          21ic小能手 打赏10.00元 3天前 资料:PID 蓝牙控制 小车 
- 
          21ic小能手 打赏10.00元 3天前 
- 
          21ic小能手 打赏15.00元 3天前 
- 
          21ic小能手 打赏15.00元 3天前 
- 
          21ic小能手 打赏15.00元 3天前 
- 
          21ic小能手 打赏15.00元 3天前 
- 
          21ic小能手 打赏15.00元 3天前 
- 
          21ic小能手 打赏15.00元 3天前 
- 
          小猫做电路 打赏310.00元 3天前 
- 
          gsy幸运 打赏310.00元 3天前 
- 
          zhengdai 打赏310.00元 3天前 
- 
          21ic小能手 打赏10.00元 3天前 
- 
          21ic小能手 打赏15.00元 3天前 
- 
          21ic小能手 打赏15.00元 3天前 
- 
          21ic下载 打赏21.00元 3天前 用户:玉落彼岸 
- 
          21ic下载 打赏310.00元 3天前 用户:zhengdai 
- 
          21ic下载 打赏310.00元 3天前 用户:小猫做电路 
- 
          21ic下载 打赏310.00元 3天前 用户:gsy幸运 
- 
          21ic下载 打赏210.00元 3天前 用户:w993263495 
- 
          21ic下载 打赏210.00元 3天前 用户:w178191520 
- 
          21ic下载 打赏130.00元 3天前 用户:jh0355 
- 
          21ic下载 打赏110.00元 3天前 用户:xzxbybd 
- 
          21ic下载 打赏60.00元 3天前 用户:w1966891335 
- 
          21ic下载 打赏60.00元 3天前 用户:kk1957135547 
- 
          21ic下载 打赏110.00元 3天前 用户:铁蛋锅 
- 
          21ic下载 打赏40.00元 3天前 用户:sun2152 
- 
          21ic下载 打赏40.00元 3天前 用户:xuzhen1 
- 
          21ic下载 打赏50.00元 3天前 用户:liqiang9090 
- 
          21ic下载 打赏60.00元 3天前 用户:jh03551 
- 
          21ic下载 打赏20.00元 3天前 用户:x15580286248 
- 
          21ic下载 打赏20.00元 3天前 用户:mulanhk 
- 
          21ic下载 打赏10.00元 3天前 用户:lcydusk 
- 
          21ic下载 打赏10.00元 3天前 用户:hp860629 
 
	



 
						 
全部评论(0)