亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? task.c

?? mcs51,2051,x86系列MCU
?? C
字號(hào):
/*
 *  ApBUILDER CODE FILE - Intel Corporation
 *
 *
 *  Purpose:      Task control code.
 *                TASK_CONTROL_BLOCK
 *
 *                The TCB functionality is a simple task scheduling system utilizing
 *                a single timer to provide multiple timed events at various intervals.
 *
 *                The system is flexible, but has the needed efficiency for embedded
 *                applications.
 *
 *                In main(), you will find the main task loop, where the task controller
 *                function iterates through the available task control lists.
 *                Each list contains TCB entries.  A TCB entry is composed of 2 items.
 *                First, is the Timer variable.  This is a 1 byte counter that is in 1
 *                of 3 states:
 *
 *                -1    Not Active
 *                0     Active
 *                >0    In the process of counting down to 0, prior to activation.
 *
 *                Second, is a function associated with the timer variable.  The function
 *                is executed each time the task controller iterates through the entry,
 *                and the assocoated timer is set to 0.  Each TCB list contains as many
 *                TCB entries as you wish.  Each TCB list has it's timer variables
 *                decremented periodicly.  The rate at which the block timers are
 *                decremented should be evident by the name of the list..
 *                ie..  Tenth_sec..  has all of its timers decremented every 100ms.
 *                By utilizing the TCB lists, you can schedule functions to execute on
 *                various cycles.  These functions can reset their respective timer
 *                variables to repeat the cycle, or can set the timer variables to -1
 *                to deactivate, effectivly causing a 1-shot type operation.
 *
 *                It is the responsibility of the hardware timer to decrement the most
 *                frequently updated task-list timer variables. (Hundredth_sec) at the
 *                required rate.  A routine in this TCB list is responsible for
 *                decrementing all the Tenth_sec timers at the appropriate rate.
 *                A routine in the Tenth_sec TCB list is responsible for decrementing
 *                all the Whole_sec timers.  In this way, you can acheive 3 lists, each
 *                with differing cycles, but all driven by a single timer resource.
 *
 *                By turning on the TASK_CONTROL_BLOCK_ENABLED switch in global.h,
 *                you enable the feature.
 *
 *
 *                The Software is provided "AS IS."
 *
 *                LIMITATION OF LIABILITY:    NEITHER INTEL NOR ITS VENDORS OR AGENTS
 *                SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
 *                INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
 *                CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
 *                OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 *                While we have made every attempt to completely test this code, we request that
 *                you personally test it completely prior to actual inclusion in your own projects.
 *
 *  Compiler:     Developed using Compass251 from Production Languages corporation.
 *
 *  Ext Packages: None
 *
 *  Author:       Brad B.
 *
 *  Revisions:
 *
 *
 */


#include "global.h"
#include "main.h"



#ifdef TASK_CONTROL_BLOCK_ENABLED
/* Function prototypes */
static void interrupt timer1_handler(void);     /* Called every 100ms */
static void Hundredth_sec_timer(void);
static void Tenth_sec_timer(void);
static void Stop_Beep(void);                    /* example use function */
static void Flash_led(void);                    /* example use function */
static void Debounce_handler(void);             /* example use function */
static void Task_controller(TCB *);
/* Task timer variables */
static char Tmt_Hundredth_sec = 0;
static char Tmt_Tenth_sec = 10;
static char Tmt_Beep = TASK_DISABLED;    /* example function, 1/2 second single self-terminating beep */
static char Tmt_flash = 2;               /* Toggle a port-bit every 2 seconds (this is an example usage) */
static char Debounce_timer = 2, Debounce_state = 0, Button_state = NOT_PRESSED;

/* Functions, whose execution timers are decremented each hundredth-second (by the hardware timer) */
static const TCB Hundredth_sec[] =
{
   &(Tmt_Hundredth_sec), Hundredth_sec_timer,
   &(Debounce_timer), Debounce_handler,
   END_LIST,0
};
/* Functions, whose execution timers are decremented each tenth-second (by the Hundredth_sec_timer) */
static const TCB Tenth_sec[] =
{
   &(Tmt_Tenth_sec), Tenth_sec_timer,
   &(Tmt_Beep), Stop_Beep,
   END_LIST,0
};
/* Functions, whose execution timers are decremented each whole second (by the Tenth_sec_timer) */
static const TCB Whole_sec[] =
{
   &(Tmt_flash), Flash_led,            /* alternativly, could put this in Tenth_sec TCB, but set Tmt_flash to 20 */
   END_LIST,0
};
#endif      /* end TASK_CONTROL_BLOCK_ENABLED */


