📄 ui.c
字号:
},
//
// The I coefficient for the frequency adjust PI controller.
//
{
PARAM_SPEED_I,
4,
0x80000000,
0x7fffffff,
1,
(unsigned char *)&g_lFAdjI,
UIFAdjI
},
//
// The voltage at which the brake circuit is applied. This is specified in
// millivolts, ranging from 1 V to 40 V.
//
{
PARAM_BRAKE_ON_VOLTAGE,
4,
1000,
40000,
100,
(unsigned char *)&(g_sParameters.ulBrakeOnV),
0
},
//
// The voltage at which the brake circuit is disengaged. This is specified
// in millivolts, ranging from 1 V to 40 V.
//
{
PARAM_BRAKE_OFF_VOLTAGE,
4,
1000,
40000,
100,
(unsigned char *)&(g_sParameters.ulBrakeOffV),
0
},
//
// This indicates if the on-board user interface should be utilized. When
// one, the on-board user interface is active, and when zero it is not.
//
{
PARAM_USE_ONBOARD_UI,
1,
0,
1,
1,
(unsigned char *)&g_ulUIUseOnboard,
0
},
//
// The amount of time to precharge the bootstrap capacitor on the high side
// gate driver before starting the motor drive, specified in milliseconds.
//
{
PARAM_PRECHARGE_TIME,
1,
0,
255,
1,
&(g_sParameters.ucPrechargeTime),
0
},
//
// This indicates if dynamic braking should be utilized. When one, dynamic
// braking is active, and when zero it is not.
//
{
PARAM_USE_DYNAM_BRAKE,
1,
0,
1,
1,
&g_ucDynamicBrake,
UIDynamicBrake
},
//
// The maximum amount of time to apply dynamic braking, specified in
// milliseconds.
//
{
PARAM_MAX_BRAKE_TIME,
4,
0,
60 * 1000,
1,
(unsigned char *)&(g_sParameters.ulBrakeMax),
0
},
//
// The time at which dynamic braking can be reapplied after entering its
// cooling mode, specified in milliseconds. Note that the cooling time is
// the maximum braking time minus this parameter.
//
{
PARAM_BRAKE_COOL_TIME,
4,
0,
60 * 1000,
1,
(unsigned char *)&(g_sParameters.ulBrakeCool),
0
},
//
// The fault status flags.
//
{
PARAM_FAULT_STATUS,
1,
0,
255,
1,
(unsigned char *)&g_ulFaultFlags,
MainClearFaults
},
//
// The motor status.
//
{
PARAM_MOTOR_STATUS,
1,
0,
0,
0,
&g_ucMotorStatus,
0
},
//
// The voltage at which the deceleration rate is reduced. This is
// specified in volts, raning from 1 V to 40 V.
//
{
PARAM_DECEL_VOLTAGE,
4,
1000,
40000,
100,
(unsigned char *)&(g_sParameters.ulDecelV),
0
},
//
// The maximum allowable ambient temperature. This is specified in degrees
// Celsius, ranging from 0 to 85 C.
//
{
PARAM_MAX_TEMPERATURE,
1,
0,
85,
1,
&(g_sParameters.ucMaxTemperature),
0
},
//
// The motor current at which the acceleration rate is reduced. This is
// specified in milli-amperes, ranging from 0 A to 10 A.
//
{
PARAM_ACCEL_CURRENT,
2,
0,
10000,
100,
(unsigned char *)&(g_sParameters.sAccelCurrent),
0
},
//
// The current decay mode.
//
{
PARAM_DECAY_MODE,
1,
0,
1,
1,
&g_ucDecayMode,
UIDecayMode,
},
//
// The current value of the GPIO data input(s).
//
{
PARAM_GPIO_DATA,
4,
0,
0xffffffff,
1,
(unsigned char *)&g_ulGPIOData,
0,
},
//
// The current number of packets received on the CAN interface.
//
{
PARAM_CAN_RX_COUNT,
4,
0,
0xffffffff,
1,
(unsigned char *)&g_ulCANRXCount,
0,
},
//
// The current number of packets transmitted on the CAN interface.
//
{
PARAM_CAN_TX_COUNT,
4,
0,
0xffffffff,
1,
(unsigned char *)&g_ulCANTXCount,
0,
},
//
// The current number of packets received on the Ethernet interface.
//
{
PARAM_ETH_RX_COUNT,
4,
0,
0xffffffff,
1,
(unsigned char *)&g_ulEthernetRXCount,
0,
},
//
// The current number of packets transmitted on the Ethernet interface.
//
{
PARAM_ETH_TX_COUNT,
4,
0,
0xffffffff,
1,
(unsigned char *)&g_ulEthernetTXCount,
0,
},
//
// The Ethernet TCP Connection Timeout.
//
{
PARAM_ETH_TCP_TIMEOUT,
4,
0,
0xffffffff,
1,
(unsigned char *)&g_sParameters.ulConnectionTimeout,
UIConnectionTimeout,
},
//
// The startup mode duty cycle width. This is specified in percentage,
// ranging from 1 to 100.
//
{
PARAM_STARTUP_DUTY,
1,
1,
100,
1,
&(g_sParameters.ucStartupDutyCycle),
0,
},
//
// The startup count for sensorless mode.
//
{
PARAM_STARTUP_COUNT,
4,
0,
0xffffffff,
1,
(unsigned char *)&(g_sParameters.ulStartupCount),
0,
},
};
//*****************************************************************************
//
//! The number of motor drive parameters. This is used by the user
//! interface module.
//
//*****************************************************************************
const unsigned long g_ulUINumParameters = (sizeof(g_sUIParameters) /
sizeof(g_sUIParameters[0]));
//*****************************************************************************
//
//! An array of structures describing the Brushless DC motor drive real-time
//! data items to the serial user interface module.
//
//*****************************************************************************
const tUIRealTimeData g_sUIRealTimeData[] =
{
//
// The current through phase A of the motor. This is a signed 16-bit
// value providing the current in milli-amperes.
//
{
DATA_PHASE_A_CURRENT,
2,
(unsigned char *)&(g_psPhaseCurrent[0])
},
//
// The current through phase B of the motor. This is a signed 16-bit
// value providing the current in milli-amperes.
//
{
DATA_PHASE_B_CURRENT,
2,
(unsigned char *)&(g_psPhaseCurrent[1])
},
//
// The current through phase C of the motor. This is a signed 16-bit
// value providing the current in milli-amperes.
//
{
DATA_PHASE_C_CURRENT,
2,
(unsigned char *)&(g_psPhaseCurrent[2])
},
//
// The current through the entire motor. This is a signed 16-bit
// value providing the current in milli-amperes.
//
{
DATA_MOTOR_CURRENT,
2,
(unsigned char *)&g_sMotorCurrent
},
//
// The voltage of the DC bus. This is a 32-bit value providing the voltage
// in milli-volts.
//
{
DATA_BUS_VOLTAGE,
4,
(unsigned char *)&g_ulBusVoltage
},
//
// The frequency of the rotor. This is a 16-bit value providing the
// motor speed in RPM.
//
{
DATA_ROTOR_SPEED,
4,
(unsigned char *)&g_ulMeasuredSpeed
},
//
// The processor usage. This is an 8-bit value providing the percentage
// between 0 and 100.
//
{
DATA_PROCESSOR_USAGE,
1,
&g_ucCPUUsage
},
//
// The state of the motor drive.
//
{
DATA_MOTOR_STATUS,
1,
&g_ucMotorStatus
},
//
// The fault status flags.
//
{
DATA_FAULT_STATUS,
1,
(unsigned char *)&g_ulFaultFlags
},
//
// The ambient temperature of the microcontroller. This is an 8-bit value
// providing the temperature in Celsius.
//
{
DATA_TEMPERATURE,
1,
(unsigned char *)&g_ucAmbientTemp
},
//
// The analog input voltage. This is a 16-bit value providing the analog
// input voltage in milli-volts.
//
{
DATA_ANALOG_INPUT,
2,
(unsigned char *)&g_usAnalogInputVoltage
},
//
// The analog input voltage. This is a 16-bit value providing the analog
// input voltage in milli-volts.
//
{
DATA_DEBUG_INFO,
4,
(unsigned char *)&g_ulDebugInfo
},
};
//*****************************************************************************
//
//! The number of motor drive real-time data items. This is used by the serial
//! user interface module.
//
//*****************************************************************************
const unsigned long g_ulUINumRealTimeData = (sizeof(g_sUIRealTimeData) /
sizeof(g_sUIRealTimeData[0]));
//*****************************************************************************
//
//! An array of structures describing the on-board switches.
//
//*****************************************************************************
const tUIOnboardSwitch g_sUISwitches[] =
{
//
// The run/stop/mode button. Pressing the button will cycle between
// stopped and running, and holding the switch for five seconds will toggle
// between sine wave and space vector modulation.
//
{
PIN_SWITCH_PIN_BIT,
UI_INT_RATE * 5,
UIButtonPress,
0,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -