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

📄 ui.c

📁 Luminary Micro BLDC motor control software
💻 C
📖 第 1 页 / 共 5 页
字号:
    //
    // The DC bus voltage at which the deceleration rate is reduced (ulDecelV).
    //
    35000,

    //
    // The frequency adjust P coefficient (lFAdjP).
    //
    (65536 * 8),

    //
    // The frequency adjust I coefficient (lFAdjI).
    //
    1000,

    //
    // The frequency adjust D coefficient (lFAdjD).
    //
    0,

    //
    // The brake maximum time (ulBrakeMax).
    //
    60 * 1000,

    //
    // The brake cooling time (ulBrakeCool).
    //
    55 * 1000,

    //
    // The motor current at which the acceleration rate is reduced, specified
    // in milli-amperes (sAccelCurrent).
    //
    5000,

    //
    // Padding (2 Bytes)
    //
    {0, 0},

    //
    // The ethernet connection timeout, specified in seconds
    // (ulConnectionTimeout).
    //
    10,

    //
    // The forced duty cycle percentage for startup in sensorless mode
    // (ucStartupDutyCycle).
    //
    16,

    //
    // Padding (3 Bytes)
    //
    {0, 0, 0},

    //
    // The number of counts (commutations) for startup in sensorless mode
    // (ucStartupCount).
    //
    10,

    //
    // The motor current limit for motor operation (sTargetCurrent).
    //
    0,

    //
    // Padding (38 Bytes)
    //
    {
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0
    },

};

//*****************************************************************************
//
//! The target drive frequency.
//
//*****************************************************************************
unsigned long g_ulTargetSpeed = 3000;

//*****************************************************************************
//
//! The target type for this drive.  This is used by the user interface
//! module.
//
//*****************************************************************************
const unsigned long g_ulUITargetType = RESP_ID_TARGET_BLDC;

//*****************************************************************************
//
//! The version of the firmware.  Changing this value will make it much more
//! difficult for Luminary Micro support personnel to determine the firmware in
//! use when trying to provide assistance; it should only be changed after
//! careful consideration.
//
//*****************************************************************************
const unsigned short g_usFirmwareVersion = 716;

