<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 一種高效定時(shí)器模塊的設(shè)計(jì)與實(shí)現(xiàn)

          一種高效定時(shí)器模塊的設(shè)計(jì)與實(shí)現(xiàn)

          作者: 時(shí)間:2011-03-25 來(lái)源:電子產(chǎn)品世界 收藏

            typedef enum{

          本文引用地址:http://www.ex-cimer.com/article/118088.htm

            FEEDWATCHDOG_300MS,

            INPUT_DETECT_MS,

            LIN_TIMESLOT_MS,

            SPEED_PULSE_ACCUMU_200MS,

            ALLDR_LOCK_200MS,

            ALARM_30S,

            IGNITION_OFF_60S,

            ...

            ...

            MAX_TIMER_NUM

            }TimerId;

            這樣,定義數(shù)組Timer TIMER[MAX_TIMER_NUM],在初始化中,TIMER [i].timer_id=i;之后通過(guò)TIMER[timer_id]即可枚舉某軟件定時(shí)器節(jié)點(diǎn)。

            定時(shí)器管理

            定時(shí)器管理包括啟動(dòng)、運(yùn)行、停止、重啟和讀取計(jì)時(shí)時(shí)間等功能[4],相應(yīng)API函數(shù)定義如下:

            void TimerStart(TimerId timer_id,ulong timeout,Bool cycle,uchar cnt_times);

            void TimerReStart(TimerId timer_id);

            void TimerTick(void);

            void TimerStop(TimerId timer_id);

            void TimerStall(TimerId timer_id);

            ulong TimerGet(TimerId timer_id);

            啟動(dòng)定時(shí)器函數(shù)如下:

            #dene RTIPERIOD 2

            void TimerStart(TimerId timer_id,ulong timeout,Bool cycle,uchar cnt_times)

            {

            TIMER[timer_id].timer_state=RUNNING;

            TIMER[timer_id].duration=0;

            TIMER[timer_id].timeout=timeout/RTIPERIOD;

            TIMER[timer_id].cycle=cycle;

            TIMER[timer_id].cnt_times=cnt_times;

            TIMER[timer_id].timer_id=timer_id;

            }



          評(píng)論


          相關(guān)推薦

          技術(shù)專(zhuān)區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();