/* Below are example routines and necessary control functions for using the TCB functionality */
#ifdef TASK_CONTROL_BLOCK_ENABLED

/* -----------------7/30/96 9:55AM-------------------
   Function: timer1_handler()

   If using TCB functionality, we use Timer1 as the base timer-tick that cycles at 10ms interval, providing
   the 1/100 sec timer decrementing.  Remember, the 10ms timing is not set up by ApBUILDER, you must fill in
   appropriate values in the sfrs[] array at top of file

 * --------------------------------------------------*/

static void interrupt timer1_handler(void)       /* Called every 10ms */
{
   TCB *ptr;

   /* Decrement all timers in Hundredth_sec TCB list */
   for (ptr = &(Hundredth_sec[0]); ptr ->task_flag != END_LIST; ptr ++)
   {
      if (*(ptr -> task_flag) > 0)
      {
         *(ptr -> task_flag) -= 1;
      }
   }
}

/* -----------------7/30/96 9:44AM-------------------
   Function: Task_controller()

   This function is used to iterate through the TCB via it's passed pointer.
   While iterating through the passed TCB, if it finds the task is enabled
   via it's task-flag being set to TASK_ENABLED, it will call the task.

 * --------------------------------------------------*/

static void Task_controller(TCB *tcb_list)
{
   while(tcb_list -> task_flag != END_LIST)        /* while not at end of TCB list */
   {
      if(*tcb_list -> task_flag == TASK_ENABLED)   /* if the timer says the task is ready to execute */
      {
         tcb_list -> task_action();                /* execute the timed task */
      }
      tcb_list++;                                  /* move on to next timed element in the list */
   }
}

/* -----------------7/30/96 9:46AM-------------------
   Function: Hundredth_sec_timer()

   This function is responsible for decrementing all the timer variables
   in the Tenth_sec TCB list.  This allows a single timer to cascade
   through various different TCB lists.

 * --------------------------------------------------*/

static void Hundredth_sec_timer(void)
{
   TCB *ptr;
   Tmt_Hundredth_sec = 10;                             /* Reset timer-variable to re-execute this routine in 1/10 second */

   /* Decrement all timers in Tenth_sec TCB list every 1/10 second */
   for (ptr = &(Tenth_sec[0]); ptr ->task_flag != END_LIST; ptr ++)
   {
      if (*(ptr -> task_flag) > 0)
      {
         *(ptr -> task_flag) -= 1;
      }
   }
}

/* -----------------7/30/96 9:46AM-------------------
   Function: Tenth_sec_timer()

   This function is responsible for decrementing all the timer variables
   in the Whole_sec TCB list.  This allows a single timer to cascade
   through various different TCB lists.

 * --------------------------------------------------*/

static void Tenth_sec_timer(void)
{
   TCB *ptr;
   Tmt_Tenth_sec = 10;                             /* Reset timer-variable to re-execute this routine in 1 second */

   /* Decrement all whole_sec timers every 1/10 second */
   for (ptr = &(Whole_sec[0]); ptr ->task_flag != END_LIST; ptr ++)
   {
      if (*(ptr -> task_flag) > 0)
      {
         *(ptr -> task_flag) -= 1;
      }
   }
}

/* -----------------7/30/96 9:48AM-------------------
   Function: Flash_led()

   Example function, toggles simulated LED on P0.3,
   then re-sets the timer for another 2-second interval.
 * --------------------------------------------------*/

static void Flash_led(void)
{
   Tmt_flash = 2;                /* Count-down and Reset timer.. Reset for 2 second execution again */
   P0 ^= 0x08;                   /* Toggle some bit each 2 seconds */
}

/* -----------------7/30/96 9:49AM-------------------
   Function: beep_it()

   Example function, turns on beep, and sets a timer to expire
   and turn off the beep in 1/2 second.
   Assumes some beeper is activated by setting bit0 of P0 high.
 * --------------------------------------------------*/

static void beep_it(void)
{
   P0 |= 0x01;
   Tmt_Beep = 5;                 /* 5 * 1/10 second = 1/2 second beep */
}

/* -----------------7/30/96 9:50AM-------------------
   Function: Stop_Beep()

   This routine called by Task_controller when Tmt_Beep times
   out (becomes 0).  It simulates turning off a beeper
   by clearing P0.0, and then disables the task timer..
   one-shot usage, non-auto-repeating
 * --------------------------------------------------*/