//*****************************************************************************
//
//! An array of structures describing the Brushless DC motor drive parameters
//! to the Ethernet user interface module.
//
//*****************************************************************************
const tUIParameter g_sUIParameters[] =
{
    //
    // The firmware version.
    //
    {
        PARAM_FIRMWARE_VERSION,
        2,
        0,
        0,
        0,
        (unsigned char *)&g_usFirmwareVersion,
        0
    },

    //
    // The minimum motor speed.  This is specified in RPM, ranging from 0 to
    // 20000 RPM.
    //
    {
        PARAM_MIN_SPEED,
        4,
        0,
        60000,
        1,
        (unsigned char *)&(g_sParameters.ulMinSpeed),
        0
    },

    //
    // The maximum motor speed.  This is specified in RPM, ranging from 0 to
    // 20000 RPM.
    //
    {
        PARAM_MAX_SPEED,
        4,
        0,
        60000,
        1,
        (unsigned char *)&(g_sParameters.ulMaxSpeed),
        UIFAdjI
    },

    //
    // The target motor speed.  This is specified in RPM, ranging from 0 to
    // 20000 RPM.
    //
    {
        PARAM_TARGET_SPEED,
        4,
        0,
        60000,
        1,
        (unsigned char *)&(g_ulTargetSpeed),
        MainSetSpeed
    },

    //
    // The current motor speed.  This is specified in RPM, ranging from 0 to
    // 20000 RPM.  This is a read-only parameter.
    //
    {
        PARAM_CURRENT_SPEED,
        4,
        0,
        60000,
        0,
        (unsigned char *)&g_ulMeasuredSpeed,
        0
    },

    //
    // The acceleration rate for the motor drive.  This is specified in RPM per
    // second, ranging from 1 RPM/sec to 50000 RPM/sec.
    //
    {
        PARAM_ACCEL,
        2,
        1,
        50000,
        1,
        (unsigned char *)&(g_sParameters.usAccel),
        0
    },

    //
    // The deceleration rate for the motor drive.  This is specified in RPM per
    // second, ranging from 1 RPM/sec to 6000 RPM/sec.
    //
    {
        PARAM_DECEL,
        2,
        1,
        50000,
        1,
        (unsigned char *)&(g_sParameters.usDecel),
        0
    },

    //
    // Indication of the presence of an encoder feedback.  This is a boolean
    // that is true when an encoder is present.
    //
    {
        PARAM_ENCODER_PRESENT,
        1,
        0,
        1,
        1,
        &g_ucEncoder,
        UIEncoderPresent
    },

    //
    // Indication of the presence of a sensor feedback.  This is a boolean
    // that is true when a Hall Effect sensor is present.
    //
    {
        PARAM_SENSOR_PRESENT,
        1,
        0,
        1,
        1,
        &g_ucSensor,
        UISensorPresent
    },

    //
    // Indication of the type of sensor feedback.  This is a boolean
    // that is true when a Linear Hall Effect sensor is present.
    //
    {
        PARAM_SENSOR_TYPE,
        1,
        0,
        1,
        1,
        &g_ucSensorType,
        UISensorType
    },

    //
    // Indication of the polarity of sensor feedback.  This is a boolean
    // that is true when the sensors are active high, and false for active
    // low sensors.
    //
    {
        PARAM_SENSOR_POLARITY,
        1,
        0,
        1,
        1,
        &g_ucSensorPolarity,
        UISensorPolarity
    },

    //
    // The type of modulation to be used to drive the motor.  When the value is
    // zero, sine wave modulation is used.  When the value is one, trapezoid
    // modulation is used.
    //
    {
        PARAM_MODULATION,
        1,
        0,
        1,
        1,
        &g_ucModulation,
        UIModulationType
    },

    //
    // The direction of motor rotation.  When the value is zero, the motor is
    // driven in the forward direction.  When the value is one, the motor is
    // driven in the backward direction.
    //
    {
        PARAM_DIRECTION,
        1,
        0,
        1,
        1,
        &g_ucDirection,
        UIDirectionSet
    },

    //
    // The PWM frequency to be used.  When this value is zero, the PWM
    // frequency is 8 KHz.  When this value is one, the PWM frequency is
    // 12.5 KHz.  When this value is two, the PWM frequency is 16 KHz.  When
    // this value is three, the PWM frequency is 20 KHz.
    //
    {
        PARAM_PWM_FREQUENCY,
        1,
        0,
        3,
        1,
        &g_ucFrequency,
        UIPWMFrequencySet
    },

    //
    // The dead-time between switching off one side of a motor phase (high or
    // low) and turning on the other.  This is specified in 20 nanoseconds
    // units, ranging from 500 ns to 5100 ns.
    //
    {
        PARAM_PWM_DEAD_TIME,
        1,
        25,
        255,
        1,
        &(g_sParameters.ucDeadTime),
        PWMSetDeadBand
    },

    //
    // The rate at which the PWM duty cycles are updated.  This is specified in
    // PWM periods, ranging from 1 to 256.
    //
    {
        PARAM_PWM_UPDATE,
        1,
        0,
        255,
        1,
        &g_ucUpdateRate,
        UIUpdateRate
    },

    //
    // The minimum PWM pulse width.  This is specified in 1/10ths of a
    // microsecond, ranging from 0 us to 25 us.
    //
    {
        PARAM_PWM_MIN_PULSE,
        1,
        0,
        250,
        1,
        &(g_sParameters.ucMinPulseWidth),
        PWMSetMinPulseWidth
    },

    //
    // The number of poles in the motor.  This ranges from 1 to 256 poles.
    //
    {
        PARAM_NUM_POLES,
        1,
        0,
        255,
        1,
        &(g_sParameters.ucNumPoles),
        0
    },

    //
    // The number of lines in the encoder attached to the motor.  This ranges
    // from 1 to 65536 lines.
    //
    {
        PARAM_NUM_LINES,
        2,
        0,
        65535,
        1,
        (unsigned char *)&(g_sParameters.usNumEncoderLines),
        0
    },

    //
    // The minimum allowable drive current during operation.  This is specified
    // in milli-amperes, ranging from 0 to 10A.
    //
    {
        PARAM_MIN_CURRENT,
        2,
        0,
        10000,
        100,
        (unsigned char *)&(g_sParameters.sMinCurrent),
        0
    },

    //
    // The maximum allowable drive current during operation.  This is specified
    // in milli-amperes, ranging from 0 to 10A.
    //
    {
        PARAM_MAX_CURRENT,
        2,
        0,
        10000,
        100,
        (unsigned char *)&(g_sParameters.sMaxCurrent),
        0
    },

    //
    // The target drive current during operation.  This is specified
    // in milli-amperes, ranging from 0 to 10A.
    //
    {
        PARAM_TARGET_CURRENT,
        2,
        0,
        10000,
        100,
        (unsigned char *)&(g_sParameters.sTargetCurrent),
        0
    },

    //
    // The minimum allowable bus voltage during operation.  This is specified
    // in millivolts, ranging from 1 V to 40 V.
    //
    {
        PARAM_MIN_BUS_VOLTAGE,
        4,
        1000,
        40000,
        100,
        (unsigned char *)&(g_sParameters.ulMinVBus),
        0
    },

    //
    // The maximum allowable bus voltage during operation.  This is specified
    // in millivolts, ranging from 1 V to 40 V.
    //
    {
        PARAM_MAX_BUS_VOLTAGE,
        4,
        1000,
        40000,
        100,
        (unsigned char *)&(g_sParameters.ulMaxVBus),
        0
    },

    //
    // The P coefficient for the frequency adjust PI controller.
    //
    {
        PARAM_SPEED_P,
        4,
        0x80000000,
        0x7fffffff,
        1,
        (unsigned char *)&(g_sParameters.lFAdjP),
        0

⌨️ 快捷键说明

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