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

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

?? switches.c

?? CNC.rar
?? C
?? 第 1 頁 / 共 2 頁
字號:
    // Set the shutdown flag if the shutdown switch is pressed.
    //
    if(!(ulReg & SHUTDOWN))
    {
        ulFlags |= SWITCH_SHUTDOWN;
    }

    //
    // Return the set of switches that are presently pressed.
    //
    return(ulFlags);
}

//*****************************************************************************
//
//! Read the full state of the switches.
//!
//! This function reads the state of the switches on the CNC machine.  The
//! limit switches are read by timing the capacitor charge time in the RC
//! circuit; therefore the min and max limit on each switch pin is individually
//! recognized.
//!
//! \return A bit field of \b SWITCH_??? values to indicate the switches that
//! are currently pressed.
//
//*****************************************************************************
unsigned long
SwitchesLimitRead(void)
{
    unsigned long ulIdx, ulX, ulY, ulZ;
    unsigned char pucBuffer[32];

    //
    // Set the limit switch GPIOs for maximum drive strength and turn off the
    // weak pull-down.
    //
    GPIOPadConfigSet(GPIO_PORTC_BASE, LIMIT_X | LIMIT_Y | LIMIT_Z,
                     GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);

    //
    // Set the limit switch GPIOs as low outputs to drain the capacitors in the
    // limit switch RC circuit.
    //
    GPIODirModeSet(GPIO_PORTC_BASE, LIMIT_X | LIMIT_Y | LIMIT_Z,
                   GPIO_DIR_MODE_OUT);
    GPIOPinWrite(GPIO_PORTC_BASE, LIMIT_X | LIMIT_Y | LIMIT_Z, 0);

    //
    // Delay while the capacitors drain.
    //
    SwitchesDelay(100);

    //
    // Disable processor interrupts.
    //
    IntMasterDisable();

    //
    // Set the limit switch GPIOs to inputs, allowing the capacitors to charge
    // if one of the limit switches is pressed.
    //
    GPIODirModeSet(GPIO_PORTC_BASE, LIMIT_X | LIMIT_Y | LIMIT_Z,
                   GPIO_DIR_MODE_IN);

    //
    // Capture a set of limit switch samples to time the rise time on the RC
    // circuit.
    //
    for(ulIdx = 0; ulIdx < (sizeof(pucBuffer) / sizeof(pucBuffer[0])); ulIdx++)
    {
        pucBuffer[ulIdx] = GPIOPinRead(GPIO_PORTC_BASE,
                                       LIMIT_X | LIMIT_Y | LIMIT_Z);
    }

    //
    // Enable processor interrupts.
    //
    IntMasterEnable();

    //
    // Set the limit switch GPIOs back to low drive strength with the weak
    // pull-down enabled.
    //
    GPIOPadConfigSet(GPIO_PORTC_BASE, LIMIT_X | LIMIT_Y | LIMIT_Z,
                     GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPD);

    //
    // Set the low counts for the three limit switches to zero.
    //
    ulX = 0;
    ulY = 0;
    ulZ = 0;

    //
    // Loop over the limit switch samples.
    //
    for(ulIdx = 0; ulIdx < (sizeof(pucBuffer) / sizeof(pucBuffer[0])); ulIdx++)
    {
        //
        // Increment the X low count if the X limit switch is low in this
        // sample.
        //
        if(!(pucBuffer[ulIdx] & LIMIT_X))
        {
            ulX++;
        }

        //
        // Increment the Y low count if the Y limit switch is low in this
        // sample.
        //
        if(!(pucBuffer[ulIdx] & LIMIT_Y))
        {
            ulY++;
        }

        //
        // Increment the Z low count if the Z limit switch is low in this
        // sample.
        //
        if(!(pucBuffer[ulIdx] & LIMIT_Z))
        {
            ulZ++;
        }
    }

    //
    // Set the flag to indicate no buttons are pressed.
    //
    ulIdx = 0;

    //
    // If the X low count is zero, then both X limit switches are pressed
    // (which shouldn't happen unless a switch fails or someone sticks their
    // finger into the machine).  If the X low count is 4 +/- 2, then the X
    // minimum limit switch is pressed.  If the X low count is 18 +/- 2, then
    // the X maximum limit switch is pressed.
    //
    if(ulX == 0)
    {
        ulIdx |= SWITCH_LIMIT_X;
    }
    else if((ulX >= 11) && (ulX <= 15))
    {
        ulIdx |= SWITCH_LIMIT_X_MINUS;
    }
    else if((ulX >= 26) && (ulX <= 30))
    {
        ulIdx |= SWITCH_LIMIT_X_PLUS;
    }

    //
    // If the Y low count is zero, then both Y limit switches are pressed
    // (which shouldn't happen unless a switch fails or someone sticks their
    // finger into the machine).  If the Y low count is 4 +/- 2, then the Y
    // minimum limit switch is pressed.  If the Y low count is 18 +/- 2, then
    // the Y maximum limit switch is pressed.
    //
    if(ulY == 0)
    {
        ulIdx |= SWITCH_LIMIT_Y;
    }
    else if((ulY >= 11) && (ulY <= 15))
    {
        ulIdx |= SWITCH_LIMIT_Y_MINUS;
    }
    else if((ulY >= 26) && (ulY <= 30))
    {
        ulIdx |= SWITCH_LIMIT_Y_PLUS;
    }

    //
    // If the Z low count is zero, then both Z limit switches are pressed
    // (which shouldn't happen unless a switch fails or someone sticks their
    // finger into the machine).  If the Z low count is 4 +/- 2, then the Z
    // minimum limit switch is pressed.  If the Z low count is 18 +/- 2, then
    // the Z maximum limit switch is pressed.
    //
    if(ulZ == 0)
    {
        ulIdx |= SWITCH_LIMIT_Z;
    }
    else if((ulZ >= 11) && (ulZ <= 15))
    {
        ulIdx |= SWITCH_LIMIT_Z_MINUS;
    }
    else if((ulZ >= 26) && (ulZ <= 30))
    {
        ulIdx |= SWITCH_LIMIT_Z_PLUS;
    }

    //
    // Set the shutdown flag if the shutdown switch is pressed.
    //
    if(GPIOPinRead(GPIO_PORTE_BASE, SHUTDOWN) == 0)
    {
        ulIdx |= SWITCH_SHUTDOWN;
    }

    //
    // Return the set of switches that are presently pressed.
    //
    return(ulIdx);
}