static void Stop_Beep(void)
{
   Tmt_Beep = TASK_DISABLED;     /* Count-down and terminate timer.. Activated elsewhere */
   P0 &= 0xfe;                   /* Turn off the beeper */
}


/* -----------------7/30/96 9:51AM-------------------
   Function: get_button_push()

   Example function.. Retrieves the state of a button on P0.5
 * --------------------------------------------------*/

void get_button_push(void)
{
   return(Button_state);                           /* PRESSED, or NOT_PRESSED */
}

/* -----------------7/30/96 9:51AM-------------------
   Function: Debounce_handler()

   Simulated active-high button on P0.5.
   Uses state-machine to check button state, utilizing debounce-time
   to ensure we don't respond to a glitch/noise, or get
   multiple responses due to key-bounce.
   This routine Called every 20ms, via 10ms TCB timer, and a timer
   variable (Debounce_timer) set to 2.
 * --------------------------------------------------*/

static void Debounce_handler(void)
{
   static char prev_state = NOT_PRESSED;  /* state variable must have static duration */
   char input_bit;

   Debounce_timer = 2;                    /* reset timer for 20ms delay */

   switch(Debounce_state)
   {
      case 0:                             /* while in state 0, we are looking for an initial transition on P0.5 */
         input_bit =  _BIT(P0,5);
         if (input_bit != prev_state)     /* if signal has transitioned from previous stable state */
         {
            Debounce_state++;             /* move on to next state */
            prev_state = input_bit;
         }
      break;

      case 1:
      case 2:
         Debounce_state++;                /* wait a while to let contacts settle */
      break;

      case 3:
         input_bit = _BIT(P0,5);
         if (input_bit == prev_state)     /* ok, now check to see if it's still in same condition as in state 0 */
         {
            Button_state = prev_state;    /* if it is, then set button state to match it */
         }
         else
         {
            prev_state = input_bit;       /* if it isn't, then we may have received a glitch.. reset prev_state */
         }
         Debounce_state = 0;
      break;
   }
}

#endif      /* TASK_CONTROL_BLOCK_ENABLED */




