⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i2ccmds.h

📁 CNC.rar
💻 H
字号:
//*****************************************************************************
//
// i2ccmds.h - Commands that can be sent to the main micro's I2C slave.
//
// 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.
//
//*****************************************************************************

#ifndef __I2CCMDS_H__
#define __I2CCMDS_H__

//*****************************************************************************
//
//! \page i2ccmds_intro Introduction
//!
//! An I2C link is utilized to communicate between the main microcontroller and
//! the user interface microcontroller.  The main microcontroller is the I2C
//! slave and the user interface microcontroller is the I2C master.  The user
//! interface microcontroller can send commands to the main microcontroller and
//! can read status information from it as well.
//!
//! I2C writes to the slave are commands that instruct the main microcontroller
//! how to operate.  The commands can be broken into three groups:
//!
//! - Commands that configuration the demonstrations.  These commands are
//!   #CMD_DEMO1, #CMD_DEMO2, #CMD_DEMO3, #CMD_DEMO4, #CMD_DEMO5, #CMD_DEMO6,
//!   #CMD_NAME_STRING, #CMD_ICONS, and #CMD_TOOL.
//!
//! - Commands for diagnostic purposes.  These commands are #CMD_X_PLUS,
//!   #CMD_X_MINUS, #CMD_Y_PLUS, #CMD_Y_MINUS, #CMD_Z_PLUS, and #CMD_Z_MINUS.
//!
//! - Commands that control operation of the CNC machine.  These commands are
//!   #CMD_RUN, #CMD_STOP, and #CMD_SHIP.
//!
//! I2C reads from the slave return status information about the state of the
//! CNC machine.  The following data is returned from a I2C read (with the
//! first byte being the one returned immediately after a I2C start condition):
//!
//! - The first byte is zero if the machine is not operating and one if it is
//!   operating.
//!
//! - The second byte contains the current state of the limit switches.  Bit
//!   zero contains the state of the X home limit switch.  Bit one contains the
//!   state of the X limit switch.  Bit two contains the state of the Y home
//!   limit switch.  Bit three contains the state of the Y limit switch.  Bit
//!   four contains the state of the Z home limit switch.  Bit five contains
//!   the state of the Z limit switch.  Bit six contains the state of the panic
//!   switch.
//!
//! - The third and fourth bytes are zero.
//!
//! - Bytes five through eight contain the current X position of the gantry,
//!   specified in steps.
//!
//! - Bytes nine through twelve contain the current Y position of the gantry,
//!   specified in steps.
//!
//! - Bytes thirteen through sixteen contain the current Z position of the
//!   gantry, specified in steps.
//!
//! - All further bytes of status read from the slave will be zero bytes.
//!
//! The definitions for the I2C commands are contained in <tt>i2ccmds.h</tt>.
//
//*****************************************************************************

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

//*****************************************************************************
//
//! The I2C address of the slave on the main microcontroller.
//
//*****************************************************************************
#define I2C_SLAVE_ADDR          0x34

//*****************************************************************************
//
//! A diagnostic command to move the X axis in the positive direction.  The
//! machine will continue to move until the #CMD_STOP command is received.
//
//*****************************************************************************
#define CMD_X_PLUS              0x10

//*****************************************************************************
//
//! A diagnostic command to move the X axis in the negative direction.  The
//! machine will continue to move until the #CMD_STOP command is received.
//
//*****************************************************************************
#define CMD_X_MINUS             0x11

//*****************************************************************************
//
//! A diagnostic command to move the Y axis in the positive direction.  The
//! machine will continue to move until the #CMD_STOP command is received.
//
//*****************************************************************************
#define CMD_Y_PLUS              0x12

//*****************************************************************************
//
//! A diagnostic command to move the Y axis in the negative direction.  The
//! machine will continue to move until the #CMD_STOP command is received.
//
//*****************************************************************************
#define CMD_Y_MINUS             0x13

//*****************************************************************************
//
//! A diagnostic command to move the Z axis in the positive direction.  The
//! machine will continue to move until the #CMD_STOP command is received.
//
//*****************************************************************************
#define CMD_Z_PLUS              0x14

//*****************************************************************************
//
//! A diagnostic command to move the Z axis in the negative direction.  The
//! machine will continue to move until the #CMD_STOP command is received.
//
//*****************************************************************************
#define CMD_Z_MINUS             0x15

//*****************************************************************************
//
//! This command selects the first demonstration as the one to be executed when
//! the #CMD_RUN command is received.
//
//*****************************************************************************
#define CMD_DEMO1               0x20

//*****************************************************************************
//
//! This command selects the second demonstration as the one to be executed
//! when the #CMD_RUN command is received.
//
//*****************************************************************************
#define CMD_DEMO2               0x21

//*****************************************************************************
//
//! This command selects the third demonstration as the one to be executed when
//! the #CMD_RUN command is received.
//
//*****************************************************************************
#define CMD_DEMO3               0x22

//*****************************************************************************
//
//! This command selects the fourth demonstration as the one to be executed
//! when the #CMD_RUN command is received.
//
//*****************************************************************************
#define CMD_DEMO4               0x23

//*****************************************************************************
//
//! This command selects the fifth demonstration as the one to be executed when
//! the #CMD_RUN command is received.
//
//*****************************************************************************
#define CMD_DEMO5               0x24

//*****************************************************************************
//
//! This command selects the sixth demonstration as the one to be executed when
//! the #CMD_RUN command is received.
//
//*****************************************************************************
#define CMD_DEMO6               0x25

//*****************************************************************************
//
//! This command is used to send the string to be drawn.  All bytes following
//! this command are interpreted as the string to be drawn.  This string is
//! only used by demonstration mode one and two.
//
//*****************************************************************************
#define CMD_NAME_STRING         0x30

//*****************************************************************************
//
//! This command selects the optional icons to be drawn with the string, as
//! specified in the byte that follows this command.  Bit zero selects the
//! Luminary Micro logo and bit one selects the ARM logo.  Only one logo can be
//! selected at a time, and lower numbered bits take prescendent over higher
//! numbered bits.
//
//*****************************************************************************
#define CMD_ICONS               0x31

//*****************************************************************************
//
//! This command specifies the tool to be used, as specified by the byte that
//! follows this command.  A byte of 0x00 specifies that the pen is connected
//! to the machine.  A byte of 0x10 specifies that the router is connected and
//! should be run 25 mil (0.635 mm) into the work surface.  A byte of 0x11
//! specifies that the router is connected and should be run 50 mil (1.27 mm)
//! into the work surface.  A byte of 0x12 specifies that the router is
//! connected and should be run 75 mil (1.905 mm) into the work surface.  A
//! byte of 0x13 specifies that the router is connected and should be run 100
//! mil (2.54 mm) into the work surface.
//
//*****************************************************************************
#define CMD_TOOL                0x32

//*****************************************************************************
//
//! This command causes the machine to start running in the selected
//! demonstration mode.
//
//*****************************************************************************
#define CMD_RUN                 0x40

//*****************************************************************************
//
//! This command causes the machine to stop running immediately, aborting the
//! current demonstration or diagnostic move.
//
//*****************************************************************************
#define CMD_STOP                0x41

//*****************************************************************************
//
//! This command causes the machine to move the gantries to the shipping
//! position so that they fit into the packing crate.
//
//*****************************************************************************
#define CMD_SHIP                0x42

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

#endif // __I2CCMDS_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -