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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? dio.c

?? 常用外圍接口的程序設計
?? C
?? 第 1 頁 / 共 3 頁
字號:
        case DO_BLINK_EN_INV:               /* Blink depends on the complemented user request's state  */
             en = pdo->DOBypass ? FALSE : TRUE;
             break;
    }
    return (en);
}
#endif

/*$PAGE*/
/*
*********************************************************************************************************
*                                 SET THE STATE OF THE DISCRETE OUTPUT
*
* Description : This function is used to set the state of the discrete output.
* Arguments   : n     is the discrete output channel (0..DIO_MAX_DO-1).
*               state is the desired state of the output:
*                         FALSE indicates a  negated  output
*                         TRUE  indicates an asserted output
* Returns     : None.
* Notes       : The actual output will be complemented if 'DIInv' is set to TRUE.
*********************************************************************************************************
*/

void  DOSet (INT8U n, BOOLEAN state)
{
    if (n < DIO_MAX_DO) {
        OS_ENTER_CRITICAL();
        DOTbl[n].DOCtrl = state;
        OS_EXIT_CRITICAL();
    }
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                  SET THE STATE OF THE BYPASSED OUTPUT
*
* Description : This function is used to set the state of the bypassed output.  This function is used to
*               override (or bypass) the application software and allow the output to be controlled
*               directly.  This function is only valid if the bypass switch is open.
* Arguments   : n       is the discrete output channel (0..DIO_MAX_DO-1).
*               state   is the desired state of the output:
*                         FALSE indicates a  negated  output
*                         TRUE  indicates an asserted output
* Returns     : None.
* Notes       : 1) The actual output will be complemented if 'DIInv' is set to TRUE.
*               2) In blink mode, this allows blinking to be enabled or not.
*********************************************************************************************************
*/

void  DOSetBypass (INT8U n, BOOLEAN state)
{
    DIO_DO  *pdo;
    
    
    if (n < DIO_MAX_DO) {
        pdo = &DOTbl[n];
        OS_ENTER_CRITICAL();
        if (pdo->DOBypassEn == TRUE) {
            pdo->DOBypass = state;
        }
        OS_EXIT_CRITICAL();
    }
}

/*$PAGE*/
/*
*********************************************************************************************************
*                                  SET THE STATE OF THE OUTPUT BYPASS
*
* Description : This function is used to set the state of the output bypass switch.  The output is
*               bypassed when the 'switch' is open (i.e. DOBypassEn is set to TRUE).
* Arguments   : n     is the discrete output channel (0..DIO_MAX_DO-1).
*               state is the state of the bypass switch:
*                         FALSE disables output bypass (i.e. the switch is closed)
*                         TRUE  enables  output bypass (i.e. the switch is open)
* Returns     : None.
*********************************************************************************************************
*/

void  DOSetBypassEn (INT8U n, BOOLEAN state)
{
    if (n < DIO_MAX_DO) {
        OS_ENTER_CRITICAL();
        DOTbl[n].DOBypassEn = state;
        OS_EXIT_CRITICAL();
    }
}

/*$PAGE*/

/*
*********************************************************************************************************
*                            SET THE MAXIMUM VALUE FOR THE SYNCHRONOUS COUNTER
*
* Description : This function is used to set the maximum value taken by the synchronous counter which is
*               used in the synchronous blink mode.
* Arguments   : val   is the maximum value for the counter (1..255)
* Returns     : None.
*********************************************************************************************************
*/

#if  DO_BLINK_MODE_EN
void  DOSetSyncCtrMax (INT8U val)
{
    OS_ENTER_CRITICAL();
    DOSyncCtrMax = val;
    DOSyncCtr    = val;
    OS_EXIT_CRITICAL();
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
*                                    UPDATE DISCRETE OUT CHANNELS
*
* Description : This function is called to process all of the discrete output channels.
* Arguments   : None.
* Returns     : None.
*********************************************************************************************************
*/

static  void  DOUpdate (void)
{
    INT8U     i;
    BOOLEAN   out;
    DIO_DO   *pdo;


    pdo = &DOTbl[0];
    for (i = 0; i < DIO_MAX_DO; i++) {           /* Process all discrete output channels               */
        if (pdo->DOBypassEn == FALSE) {          /* See if DO channel is enabled                       */
            pdo->DOBypass = pdo->DOCtrl;         /* Obtain control state from application              */
        }
        out = FALSE;                             /* Assume that the output will be low unless changed  */
        switch (pdo->DOModeSel) {
            case DO_MODE_LOW:                    /* Output will in fact be low                         */
                 break;

            case DO_MODE_HIGH:                   /* Output will be high                                */
                 out = TRUE;
                 break;

            case DO_MODE_DIRECT:                 /* Output is based on state of user supplied state    */
                 out = pdo->DOBypass;
                 break;
/*$PAGE*/
#if DO_BLINK_MODE_EN
            case DO_MODE_BLINK_SYNC:                       /* Sync. Blink mode                         */
                 if (DOIsBlinkEn(pdo)) {                   /* See if Blink is enabled ...              */
                     if (pdo->DOA >= DOSyncCtr) {          /* ... yes, High when below threshold       */
                         out = TRUE;
                     }
                 }
                 break;

            case DO_MODE_BLINK_ASYNC:                      /* Async. Blink mode                        */
                 if (DOIsBlinkEn(pdo)) {                   /* See if Blink is enabled ...              */
                     if (pdo->DOA >= pdo->DOBCtr) {        /* ... yes, High when below threshold       */
                         out = TRUE;
                     }
                 }
                 if (pdo->DOBCtr < pdo->DOB) {             /* Update the threshold counter             */
                     pdo->DOBCtr++;
                 } else {
                     pdo->DOBCtr = 0;
                 }
                 break;
#endif
        }
        if (pdo->DOInv == TRUE) {                          /* See if output needs to be inverted ...   */
            pdo->DOOut = out ? FALSE : TRUE;               /* ... yes, complement output               */
        } else {
            pdo->DOOut = out;                              /* ... no,  no inversion!                   */
        }
        pdo++;                                             /* Point to next DIO_DO element             */
    }
#if DO_BLINK_MODE_EN
    if (DOSyncCtr < DOSyncCtrMax) {                        /* Update the synchronous free running ctr  */
        DOSyncCtr++;
    } else {
        DOSyncCtr = 0;
    }
#endif
}
/*$PAGE*/
#ifndef CFG_C
/*
*********************************************************************************************************
*                                      INITIALIZE PHYSICAL I/Os
*
* Description : This function is by DIOInit() to initialze the physical I/O used by the DIO driver.
* Arguments   : None.
* Returns     : None.
* Notes       : The physical I/O is assumed to be an 82C55 chip initialized as follows:
*                   Port A = OUT  (Discrete outputs)
*                   Port B = IN   (Discrete inputs)
*                   Port C = OUT  (not used)
*********************************************************************************************************
*/

void  DIOInitIO (void)
{
    outp(0x0303, 0x82);                          /* Port A = OUT, Port B = IN, Port C = OUT            */
}

/*
*********************************************************************************************************
*                                         READ PHYSICAL INPUTS
*
* Description : This function is called to read and map all of the physical inputs used for discrete
*               inputs and map these inputs to their appropriate discrete input data structure.
* Arguments   : None.
* Returns     : None.
*********************************************************************************************************
*/

void  DIRd (void)
{
    DIO_DI  *pdi;
    INT8U    i;
    INT8U    in;
    INT8U    msk;


    pdi = &DITbl[0];                                       /* Point at beginning of discrete inputs    */
    msk = 0x01;                                            /* Set mask to extract bit 0                */
    in  = inp(0x0301);                                     /* Read the physical port (8 bits)          */
    for (i = 0; i < 8; i++) {                              /* Map all 8 bits to first 8 DI channels    */
        pdi->DIIn   = (BOOLEAN)(in & msk) ? 1 : 0;
        msk       <<= 1;
        pdi++;
    }
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                       UPDATE PHYSICAL OUTPUTS
*
* Description : This function is called to map all of the discrete output channels to their appropriate
*               physical destinations.
* Arguments   : None.
* Returns     : None.
*********************************************************************************************************
*/

void  DOWr (void)
{
    DIO_DO  *pdo;
    INT8U    i;
    INT8U    out;
    INT8U    msk;


    pdo = &DOTbl[0];                        /* Point at first discrete output channel                  */
    msk = 0x01;                             /* First DO will be mapped to bit 0                        */
    out = 0x00;                             /* Local 8 bit port image                                  */
    for (i = 0; i < 8; i++) {               /* Map first 8 DO to 8 bit port image                      */
        if (pdo->DOOut == TRUE) {
            out |= msk;
        }
        msk <<= 1;
        pdo++;
    }
    outp(0x0300, out);                      /* Output port image to physical port                      */
}
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕免费不卡| 欧美一区二区三区四区久久| 视频一区国产视频| 中文字幕欧美区| 日韩三级视频中文字幕| 色激情天天射综合网| 国产一区二区不卡| 一区二区免费在线播放| 久久久久久久综合日本| 欧美另类久久久品| 不卡电影一区二区三区| 国产一区久久久| 免费在线成人网| 香蕉成人啪国产精品视频综合网| 国产精品入口麻豆九色| 精品精品国产高清a毛片牛牛| 欧美亚洲国产一区二区三区| 成人亚洲精品久久久久软件| 久久99久久久久| 性做久久久久久免费观看| 亚洲免费资源在线播放| 国产欧美日韩在线| 精品国产凹凸成av人网站| 欧美一区国产二区| 欧美一区二视频| 欧美人与性动xxxx| 欧美亚洲丝袜传媒另类| 91国模大尺度私拍在线视频| av欧美精品.com| 大美女一区二区三区| 国产剧情一区在线| 韩国av一区二区三区四区| 青青草成人在线观看| 日韩精品久久久久久| 天天做天天摸天天爽国产一区| 一区二区高清在线| 一个色妞综合视频在线观看| 一区二区三区资源| 一区二区三区精密机械公司| 亚洲欧美另类图片小说| 玉足女爽爽91| 亚洲福利电影网| 不卡一区中文字幕| 国产一区二区三区在线观看免费视频 | 不卡av在线网| 成人午夜激情视频| 91婷婷韩国欧美一区二区| 91在线无精精品入口| 色域天天综合网| 91传媒视频在线播放| 欧美日本在线一区| 欧美一级二级三级乱码| 精品国产免费人成电影在线观看四季| 精品久久久久一区| 日本一区二区三区高清不卡| 国产欧美日韩麻豆91| 自拍偷拍国产精品| 一区二区三区四区在线播放| 亚洲国产综合色| 久久国产三级精品| 国产成人免费视频网站高清观看视频| 成人激情开心网| 91久久久免费一区二区| 正在播放亚洲一区| 亚洲精品一线二线三线| 欧美高清在线精品一区| 亚洲国产另类av| 激情图区综合网| aaa欧美大片| 欧美性大战久久久久久久蜜臀| 欧美精品欧美精品系列| 久久人人97超碰com| 久久久久久毛片| 日韩欧美资源站| 亚洲国产精品传媒在线观看| 一区二区在线观看免费| 免费成人性网站| 成人综合婷婷国产精品久久蜜臀 | 欧美电影精品一区二区| 国产日韩欧美精品电影三级在线| 亚洲欧美色一区| 免费久久99精品国产| 成人涩涩免费视频| 欧美老肥妇做.爰bbww视频| 国产日韩v精品一区二区| 亚洲综合一二区| 国产精华液一区二区三区| 在线免费亚洲电影| 国产日韩欧美综合在线| 亚洲成人午夜电影| 成人h精品动漫一区二区三区| 精品视频在线视频| 国产精品美日韩| 蜜桃在线一区二区三区| 91一区二区三区在线观看| 日韩情涩欧美日韩视频| 亚洲综合一区二区三区| 国产ts人妖一区二区| 日韩一区二区三免费高清| 亚洲精品欧美综合四区| 国产精品一卡二卡在线观看| 欧美日本国产视频| 一区二区三区在线观看网站| 国产精品一二三四区| 91麻豆精品国产91久久久| 成人欧美一区二区三区小说| 老司机精品视频线观看86 | 欧美精品一区二区三区四区| 亚洲午夜激情av| 91亚洲午夜精品久久久久久| 国产蜜臀97一区二区三区| 奇米888四色在线精品| 欧美影院一区二区| 亚洲免费观看高清在线观看| 粉嫩一区二区三区在线看| 精品国产乱码久久久久久1区2区| 亚洲大尺度视频在线观看| 色婷婷国产精品| 亚洲日韩欧美一区二区在线| 国产xxx精品视频大全| 久久精品无码一区二区三区| 精品一区二区免费看| 日韩视频免费直播| 日韩av成人高清| 欧美另类一区二区三区| 午夜精品国产更新| 欧美色成人综合| 亚洲成人综合视频| 欧美综合欧美视频| 亚洲综合久久av| 欧美亚洲尤物久久| 午夜精品久久久久久久99樱桃| 欧美日韩在线观看一区二区 | 日韩一区二区精品在线观看| 亚洲成人1区2区| 欧美剧在线免费观看网站| 日韩国产欧美三级| 欧美一区二区视频在线观看| 美女任你摸久久| 欧美tickling网站挠脚心| 蓝色福利精品导航| 精品国产免费久久| 国产成人夜色高潮福利影视| 国产视频不卡一区| 99精品久久只有精品| 亚洲免费观看在线视频| 欧美日韩国产大片| 美日韩一区二区三区| www欧美成人18+| 成人午夜免费av| 亚洲精品成人在线| 在线播放日韩导航| 另类的小说在线视频另类成人小视频在线 | 日韩高清中文字幕一区| 91精品国产全国免费观看| 日本v片在线高清不卡在线观看| 91精品国产乱| 成人永久免费视频| 一区二区三区影院| 日韩一区二区三免费高清| 国产一区二区三区免费播放| 国产精品网站在线观看| 91社区在线播放| 日韩精品1区2区3区| 亚洲精品在线免费播放| 99re热这里只有精品免费视频| 婷婷久久综合九色国产成人| 欧美不卡一区二区| 成人av免费观看| 亚洲成人三级小说| 国产亚洲精品超碰| 色先锋资源久久综合| 日本亚洲一区二区| 国产精品毛片高清在线完整版| 欧美亚洲综合在线| 国产一区不卡精品| 一区二区三区在线观看国产| 精品日产卡一卡二卡麻豆| 成人短视频下载| 日韩精品乱码免费| 国产精品超碰97尤物18| 91精品国产综合久久蜜臀| aa级大片欧美| 久久精品国产亚洲aⅴ| 亚洲欧美一区二区三区孕妇| 日韩一级高清毛片| 91网页版在线| 国内精品视频666| 亚洲一二三区不卡| 国产日产欧美精品一区二区三区| 欧美天天综合网| 福利电影一区二区| 奇米影视在线99精品| 亚洲日本在线观看| 色天使久久综合网天天| 国产精品一卡二卡在线观看| 日精品一区二区三区| 国产精品电影一区二区三区| 欧美mv和日韩mv国产网站| 欧美午夜寂寞影院|