- always @(posedge CLOCK_50 or negedge reset_n)
- begin
- if(!reset_n)
- begin
- counter <= 0;
- LED[0] <= 0;
- end
- else begin
- counter <= counter+1;
- PWM_width <= PWM_width[5:0]+ PWM_adj;
- if(counter[26])
- begin
- PWM_adj <= counter[25:20];
- end
- else begin
- PWM_adj <= ~ counter[25:20];
- end
- LED[0] <= ~PWM_width[6];
- LED[1] <= ~PWM_width[6];
- LED[2] <= ~PWM_width[6];
- LED[3] <= ~PWM_width[6];
- LED[4] <= PWM_width[6];
- LED[5] <= PWM_width[6];
- LED[6] <= PWM_width[6];
- LED[7] <= PWM_width[6];
- end
- end
暂无评论,赶紧抢沙发吧