生活随笔
收集整理的這篇文章主要介紹了
触摸键控制LED
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
觸摸鍵控制LED
原理圖
程序如下
`timescale 1ns / 1ps
module touch_led(input sys_clk,input sys_rst_n,input touch_key,output reg led);reg d0;reg d1;wire touch_en;always@(posedge sys_clk or negedge sys_rst_n)
beginif(!sys_rst_n)begind0 <= 1'b0;d1 <= 1'b1;endelsed0 <= touch_key;d1 <= d0;
end
assign touch_en = ~d1 && d0;always@(posedge sys_clk or negedge sys_rst_n)
beginif(!sys_rst_n)led <= 1'b1;else beginif(touch_en)led <= ~led;endend
endmodule</
總結
以上是生活随笔為你收集整理的触摸键控制LED的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。