zoukankan      html  css  js  c++  java
  • fpga延时程序编写

    //工匠小建 延时计数 100微妙计数 50M*0.00001-1 (个人理解:1s中50M次动作。那么100us多少次动作。做完这些动作就是延时)
    parameter delay_100us=16'd49_999;

    /************************************/

    reg [15:0] count_1ms;
    reg star_dleay;

    /************************************/
    //延时模块 100us后开始工作
    always@(posedge i_i_clk or negedge i_rst)

    if( !i_rst )
    count_1ms <= 16'd0;
    else if( star_dleay && count_1ms == delay_100us)
    count_1ms <= 16'd0;
    else if( star_dleay )
    count_1ms <= count_1ms + 1'b1;
    else if( !star_dleay )
    count_1ms <= 16'd0;


    /****************************************/


    reg [9:0]Count_MS;

    always@(posedge i_i_clk or negedge i_rst)
    if( !i_rst )
    Count_MS <= 10'd0;
    else if( star_dleay && count_1ms == delay_100us)
    Count_MS <= Count_MS + 1'b1;
    else if( !star_dleay )
    Count_MS <= 10'd0;

    /******************************************/

    这个程序的应用 只要控制stardelay 就开始计时,延时时间可任意设定(根据对晶振的计算)

    工匠小建--希望对大家有帮助

  • 相关阅读:
    CF1063A Oh Those Palindromes
    洛谷——P1640 [SCOI2010]连续攻击游戏
    洛谷—— P1268 树的重量
    洛谷——P4932 浏览器
    洛谷——P1627 [CQOI2009]中位数
    洛谷——P4109 [HEOI2015]定价
    CF438D The Child and Sequence
    AFO
    About me & 留言板
    The real universe
  • 原文地址:https://www.cnblogs.com/lsjjob/p/5099015.html
Copyright © 2011-2022 走看看