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

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

?? switches.c

?? CNC.rar
?? C
?? 第 1 頁 / 共 2 頁
字號:
//*****************************************************************************
//
// switches.c - Routines for handling the switches on the CNC machine.
//
// Copyright (c) 2006-2007 Luminary Micro, Inc.  All rights reserved.
//
// Software License Agreement
//
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  Any use in violation
// of the foregoing restrictions may subject the user to criminal sanctions
// under applicable laws, as well as to civil liability for the breach of the
// terms and conditions of this license.
//
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 220 of sw01246.
//
//*****************************************************************************

#include "hw_ints.h"
#include "hw_memmap.h"
#include "hw_types.h"
#include "gpio.h"
#include "interrupt.h"
#include "draw.h"
#include "switches.h"
#include "table.h"
#include "tool.h"

//*****************************************************************************
//
//! \page main_switches_intro Introduction
//!
//! There are seven switches on the CNC machine.  Six are limit switches, two
//! per axis, with one being the home limit switch (to indicate that the axis
//! is in the home position) and the other being a limit switch (to indicate
//! that the axis is at the extent of its travel).  The seventh switch is a
//! panic switch that causes all power to the machine (but not controller) to
//! be interrupted.
//!
//! The limit switches are wired up with two switches per GPIO pin; each switch
//! has a different resistor value and for part of an RC circuit.  The paired
//! limit switches can be read as a normal GPIO, providing no means of
//! distingishing between the two.  For normal operation of the CNC machine,
//! this is adequate.
//!
//! Alternatively, the charge time of the capacitor can be measured by sampling
//! the switch GPIO and used to determine which switch is engaged.  This is
//! used during the homing operation since the CNC machine needs to move the
//! gantry such that the home limit switch is engaged, not the limit switch.
//!
//! The panic switch is wired up like a normal switch.  When the panic switch
//! is engaged, an emergency stop of all mechanical systems on the CNC machine
//! must be performed as a safety measure.  After the panic switch is
//! disengaged, the table must undergo another homing operation to restore the
//! positional knowledge of the table.
//!
//! The code for handling the switches is contained in
//! <tt>main_micro/switches.c</tt>, with <tt>main_micro/switches.h</tt>
//! containing the API definitions for use by the remainder of the application.
//
//*****************************************************************************

//*****************************************************************************
//
//! \defgroup main_switches_api Definitions
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
//! The GPIO pin on port C to which the X limit switches are connected.
//
//*****************************************************************************
#define LIMIT_X                 GPIO_PIN_2

//*****************************************************************************
//
//! The GPIO pin on port C to which the Y limit switches are connected.
//
//*****************************************************************************
#define LIMIT_Y                 GPIO_PIN_3

//*****************************************************************************
//
//! The GPIO pin on port C to which the Z limit switches are connected.
//
//*****************************************************************************
#define LIMIT_Z                 GPIO_PIN_4

//*****************************************************************************
//
//! The GPIO pin on port E to which the panic switch is connected.
//
//*****************************************************************************
#define SHUTDOWN                GPIO_PIN_2

//*****************************************************************************
//
//! Provide a small delay.
//!
//! \param ulCount is the number of delay loop iterations to perform.
//!
//! Delay for a fixed period of time while the capacitor in the limit switch
//! RC circuit is discharged.  It is written in assembly to keep the delay
//! consistent across tool chains, avoiding the need to tune the delay based on
//! the tool chain in use.
//!
//! \return None.
//
//*****************************************************************************
#if defined(ewarm)
static void
SwitchesDelay(unsigned long ulCount)
{
    __asm("    subs    r0, #1\n"
          "    bne     SwitchesDelay\n"
          "    bx      lr");
}
#endif
#if defined(gcc)
static void __attribute__((naked))
SwitchesDelay(unsigned long ulCount)
{
    __asm("    subs    r0, #1\n"
          "    bne     SwitchesDelay\n"
          "    bx      lr");
}
#endif
#if defined(rvmdk) || defined(__ARMCC_VERSION)
__asm void
SwitchesDelay(unsigned long ulCount)
{
    subs    r0, #1;
    bne     SwitchesDelay;
    bx      lr;
}
#endif

//*****************************************************************************
//
//! Interrupt handler for the shutdown switch interrupt.
//!
//! This is the interrupt handler that is called when the shutdown switch is
//! pressed.
//!
//! \return None.
//
//*****************************************************************************
void
GPIOEIntHandler(void)
{
    //
    // Clear the shutdown switch interrupt.
    //
    GPIOPinIntClear(GPIO_PORTE_BASE, SHUTDOWN);

    //
    // Turn off the tool.
    //
    ToolOff();

    //
    // Immediately stop the motion on all axes.
    //
    TableEmergencyStop();

    //
    // Stop the drawing operation (if any).
    //
    DrawStop();
}

//*****************************************************************************
//
//! Read the state of the switches.
//!
//! This function reads the state of the switches on the CNC machine.  The
//! limit switches are read as a simple GPIO; therefore the min and max limit
//! on each switch pin can not be distinguished.
//!
//! \return A bit field of \b SWITCH_??? values to indicate the switches that
//! are currently pressed.
//
//*****************************************************************************
unsigned long
SwitchesRead(void)
{
    unsigned long ulFlags, ulReg;

    //
    // Set the flags to indicate no buttons are pressed.
    //
    ulFlags = 0;

    //
    // Read the X, Y, and Z limit switches.
    //
    ulReg = GPIOPinRead(GPIO_PORTC_BASE, LIMIT_X | LIMIT_Y | LIMIT_Z);

    //
    // Set the X min and max limit flags if one of the X limit switches are
    // pressed.  Both flags are set since this does not distinguish which of
    // the two X limit switches are being pressed.
    //
    if(ulReg & LIMIT_X)
    {
        ulFlags |= SWITCH_LIMIT_X;
    }

    //
    // Set the Y min and max limit flags if one of the Y limit switches are
    // pressed.  Both flags are set since this does not distinguish which of
    // the two Y limit switches are being pressed.
    //
    if(ulReg & LIMIT_Y)
    {
        ulFlags |= SWITCH_LIMIT_Y;
    }

    //
    // Set the Z min and max limit flags if one of the Z limit switches are
    // pressed.  Both flags are set since this does not distinguish which of
    // the two Z limit switches are being pressed.
    //
    if(ulReg & LIMIT_Z)
    {
        ulFlags |= SWITCH_LIMIT_Z;
    }

    //
    // Read the shutdown switch.
    //
    ulReg = GPIOPinRead(GPIO_PORTE_BASE, SHUTDOWN);

    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲黄网站在线观看| 成人av高清在线| 久久电影国产免费久久电影| 97久久超碰精品国产| 日韩久久久久久| 亚洲成人1区2区| 99精品1区2区| 国产精品私房写真福利视频| 蜜臀久久99精品久久久久宅男| 成人av电影在线| www日韩大片| 男女性色大片免费观看一区二区| 色94色欧美sute亚洲13| 国产精品乱人伦中文| 极品美女销魂一区二区三区| 欧美三级韩国三级日本三斤| 综合久久综合久久| 成人免费看片app下载| 精品精品国产高清a毛片牛牛| 视频在线在亚洲| 91美女片黄在线| 中文字幕免费一区| 国产福利一区在线| xnxx国产精品| 国产一区二区三区在线观看免费视频 | 欧美午夜精品理论片a级按摩| 中文字幕av一区 二区| 国产成人av自拍| 国产亚洲欧美中文| 成人性视频免费网站| 国产欧美一区二区精品秋霞影院| 久久精品国产精品亚洲红杏| 日韩一区二区三区四区 | 欧美综合一区二区| 一区二区三区久久久| 欧美在线色视频| 亚洲综合激情小说| 欧美日韩一区视频| 日韩电影免费在线看| 日韩午夜小视频| 国产在线国偷精品免费看| 26uuu亚洲综合色| 国产激情一区二区三区四区| 欧美国产精品中文字幕| 波多野结衣在线一区| 亚洲免费在线视频一区 二区| 日本乱人伦aⅴ精品| 午夜久久久久久| 精品国产91洋老外米糕| 成人小视频在线观看| 亚洲欧美另类小说视频| 欧美日韩激情一区二区三区| 日韩极品在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 国产成人精品三级| 一区二区三区不卡视频在线观看| 欧美亚洲动漫另类| 麻豆91在线看| 国产精品久久久久久久久果冻传媒 | 色综合久久中文字幕综合网| 亚洲国产视频一区| 精品国产区一区| 99九九99九九九视频精品| 亚洲国产成人av| 久久久精品天堂| 欧美三级电影一区| 国产呦精品一区二区三区网站| 中文字幕一区二区三区精华液| 欧美色涩在线第一页| 国内精品免费在线观看| 亚洲视频一二区| 精品国产欧美一区二区| 日本道精品一区二区三区| 久久99精品视频| 一区二区三区.www| 国产日韩欧美精品综合| 欧美日韩一二三| 不卡一区二区在线| 麻豆免费精品视频| 一区二区欧美精品| 国产亚洲一区字幕| 欧美一区二区视频在线观看2020 | 日av在线不卡| 国产精品对白交换视频| 欧美一二三在线| 91麻豆福利精品推荐| 激情都市一区二区| 亚洲成人先锋电影| 国产精品久线在线观看| 精品国产麻豆免费人成网站| 91福利国产成人精品照片| 国产黄色精品视频| 蜜桃精品视频在线观看| 一区二区成人在线观看| 国产精品全国免费观看高清| 欧美刺激午夜性久久久久久久| 欧美中文字幕久久| 成人美女在线观看| 国产综合色精品一区二区三区| 亚洲bdsm女犯bdsm网站| 亚洲免费av网站| 国产精品理论片在线观看| 久久免费视频一区| 精品国一区二区三区| 日韩一级片网站| 欧美久久一二区| 欧美精品自拍偷拍动漫精品| 91久久香蕉国产日韩欧美9色| 成人黄色大片在线观看| 成人一级黄色片| 成人污污视频在线观看| 国产精品99精品久久免费| 国产综合久久久久久久久久久久| 奇米色777欧美一区二区| 亚洲 欧美综合在线网络| 亚洲国产一区二区视频| 亚洲午夜在线电影| 婷婷成人综合网| 日韩av电影免费观看高清完整版 | 亚洲免费在线视频一区 二区| 亚洲欧洲另类国产综合| 亚洲丝袜另类动漫二区| 亚洲六月丁香色婷婷综合久久| 亚洲欧美偷拍另类a∨色屁股| 综合久久一区二区三区| 一区二区成人在线| 日韩精品乱码av一区二区| 人禽交欧美网站| 韩国在线一区二区| 国产激情一区二区三区四区| 成年人午夜久久久| 在线观看网站黄不卡| 欧美精品乱码久久久久久| 日韩美女视频在线| 欧美国产在线观看| 一区二区三区在线视频观看58| 亚洲无人区一区| 久久99久久久久久久久久久| 国产成人精品影视| 在线看日本不卡| 欧美一区二区在线不卡| 国产亚洲成av人在线观看导航| 日韩理论片网站| 奇米四色…亚洲| 成人激情免费网站| 欧美三级日韩在线| 久久久久高清精品| 夜夜嗨av一区二区三区四季av| 日韩高清欧美激情| 国产成a人亚洲精| 欧美日韩精品一区二区三区蜜桃| 欧美刺激午夜性久久久久久久| 中文文精品字幕一区二区| 亚洲不卡一区二区三区| 国产一二精品视频| 欧美日韩精品电影| 日本一区二区三区dvd视频在线| 亚洲一区二区三区视频在线播放| 另类中文字幕网| 色噜噜夜夜夜综合网| xf在线a精品一区二区视频网站| 亚洲码国产岛国毛片在线| 久久狠狠亚洲综合| 欧美亚洲国产一区二区三区va| 国产日韩亚洲欧美综合| 天天综合网天天综合色| 99久久婷婷国产| 精品国产一区二区精华| 亚洲国产成人va在线观看天堂| 国产精品99久| 精品国产三级a在线观看| 亚洲国产精品一区二区久久| 成人h精品动漫一区二区三区| 欧美一区二区视频网站| 亚洲精品第一国产综合野| 国产精品自产自拍| 91精品久久久久久蜜臀| 亚洲综合无码一区二区| 成人蜜臀av电影| 国产亚洲精品福利| 九九**精品视频免费播放| 欧美日韩美少妇| 亚洲三级理论片| 欧美日韩在线免费视频| 同产精品九九九| yourporn久久国产精品| 久久亚洲一级片| 久久99国产乱子伦精品免费| 欧美日韩精品电影| 亚洲国产精品视频| 在线视频欧美精品| 亚洲免费三区一区二区| 91在线精品秘密一区二区| 久久精品视频一区二区| 国产精品一区二区在线观看不卡| 日韩精品影音先锋| 韩国三级在线一区| 26uuu亚洲| 成人做爰69片免费看网站| wwwwww.欧美系列|