?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲第一综合色| 亚洲欧美一区二区不卡| 在线观看日韩精品| 国产成人综合视频| 免费在线视频一区| 五月婷婷综合激情| 亚洲综合区在线| 一区二区三区.www| 日韩美女视频19| 中文字幕一区二区三区在线不卡 | 欧洲精品视频在线观看| 懂色一区二区三区免费观看| 国产精品456露脸| 国产成人精品一区二| 狠狠色丁香九九婷婷综合五月| 美女视频免费一区| 蜜桃视频一区二区三区在线观看 | 日本韩国欧美国产| 在线观看网站黄不卡| 欧美日韩精品系列| 91精品福利在线一区二区三区| 日韩丝袜美女视频| 国产亚洲精品久| 亚洲色图一区二区| 一区二区三区加勒比av| 亚洲成人在线观看视频| 日本女优在线视频一区二区| 日韩va亚洲va欧美va久久| 国产一区二区免费看| 99精品欧美一区二区三区综合在线| a美女胸又www黄视频久久| 99精品国产视频| 一本色道久久综合亚洲精品按摩| 在线观看精品一区| 欧美一级高清大全免费观看| 91丨九色丨蝌蚪富婆spa| 欧美久久久一区| 欧美精品一区二| 国产精品区一区二区三区| 亚洲色图20p| 久久精品国产77777蜜臀| 国产精品主播直播| 色综合天天综合| 日韩一区二区在线看片| 国产嫩草影院久久久久| 国产精品嫩草久久久久| 一区二区三区高清在线| 日韩av一区二区三区四区| 一本色道久久加勒比精品| 在线观看国产日韩| 国产亚洲欧美中文| 日韩电影免费一区| 91日韩在线专区| 久久这里只有精品首页| 亚洲综合色丁香婷婷六月图片| 国产一区二区美女诱惑| 国产suv精品一区二区三区| 成人av网址在线| 久久免费的精品国产v∧| 亚洲国产综合91精品麻豆| 粉嫩aⅴ一区二区三区四区五区| 在线成人av影院| 亚洲在线成人精品| 北条麻妃一区二区三区| 欧美高清hd18日本| 欧洲日韩一区二区三区| 国产夜色精品一区二区av| 亚洲男女一区二区三区| 国产精品996| 精品日韩在线观看| 伦理电影国产精品| 国产一区二区三区精品欧美日韩一区二区三区 | 国产日本一区二区| 蜜臀精品久久久久久蜜臀| 欧美婷婷六月丁香综合色| 亚洲人成网站精品片在线观看| 麻豆专区一区二区三区四区五区| 欧美日韩三级一区二区| 亚洲特级片在线| 色婷婷亚洲一区二区三区| 久久麻豆一区二区| 日韩综合在线视频| 国产拍揄自揄精品视频麻豆| 亚洲国产综合视频在线观看| 91麻豆精品国产91久久久久| 26uuu精品一区二区| 春色校园综合激情亚洲| 中文字幕一区二区三区在线不卡| 成人免费精品视频| 亚洲精品成人少妇| 欧美亚洲一区二区三区四区| 亚洲国产欧美在线| 日韩欧美国产不卡| 成人免费视频播放| 亚洲视频免费在线| 91精品中文字幕一区二区三区| 午夜欧美电影在线观看| 欧美性感一区二区三区| 免费美女久久99| 国产精品日韩成人| 欧美日韩国产首页| 国产乱码精品一区二区三| 中文字幕一区二区在线播放| 8v天堂国产在线一区二区| 国产综合色精品一区二区三区| 国产精品白丝在线| 欧美日韩国产片| av中文字幕一区| 日日摸夜夜添夜夜添精品视频| 中文字幕免费观看一区| 欧美伊人久久大香线蕉综合69 | 亚洲欧洲精品天堂一级| 在线精品视频小说1| 极品少妇一区二区| 日韩一区在线免费观看| 欧美国产精品中文字幕| 2020国产精品久久精品美国| 欧美调教femdomvk| 色婷婷综合激情| 国产999精品久久久久久绿帽| 蜜臀av一区二区在线观看| 中文字幕在线观看不卡视频| 精品国产成人系列| 91色综合久久久久婷婷| 狠狠狠色丁香婷婷综合久久五月| 亚洲综合成人网| 亚洲乱码国产乱码精品精小说| 日韩欧美成人激情| 欧美一级日韩一级| 91.xcao| 欧美一区二区三区播放老司机| 欧洲一区在线电影| 欧美丰满少妇xxxxx高潮对白| 欧美中文字幕一区| 国产在线视频一区二区三区| 六月婷婷色综合| 国产精品1024久久| 国产精品123| 欧美这里有精品| 欧美日韩一区三区四区| 欧美日韩精品一区二区三区四区| 日韩一区二区在线观看视频 | 欧美在线小视频| 欧美精品精品一区| 久久国产人妖系列| 成人晚上爱看视频| 欧美一区午夜精品| 精品粉嫩超白一线天av| 中文一区二区在线观看| 国产精品久久久久久久久动漫 | 91亚洲大成网污www| 欧美三级韩国三级日本三斤| 91精品国产91久久久久久一区二区 | 7777精品伊人久久久大香线蕉最新版| 欧美疯狂做受xxxx富婆| 国产亚洲精品福利| 欧美极品少妇xxxxⅹ高跟鞋| 国产精品不卡在线观看| 狠狠色丁香婷综合久久| 99精品黄色片免费大全| 精品久久人人做人人爽| 国产精品―色哟哟| 麻豆成人综合网| 制服丝袜亚洲精品中文字幕| 国产精品理论在线观看| 日本女优在线视频一区二区| www.欧美色图| 日韩免费看的电影| 一级中文字幕一区二区| 国产成人自拍网| 26uuu亚洲综合色欧美| 视频在线观看91| 91黄色免费网站| 日韩一区在线免费观看| 成人免费va视频| 欧美视频在线观看一区二区| 中文字幕亚洲成人| 成人h版在线观看| 中国av一区二区三区| 国产露脸91国语对白| 日韩视频免费观看高清完整版| 三级久久三级久久| 3d动漫精品啪啪1区2区免费| 亚洲欧洲综合另类在线| 在线视频国内一区二区| 亚洲欧美成人一区二区三区| 高清在线不卡av| 中文字幕一区二区三区av| 高清不卡在线观看| 中日韩av电影| 成人av在线网站| 亚洲精品高清在线| 日本国产一区二区| 国产精品情趣视频| 欧美日韩精品电影| 秋霞av亚洲一区二区三| 欧美xxxxx牲另类人与| 国产美女一区二区三区| 国产精品欧美综合在线| 日本久久电影网|