📄 ui.h
字号:
//*****************************************************************************
//
// ui.h - Prototypes for the user interface.
//
// Copyright (c) 2007-2008 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. You may not combine
// this software with "viral" open-source software in order to form a larger
// program. 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 716 of the BLDC motor application.
//
//*****************************************************************************
#ifndef __UI_H__
#define __UI_H__
//*****************************************************************************
//
//! \addtogroup ui_api
//! @{
//
//*****************************************************************************
//*****************************************************************************
//
//! This structure contains the Brushless DC motor parameters that are saved to
//! flash. A copy exists in RAM for use during the execution of the
//! application, which is loaded form flash at startup. The modified parameter
//! block can also be written back to flash for use on the next power cycle.
//!
//! Note: All parameters exist in the version zero parameter block unless it is
//! explicitly stated otherwise. If an older parameter block is loaded from
//! flash, the new parameters will get filled in with default values. When the
//! parameter block is written to flash, it will always be written with the
//! latest parameter block version.
//
//*****************************************************************************
typedef struct
{
//
//! The sequence number of this parameter block. When in RAM, this value
//! is not used. When in flash, this value is used to determine the
//! parameter block with the most recent information.
//
unsigned char ucSequenceNum;
//
//! The CRC of the parameter block. When in RAM, this value is not used.
//! When in flash, this value is used to validate the contents of the
//! parameter block (to avoid using a partially written parameter block).
//
unsigned char ucCRC;
//
//! The version of this parameter block. This can be used to distinguish
//! saved parameters that correspond to an old version of the parameter
//! block.
//
unsigned char ucVersion;
//
//! The minimum width of a PWM pulse, specified in 0.1 us periods.
//
unsigned char ucMinPulseWidth;
//
//! The dead time between inverting the high and low side of a motor phase,
//! specified in 20 ns periods.
//
unsigned char ucDeadTime;
//
//! The rate at which the PWM pulse width is updated, specified in the
//! number of PWM periods.
//
unsigned char ucUpdateRate;
//
//! The number of pole pairs in the motor.
//
unsigned char ucNumPoles;
//
//! Padding to ensure consistent parameter block alignment.
//
unsigned char ucPad1[1];
//
//! The rate of acceleration, specified in RPM per second.
//
unsigned short usAccel;
//
//! The rate of deceleration, specified in RPM per second.
//
unsigned short usDecel;
//
//! The minimum current through the motor drive during operation, specified
//! in milli-amperes.
//
short sMinCurrent;
//
//! The maximum current through the motor drive during operation, specified
//! in milli-amperes.
//
short sMaxCurrent;
//
//! The amount of time to precharge the bootstrap capacitor on the high
//! side gate drivers, specified in milliseconds.
//
unsigned char ucPrechargeTime;
//
//! The maximum ambient temperature of the microcontroller, specified in
//! degrees Celsius.
//
unsigned char ucMaxTemperature;
//
//! A set of flags, enumerated by FLAG_PWM_FREQUENCY_MASK,
//! FLAG_DRIVE_BIT, FLAG_DIR_BIT,
//! FLAG_ENCODER_BIT, FLAG_BRAKE_BIT,
//! FLAG_SENSOR_BIT, FLAG_SENSOR_TYPE_BIT,
//! and FLAG_SENSOR_POLARITY_BIT.
//
unsigned short usFlags;
//
//! The number of lines in the (optional) optical encoder.
//
unsigned short usNumEncoderLines;
//
//! Padding to ensure consistent parameter block alignment.
//
unsigned char ucPad2[2];
//
//! The minimum speed of the motor drive, specified in RPM.
//
unsigned long ulMinSpeed;
//
//! The maximum speed of the motor drive, specified in RPM.
//
unsigned long ulMaxSpeed;
//
//! The minimum bus voltage during operation, specified in millivolts.
//
unsigned long ulMinVBus;
//
//! The maximum bus voltage during operation, specified in millivolts.
//
unsigned long ulMaxVBus;
//
//! The bus voltage at which the braking circuit is engaged, specified in
//! millivolts.
//
unsigned long ulBrakeOnV;
//
//! The bus voltage at which the braking circuit is disengaged, specified
//! in millivolts.
//
unsigned long ulBrakeOffV;
//
//! The DC bus voltage at which the deceleration rate is reduced, specified
//! in millivolts.
//
unsigned long ulDecelV;
//
//! The P coefficient of the frequency adjust PID controller.
//
long lFAdjP;
//
//! The I coefficient of the frequency adjust PID controller.
//
long lFAdjI;
//
//! The D coefficient of the frequency adjust PID controller.
//
long lFAdjD;
//
//! The amount of time (assuming continuous application) that the dynamic
//! braking can be utilized, specified in milliseconds.
//
unsigned long ulBrakeMax;
//
//! The amount of accumulated time that the dynamic brake can have before
//! the cooling period will end, specified in milliseconds.
//
unsigned long ulBrakeCool;
//
//! The motor current at which the acceleration rate is reduced, specified
//! in milli-amperes.
//
short sAccelCurrent;
//
//! Padding to ensure consistent parameter block alignment.
//
unsigned char ucPad3[2];
//
//! The Ethernet Connection Timeout, specified in seconds.
//
unsigned long ulConnectionTimeout;
//
//! The forced duty cycle percentage for startup in sensorless mode.
//
unsigned char ucStartupDutyCycle;
//
//! Padding to ensure consistent parameter block alignment.
//
unsigned char ucPad4[3];
//
//! The number of counts (commutations) for startup in sensorless mode.
//
unsigned long ulStartupCount;
//
//! The motor current limit for motor operation.
//
short sTargetCurrent;
//
//! Padding to ensure consistent parameter block alignment.
//
unsigned char ucPad5[38];
}
tDriveParameters;
//*****************************************************************************
//
//! The mask for the bits in the usFlags member of #tDriveParameters that
//! define the PWM output frequency. This field will be one of
//! #FLAG_PWM_FREQUENCY_8K, #FLAG_PWM_FREQUENCY_12K, #FLAG_PWM_FREQUENCY_16K,
//! or #FLAG_PWM_FREQUENCY_20K.
//
//*****************************************************************************
#define FLAG_PWM_FREQUENCY_MASK 0x00000003
//*****************************************************************************
//
//! The value of the #FLAG_PWM_FREQUENCY_MASK bit field that indicates that the
//! PWM frequency is 8 KHz.
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -