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

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

?? 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);

    //

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线成人高清不卡| 成人91在线观看| 欧美日韩黄色影视| 亚洲二区在线视频| 3d动漫精品啪啪1区2区免费| 婷婷综合五月天| 日韩一区二区影院| 国内精品伊人久久久久av影院| 精品成人私密视频| 成人激情小说网站| 一区二区三区四区在线| 精品污污网站免费看| 日韩经典一区二区| 国产日韩欧美综合一区| av电影天堂一区二区在线观看| 亚洲免费av网站| 欧美日韩精品一区二区三区四区 | 久久精品久久精品| 久久九九99视频| 日本精品裸体写真集在线观看| 一区二区成人在线视频| 日韩一区二区三区四区| 成人国产视频在线观看| 亚洲va欧美va人人爽| 精品国产青草久久久久福利| 成人少妇影院yyyy| 午夜精品一区在线观看| 亚洲午夜一二三区视频| 日韩一区二区三区在线视频| 成人免费看黄yyy456| 婷婷综合在线观看| 国产精品无圣光一区二区| 在线国产电影不卡| 久久99精品久久久久久动态图| 17c精品麻豆一区二区免费| 欧美一区二区三区四区视频| 丁香婷婷深情五月亚洲| 青青草国产成人99久久| 综合自拍亚洲综合图不卡区| 日韩一区二区三免费高清| 成人国产精品免费观看视频| 日本亚洲最大的色成网站www| 国产精品久久久久9999吃药| 91精品国产日韩91久久久久久| 成人性生交大片免费看在线播放| 婷婷中文字幕一区三区| 国产精品对白交换视频| 精品88久久久久88久久久| 欧美在线制服丝袜| av在线一区二区三区| 久久99国产精品麻豆| 亚洲国产aⅴ天堂久久| 国产精品久久久久久福利一牛影视 | 欧美一区二区三区四区在线观看| 不卡一区二区在线| 精品一区二区三区日韩| 亚洲一二三专区| 国产精品国产精品国产专区不蜜| 日韩欧美一级二级三级久久久| 在线观看www91| 一本大道久久a久久综合| 国产精品系列在线播放| 美国十次了思思久久精品导航| 洋洋av久久久久久久一区| 国产精品污www在线观看| 久久噜噜亚洲综合| 日韩欧美一二三| 欧美老肥妇做.爰bbww视频| 色婷婷国产精品| 色婷婷av一区| 日本高清不卡aⅴ免费网站| 成人av资源网站| 国产91富婆露脸刺激对白| 国产精品综合一区二区三区| 极品少妇xxxx精品少妇| 久久不见久久见免费视频1| 麻豆精品视频在线观看免费| 日本在线观看不卡视频| 日本美女一区二区三区视频| 日韩电影在线观看一区| 免费精品视频最新在线| 日韩二区在线观看| 美女在线视频一区| 蜜臀久久99精品久久久久久9| 琪琪久久久久日韩精品| 久久草av在线| 国产精品18久久久久久久久久久久 | 日韩毛片在线免费观看| 自拍偷拍国产亚洲| 一区二区在线观看免费| 亚洲网友自拍偷拍| 日本欧美韩国一区三区| 九一九一国产精品| 丁香婷婷综合五月| 色综合天天性综合| 欧美日韩国产综合草草| 7777女厕盗摄久久久| 精品国产乱码91久久久久久网站| xvideos.蜜桃一区二区| 欧美激情一区二区| 亚洲视频一区二区在线| 亚洲国产aⅴ成人精品无吗| 视频一区二区三区中文字幕| 久久精品理论片| 国产精品白丝av| 日本韩国一区二区| 欧美一区二区三区免费| 久久久亚洲国产美女国产盗摄| 欧美韩国日本不卡| 亚洲一区二区五区| 久久av中文字幕片| 99天天综合性| 91精品午夜视频| 欧美激情综合五月色丁香小说| 一区二区久久久| 精品影院一区二区久久久| 91在线观看免费视频| 69av一区二区三区| 国产精品久久久久一区| 日韩二区三区在线观看| 成人app软件下载大全免费| 欧美老女人在线| 欧美精品一区二区高清在线观看| 日韩理论在线观看| 免费观看成人鲁鲁鲁鲁鲁视频| 国产成人av自拍| 欧美精品 日韩| 亚洲欧美综合网| 青青草国产精品97视觉盛宴| 97精品久久久午夜一区二区三区| 91精品国产乱码| 亚洲免费在线看| 国产一区在线观看视频| 欧美色图一区二区三区| 久久久久久久久一| 午夜精品一区二区三区电影天堂 | 亚洲精品ww久久久久久p站| 激情综合亚洲精品| 欧美日韩另类国产亚洲欧美一级| 中文字幕精品一区| 久久99久久99精品免视看婷婷| 一本色道久久综合亚洲91| 日韩三区在线观看| 五月综合激情网| 一本一本久久a久久精品综合麻豆| 精品毛片乱码1区2区3区| 91国产成人在线| 国产精品久久看| 国产一区 二区 三区一级| 这里只有精品电影| 亚洲最大色网站| 99久久久免费精品国产一区二区| 久久久久久毛片| 激情综合色播五月| 日韩一区二区免费在线观看| 亚洲美女区一区| 北条麻妃国产九九精品视频| 久久免费国产精品| 国产一区三区三区| 欧美大胆人体bbbb| 美女视频一区二区三区| 欧美日本一区二区在线观看| 一区二区三区在线免费| 一道本成人在线| 一区二区三区欧美激情| 色哟哟国产精品免费观看| 国产精品久久久久永久免费观看 | 综合在线观看色| 99久久精品99国产精品| 国产精品美女久久久久久久网站| 国产精品一级片| 中文字幕免费不卡在线| 99这里只有精品| 亚洲男同性恋视频| 在线国产亚洲欧美| 亚洲成人免费电影| 欧美人体做爰大胆视频| 日韩国产精品久久| 精品国产乱码久久| 国产白丝精品91爽爽久久| 国产精品久久久久久久蜜臀| 99久久夜色精品国产网站| 亚洲欧洲av色图| 欧美视频中文字幕| 日本在线不卡视频一二三区| 日韩欧美一二三| 粉嫩av一区二区三区在线播放| 国产精品二区一区二区aⅴ污介绍| 91视频免费观看| 亚洲最大成人网4388xx| 欧美高清视频一二三区| 国产资源在线一区| 17c精品麻豆一区二区免费| 欧美伊人久久大香线蕉综合69 | 免费在线观看视频一区| 久久精品视频一区二区三区| 不卡视频免费播放| 亚洲成人av一区| 久久久精品天堂| 日本道免费精品一区二区三区|