//*****************************************************************************
//
//! Initializes the switches on the CNC machine.
//!
//! This function initializes the interface to the switches on the CNC machine.
//!
//! \return None.
//
//*****************************************************************************
void
SwitchesInit(void)
{
    //
    // Make the limit switch GPIOs be inputs with weak pull-downs.
    //
    GPIODirModeSet(GPIO_PORTC_BASE, LIMIT_X | LIMIT_Y | LIMIT_Z,
                   GPIO_DIR_MODE_IN);
    GPIOPadConfigSet(GPIO_PORTC_BASE, LIMIT_X | LIMIT_Y | LIMIT_Z,
                     GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPD);

    //
    // Make the shutdown switch GPIO be an input.
    //
    GPIODirModeSet(GPIO_PORTE_BASE, SHUTDOWN, GPIO_DIR_MODE_IN);

    //
    // Configure the panic switch GPIO for falling edge interrupts.
    //
    GPIOIntTypeSet(GPIO_PORTE_BASE, SHUTDOWN, GPIO_FALLING_EDGE);
    GPIOPinIntEnable(GPIO_PORTE_BASE, SHUTDOWN);
    IntEnable(INT_GPIOE);
}

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日韩一级二级三级| 欧美电影免费观看高清完整版在线 | 亚洲色图欧洲色图婷婷| 久久精品欧美日韩| 国产日韩亚洲欧美综合| 国产日韩精品一区二区三区在线| 精品久久久久久综合日本欧美 | 日本中文字幕不卡| 亚瑟在线精品视频| 日本亚洲视频在线| 国产原创一区二区| 成人激情文学综合网| 国产一区免费电影| 国产mv日韩mv欧美| 色综合天天综合给合国产| 欧洲精品一区二区| 欧美一区二区三区喷汁尤物| 欧美α欧美αv大片| 欧美r级在线观看| 日本一区二区三区视频视频| 日韩一区在线播放| 日韩精品一二三区| 国产一区二区精品在线观看| 波多野结衣中文字幕一区| 欧美中文字幕一区二区三区 | 国产91精品入口| 91视频在线观看免费| 欧美日韩中字一区| 久久亚洲综合色| 亚洲毛片av在线| 免费成人小视频| 99免费精品视频| 制服丝袜成人动漫| 中文字幕在线免费不卡| 午夜视频一区二区| 成人精品视频网站| 51久久夜色精品国产麻豆| 久久久激情视频| 午夜精彩视频在线观看不卡| 国产精品原创巨作av| 欧美三片在线视频观看| 国产日韩欧美综合在线| 亚洲成在人线在线播放| 波多野结衣中文一区| 在线电影欧美成精品| 中文字幕av资源一区| 蜜臀久久久99精品久久久久久| 国产精品18久久久| 日韩欧美中文一区二区| 亚洲视频狠狠干| 国产麻豆成人传媒免费观看| 欧美三级中文字幕| 国产精品久久久久一区二区三区共| 视频一区欧美日韩| 在线视频观看一区| 国产精品美女久久久久久2018| 日产欧产美韩系列久久99| 91猫先生在线| 国产精品色噜噜| 激情图片小说一区| 欧美一区二区三区免费| 一区二区日韩电影| 91视频com| 中文字幕在线不卡一区 | 国产欧美视频在线观看| 日本亚洲最大的色成网站www| 91福利精品第一导航| 日本一区二区三区四区| 国产精品羞羞答答xxdd| 日韩免费视频线观看| 美女诱惑一区二区| 欧美精品123区| 午夜电影久久久| 欧美日韩高清影院| 婷婷国产v国产偷v亚洲高清| 欧美电影免费观看高清完整版在线观看| 亚洲在线一区二区三区| 91色九色蝌蚪| 亚洲精选免费视频| 在线观看日韩av先锋影音电影院| 亚洲人妖av一区二区| 91丝袜美女网| 一区二区三区四区av| 欧美性大战久久久久久久蜜臀| 一区二区三区免费看视频| 99精品热视频| 亚洲香肠在线观看| 欧美一级艳片视频免费观看| 麻豆成人免费电影| 国产欧美精品一区二区三区四区| 国产精品一品视频| 亚洲日韩欧美一区二区在线| 色狠狠桃花综合| 日韩福利电影在线| 精品国产免费人成电影在线观看四季 | 精品国产乱子伦一区| 国产麻豆9l精品三级站| 中文字幕精品综合| 在线欧美日韩国产| 麻豆国产欧美日韩综合精品二区| 久久一二三国产| av不卡一区二区三区| 亚洲资源中文字幕| 精品国偷自产国产一区| 成人午夜伦理影院| 午夜视频一区二区三区| 国产亚洲美州欧州综合国| 不卡的av在线播放| 日韩不卡在线观看日韩不卡视频| 久久久久久综合| 91福利社在线观看| 国产伦精一区二区三区| 亚洲精品久久久久久国产精华液| 欧美一级片免费看| 丰满少妇在线播放bd日韩电影| 亚洲国产日韩av| 久久久噜噜噜久久中文字幕色伊伊| 91美女精品福利| 国产精品一区一区| 亚洲高清视频的网址| 国产农村妇女毛片精品久久麻豆| 色悠久久久久综合欧美99| 久久国产尿小便嘘嘘尿| 一区二区三区在线播放| 久久精品视频网| 欧美一区二区三区视频| 91麻豆精东视频| 国产福利91精品一区| 日韩电影一二三区| 一区二区三区高清不卡| 亚洲国产精品v| 欧美一级视频精品观看| 在线观看网站黄不卡| 国产91精品一区二区麻豆亚洲| 人人精品人人爱| 亚洲成人在线观看视频| ㊣最新国产の精品bt伙计久久| 精品嫩草影院久久| 制服丝袜亚洲色图| 欧美日韩午夜影院| 91视频在线看| 不卡欧美aaaaa| 国产精品一级二级三级| 精油按摩中文字幕久久| 日韩 欧美一区二区三区| 亚洲成人777| 午夜a成v人精品| 三级在线观看一区二区| 亚洲一区二区三区四区在线观看| 亚洲老司机在线| 一区二区三区四区精品在线视频 | 亚洲欧美激情插| 亚洲免费在线视频| 成人欧美一区二区三区1314| 欧美激情中文不卡| 国产日产亚洲精品系列| 国产亚洲1区2区3区| 久久综合九色综合欧美亚洲| 精品区一区二区| 精品国产免费视频| 国产视频一区不卡| 中文字幕视频一区| 一级日本不卡的影视| 亚洲一区二区三区在线播放| 婷婷久久综合九色综合绿巨人| 三级不卡在线观看| 精品亚洲国产成人av制服丝袜| 久久99热国产| 国产白丝精品91爽爽久久| 9久草视频在线视频精品| 色综合网站在线| 欧美日本不卡视频| 久久综合久久鬼色中文字| 国产欧美日韩在线视频| 亚洲黄色小说网站| 日韩黄色免费网站| 国产麻豆一精品一av一免费| 国产69精品久久久久毛片| 99天天综合性| 欧美美女一区二区| 久久青草国产手机看片福利盒子| 日本一区二区三区四区| 亚洲国产精品欧美一二99| 麻豆成人免费电影| 99久久婷婷国产综合精品| 欧美日韩aaaaa| 国产视频一区二区在线观看| 一区二区三区 在线观看视频| 久久爱另类一区二区小说| 成人av动漫在线| 在线不卡中文字幕播放| 国产丝袜美腿一区二区三区| 一区二区欧美视频| 激情文学综合丁香| 欧美少妇一区二区| 久久一日本道色综合| 偷拍亚洲欧洲综合| 成人黄色av电影| 精品国产髙清在线看国产毛片| 亚洲激情图片一区|