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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? bldc.c

?? luminary芯片直流無刷電機控制程序
?? C
?? 第 1 頁 / 共 3 頁
字號:
    GPIOPinIntClear(HALL_PORT, HALL_A | HALL_B | HALL_C);    //    // Perform commutation if the motor is running.    //    if(g_iRunning == MOTOR_RUNNING)    {        //        // Get the current Hall effect sensor state.        //        ulHall = (GPIOPinRead(HALL_PORT, HALL_A | HALL_B | HALL_C) >>                  HALL_SHIFT);        //        // Get the set of PWM signals to be driven.        //        ulPWM = g_pulHallToPhase[ulHall];        //        // If drive direction is reversed, then invert the PWM signals.  This        // will reverse the current direction through the motor.        //        if(g_bReverse)        {            if(ulPWM & PHASE_A)            {                ulPWM ^= PHASE_A;            }            if(ulPWM & PHASE_B)            {                ulPWM ^= PHASE_B;            }            if(ulPWM & PHASE_C)            {                ulPWM ^= PHASE_C;            }        }        //        // Set the PWM signals to be driven.        //        PWMOutputState(PWM_BASE, ulPWM ^ (PHASE_A | PHASE_B | PHASE_C), false);        PWMOutputState(PWM_BASE, ulPWM, true);    }}//*****************************************************************************////! Configure the GPIO block to read from the Hall effect sensors.//!//! This function performs the setup on the GPIO block in order to properly//! interface with the Hall effect sensors on the motor.  The GPIO pins are//! configured as inputs with both edge interrupt generation, and an interrupt//! handler is installed to handle the interrupts caused by a change in the//! Hall effect sensor state.//!//! \return None.////*****************************************************************************static voidSetupGPIO(void){    //    // Configure the Hall effect GPIO pins as inputs with interrupt generation    // on both rising and falling edges.    //    GPIODirModeSet(HALL_PORT, HALL_A | HALL_B | HALL_C, GPIO_DIR_MODE_IN);    GPIOIntTypeSet(HALL_PORT, HALL_A | HALL_B | HALL_C, GPIO_BOTH_EDGES);    //    // Enable the Hall effect GPIO pin interrupts.    //    GPIOPinIntEnable(HALL_PORT, HALL_A | HALL_B | HALL_C);    IntEnable(HALL_INT);    //    // Changes in the hall effect sensors are the highest priority, so set the    // interrupt priority to the highest.    //    IntPrioritySet(HALL_INT, 0x00);}//*****************************************************************************////! Configure the PWM block to drive the motor.//!//! This function performs the setup on the PWM block in order to properly//! driver the windings of the motor.  The three generators are configured to//! run at the same rate and are synchronized.  All six outputs are disabled,//! non-inverted, and set to disable on fault conditions.//!//! \return None.////*****************************************************************************static voidSetupPWM(void){    //    // Enable the PWM peripheral.    //    SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM);    //    // Set the PWM clock divider.    //    SysCtlPWMClockSet(PWMDIV);    //    // Make the appropriate GPIO pins be PWM outputs instead of GPIO.    //    GPIODirModeSet(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW);    GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW);    GPIODirModeSet(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW);    //    // Set the PWM outputs to a non-inverted state with the signal disabled    // during fault conditions.    //    PWMOutputInvert(PWM_BASE, PHASE_A | PHASE_B | PHASE_C, false);    PWMOutputFault(PWM_BASE, PHASE_A | PHASE_B | PHASE_C, true);    //    // Disable the PWM outputs.    //    PWMOutputState(PWM_BASE, PHASE_A | PHASE_B | PHASE_C, false);    //    // Configure and enable the generators.    //    PWMGenConfigure(PWM_BASE, PWM_GEN_0,                    (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC |                     PWM_GEN_MODE_DBG_STOP));    PWMGenConfigure(PWM_BASE, PWM_GEN_1,                    (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC |                     PWM_GEN_MODE_DBG_STOP));    PWMGenConfigure(PWM_BASE, PWM_GEN_2,                    (PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_SYNC |                     PWM_GEN_MODE_DBG_STOP));    PWMGenEnable(PWM_BASE, PWM_GEN_0);    PWMGenEnable(PWM_BASE, PWM_GEN_1);    PWMGenEnable(PWM_BASE, PWM_GEN_2);    //    // Set the period of each generator timer.    //    PWMGenPeriodSet(PWM_BASE, PWM_GEN_0, g_ulPwmPeriod);    PWMGenPeriodSet(PWM_BASE, PWM_GEN_1, g_ulPwmPeriod);    PWMGenPeriodSet(PWM_BASE, PWM_GEN_2, g_ulPwmPeriod);    //    // Set the initial pulse width of the PWM signals to zero.    //    PWMPulseWidthSet(PWM_BASE, PWM_OUT_0, 0);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_1, 0);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_2, 0);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_3, 0);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_4, 0);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_5, 0);    //    // Synchronize the timers.    //    PWMSyncUpdate(PWM_BASE, PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT);    PWMSyncTimeBase(PWM_BASE, PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT);}//*****************************************************************************////! Sets the duty cycle of the PWM outputs.//!//! \param ulDutyCycle is the duty cycle for the outputs, specified in clocks.//!//! This function will synchronously update the duty cycle of the PWM outputs//! to the specified value.//!//! \return None.////*****************************************************************************static voidSetPWMDutyCycle(unsigned long ulDutyCycle){    //    // Set the PWM duty cycle for each of the PWM outputs.    //    PWMPulseWidthSet(PWM_BASE, PWM_OUT_0, ulDutyCycle);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_1, ulDutyCycle);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_2, ulDutyCycle);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_3, ulDutyCycle);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_4, ulDutyCycle);    PWMPulseWidthSet(PWM_BASE, PWM_OUT_5, ulDutyCycle);    //    // Synchronously update them all now.    //    PWMSyncUpdate(PWM_BASE, PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT);}//*****************************************************************************////! Interrupt handler for the QEI edge interrupt.//!//! This function is called whenever an edge is seen on the GPIO connected to//! the optical encoder.  It simply counts the number of edges seen.//!//! \return None.////*****************************************************************************voidEdgeIntHandler(void){    //    // Clear the GPIO interrupt.    //    GPIOPinIntClear(GPIO_PORTC_BASE, GPIO_PIN_4);    //    // Increment the count of edges.    //    g_ulVelCount++;}//*****************************************************************************////! Interrupt handler for the QEI interrupt.//!//! This function is called whenever the QEI interrupt occurs.  In open-loop//! operation, it takes care of spinning down the motor when a stop has been//! requested.  In closed-loop operation, it adjusts the PWM duty cycle based//! on the measured speed of the motor by appyling a PID control algorithm.  In//! either mode, it takes care of reversing the direction of rotation when//! requested by the user.//!//! \return None.////*****************************************************************************voidQEIIntHandler(void){    char pcBuffer[6];    long lDelta;    //    // Clear the QEI interrupt.    //    if(g_bSoftwareQEI)    {        TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);    }    else    {        QEIIntClear(QEI_BASE, QEI_INTTIMER);    }    //    // Capture the encoder edge count.    //    if(g_bSoftwareQEI)    {        lDelta = g_ulVelCount * 4;        g_ulVelCount = 0;    }    else    {        lDelta = QEIVelocityGet(QEI_BASE);    }    //    // Increment the count of QEI interrupts.    //    g_ulSpeedCount++;    //    // Get the speed of the motor and convert it from pulses per 1/100th of a    // second into rpm.    //    g_ulSpeed = lDelta = (lDelta * 100 * 60) / (ENCODER_LINES * 4);    //    // Check the motor running state.    //    if(g_iRunning == MOTOR_STOPPING)    {        //        // The motor is stopping, and the high side switches have been turned        // off.  A delay time has expired, so move to the next state.        //        g_iRunning = MOTOR_STOP_DELAY;        //        // There is nothing further to do.        //        return;    }    else if(g_iRunning == MOTOR_STOP_DELAY)    {        //        // The motor is stopping, and the delay time has expired, so the motor        // is now stopped.        //        g_iRunning = MOTOR_STOPPED;        //        // Turn on the low side switches.  This will cause the motor to brake.        //        PWMOutputInvert(PWM_BASE,                        PWM_OUT_1_BIT | PWM_OUT_3_BIT | PWM_OUT_5_BIT, true);        //        // There is nothing further to do.        //        return;    }    //    // Update the PWM duty cycle if the motor is being driven closed-loop.    //    if(!g_bOpenLoop)    {        //        // Compute a new duty cycle delta.        //        lDelta = PIDUpdate(&g_sPID, lDelta, g_ulTarget - lDelta);        //        // Update the PWM duty cycle.        //        lDelta = g_ulBaseDutyCycle + (lDelta / 10000);        if(lDelta < 5)        {            lDelta = 5;        }        if(lDelta > (g_ulPwmPeriod - 5))        {            lDelta = g_ulPwmPeriod - 5;        }        SetPWMDutyCycle(lDelta);    }    //    // See if debug mode is enabled.    //    if(g_bDebug)    {        //        // Print the current speed measurement to the user interface.        //        lDelta = g_ulSpeed;        pcBuffer[0] = '0' + ((lDelta / 1000) % 10);        pcBuffer[1] = '0' + ((lDelta / 100) % 10);        pcBuffer[2] = '0' + ((lDelta / 10) % 10);        pcBuffer[3] = '0' + (lDelta % 10);        pcBuffer[4] = ' ';        pcBuffer[5] = '\0';        UIDisplay(pcBuffer);    }}//*****************************************************************************////! Configure the QEI block to read the motor speed.//!//! This function performs the setup on the QEI block in order to measure the//! speed of the motor.  The positional information from the QEI block is not//! used, only the speed.//!//! \return None.////*****************************************************************************static voidSetupQEI(void){    //    // See if this part has a QEI peripheral.    //    if(SysCtlPeripheralPresent(SYSCTL_PERIPH_QEI))    {        //        // Disable software QEI.        //        g_bSoftwareQEI = false;        //        // Enable the QEI peripheral.        //        SysCtlPeripheralEnable(SYSCTL_PERIPH_QEI);        //        // Make the appropriate GPIO pins be QEI inputs instead of GPIO.        //        GPIODirModeSet(GPIO_PORTC_BASE, GPIO_PIN_4 | GPIO_PIN_6,                       GPIO_DIR_MODE_HW);        GPIODirModeSet(GPIO_PORTD_BASE, GPIO_PIN_7, GPIO_DIR_MODE_HW);        //        // Configure the QEI block to capture on both edges, use quadrature        // signals, and to capture the speed.        //        QEIConfigure(QEI_BASE, (QEI_CONFIG_CAPTURE_A_B | QEI_CONFIG_NO_RESET |                                QEI_CONFIG_QUADRATURE | QEI_CONFIG_NO_SWAP),                     0);        QEIVelocityConfigure(QEI_BASE, QEI_VELDIV_1, SysCtlClockGet() / 100);        //        // Enable velocity timer expiration interrupt.        //        QEIIntEnable(QEI_BASE, QEI_INTTIMER);        IntEnable(INT_QEI);        //        // Enable the QEI block.        //        QEIEnable(QEI_BASE);        QEIVelocityEnable(QEI_BASE);        //        // Set the QEI interrupt to the second highest priority.  It shouldn't        // be as high as the hall effect sensors (i.e. it shouldn't interfere        // with commutation of the motor) but it should be handled ahead of the        // other interrupts.        //        IntPrioritySet(INT_QEI, 0x40);    }    else    {        //        // Enable software QEI.        //        g_bSoftwareQEI = true;        //        // Enable the timer that will be used to provide the timer period        // interrupt.        //        SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);        //        // Configure and enable a timer to provide interrupt every 1/100th of a        // second.        //        TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER);        TimerLoadSet(TIMER0_BASE, TIMER_A, (SysCtlClockGet() / 100) - 1);        TimerEnable(TIMER0_BASE, TIMER_A);        //        // Enable the interrupt handler for the timer.        //        TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);        IntEnable(INT_TIMER0A);        //        // Configure the optical encoder GPIO pin as an input with interrupt        // generation on the rising edge.        //        GPIODirModeSet(GPIO_PORTC_BASE, GPIO_PIN_4, GPIO_DIR_MODE_IN);        GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_4, GPIO_RISING_EDGE);        //        // Enable the optical encoder GPIO pin interrupt.        //        GPIOPinIntEnable(GPIO_PORTC_BASE, GPIO_PIN_4);        IntEnable(INT_GPIOC);        //        // Set the QEI interrupts to the second highest priority.  It shouldn't        // be as high as the hall effect sensors (i.e. it shouldn't interfere        // with commutation of the motor) but it should be handled ahead of the        // other interrupts.  Both interrupts are set to the same priority as a        // form of mutual exclusion between the two interrupt handlers (it is        // guaranteed that one handler will not interrupt the other, so they        // can share global variables without special consideration of being        // interrupted by the other).        //        IntPrioritySet(INT_GPIOC, 0x40);        IntPrioritySet(INT_TIMER0A, 0x40);    }}//*****************************************************************************////! Debug command callback function.//!//! \param ulValue is ignored.//!//! This function is called when the debug command is entered by the user.  It//! toggles closed-loop debug mode, in which the measured motor speed is//! printed periodically in order to evaluate the performance of the PID gain//! factors.//!//! \return None.////*****************************************************************************static voidDebugHandler(unsigned long ulValue)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产髙清在线看国产毛片| 国产美女一区二区三区| 毛片av一区二区| 国产毛片精品一区| 99久久伊人网影院| 欧美精品久久天天躁| 久久久久9999亚洲精品| 日韩美女久久久| 蜜桃久久av一区| 99国产麻豆精品| 欧美一级日韩免费不卡| 国产女人水真多18毛片18精品视频| 亚洲免费观看高清完整| 免费成人在线播放| 91热门视频在线观看| 日韩欧美一区二区免费| 国产精品传媒视频| 青青草国产成人99久久| 99久久精品国产毛片| 日韩免费观看2025年上映的电影| 亚洲啪啪综合av一区二区三区| 日本亚洲视频在线| 色综合av在线| 国产无人区一区二区三区| 亚洲精品成人在线| 国产精品资源网| 欧美日韩国产片| 国产精品久久久久久久裸模| 美女网站一区二区| 在线精品视频一区二区三四| 久久久精品免费网站| 亚洲成人动漫av| www.亚洲精品| 欧美精品一区二区三区在线播放| 亚洲精品免费在线观看| 国产精品一区二区无线| 欧美一区二区视频观看视频| 亚洲男同1069视频| 欧美日韩成人综合天天影院| 国产精品久久久久久久久久免费看| 免费一级欧美片在线观看| 91黄色免费网站| 国产精品伦一区| 六月丁香婷婷久久| 欧美三日本三级三级在线播放| 亚洲欧洲日韩综合一区二区| 寂寞少妇一区二区三区| 在线成人午夜影院| 亚洲综合精品久久| 99久久精品免费看国产| 亚洲国产精品成人综合色在线婷婷| 久久精品国产77777蜜臀| 欧美久久久久久蜜桃| 亚洲人成网站精品片在线观看| 国产盗摄女厕一区二区三区| 日韩精品自拍偷拍| 日韩有码一区二区三区| 欧美日韩另类国产亚洲欧美一级| 亚洲欧美日韩国产手机在线| 99久久er热在这里只有精品66| 亚洲精品一区二区三区蜜桃下载| 美女性感视频久久| 日韩亚洲欧美中文三级| 午夜欧美大尺度福利影院在线看 | 欧美sm极限捆绑bd| 日韩精品一区第一页| 91福利视频网站| 亚洲乱码中文字幕| 91在线观看成人| 亚洲精品免费一二三区| 色婷婷国产精品综合在线观看| 国产精品美女www爽爽爽| 国产91精品露脸国语对白| 国产蜜臀97一区二区三区 | 欧美韩国一区二区| 成人午夜视频在线观看| 欧美经典一区二区三区| 国产综合一区二区| 国产亚洲欧美激情| 成人午夜视频在线观看| 亚洲欧美综合网| 色婷婷综合久久久久中文一区二区| 国产精品毛片大码女人| 成人av网站在线观看免费| 亚洲日本va午夜在线影院| 色综合激情久久| 亚洲妇熟xx妇色黄| 欧美一区二区网站| 国产在线精品一区二区 | 91视频国产观看| 玉米视频成人免费看| 欧美日韩一区三区| 色综合天天综合狠狠| 一区视频在线播放| 欧美日韩亚洲综合一区二区三区| 青青草国产成人99久久| 久久久久国产成人精品亚洲午夜| 成人教育av在线| 亚洲亚洲精品在线观看| 日韩视频一区二区三区在线播放| 国内国产精品久久| 综合av第一页| 欧美久久久一区| 国产精华液一区二区三区| 国产精品久久久久久久第一福利| 欧美在线视频你懂得| 男女视频一区二区| 国产精品免费av| 欧美三级日韩在线| 国产精品综合在线视频| 亚洲精品你懂的| 日韩精品一区二区三区四区 | 国产欧美日韩在线| 在线观看视频一区| 激情另类小说区图片区视频区| 欧美极品美女视频| 欧美视频一二三区| 韩国午夜理伦三级不卡影院| 亚洲老妇xxxxxx| 日韩欧美一级二级三级| 99视频在线精品| 日韩不卡一二三区| 日韩一区欧美小说| 日韩免费一区二区三区在线播放| av亚洲精华国产精华| 日韩福利视频网| 国产精品灌醉下药二区| 欧美区视频在线观看| 风间由美一区二区av101| 日韩精品福利网| 国产精品第13页| 精品欧美一区二区三区精品久久| 色老头久久综合| 国产福利视频一区二区三区| 亚洲图片一区二区| 欧美国产一区视频在线观看| 91精品国产综合久久久久久久 | 亚洲国产精品高清| 欧美一区二区三区在线| 成人性生交大合| 免费成人av在线| 亚洲主播在线观看| 国产精品精品国产色婷婷| 精品国产一二三| 欧美日韩一级二级| 色综合久久久网| 国产真实乱对白精彩久久| 亚洲国产日韩一级| 久久国产精品一区二区| 一区二区三区欧美激情| 国产女人18毛片水真多成人如厕| 91麻豆精品91久久久久同性| 91在线国产福利| 国产乱妇无码大片在线观看| 日韩av不卡一区二区| 亚洲一区在线观看视频| 国产精品色哟哟网站| 久久一区二区三区四区| 69精品人人人人| 欧美亚洲国产bt| 成人18视频在线播放| 国产精品66部| 国产一区二区按摩在线观看| 蜜桃视频在线一区| 日本特黄久久久高潮| 午夜久久电影网| 亚洲一区日韩精品中文字幕| 1区2区3区精品视频| 国产精品久久久久一区二区三区共 | 欧美日韩亚洲综合一区 | 亚洲午夜久久久久久久久电影网| 自拍偷拍欧美激情| 中文字幕视频一区| 成人欧美一区二区三区白人| 中日韩免费视频中文字幕| 久久久久成人黄色影片| 国产三级欧美三级日产三级99| 久久综合九色综合欧美98| 久久人人97超碰com| 26uuu亚洲| 久久丝袜美腿综合| 国产亚洲制服色| 国产欧美日本一区二区三区| 国产三级一区二区| 国产精品青草久久| 国产精品国产三级国产aⅴ中文| 国产精品美女久久久久久| 国产精品国产三级国产三级人妇 | 在线免费观看日本欧美| 一本久道中文字幕精品亚洲嫩| 97久久精品人人做人人爽 | 亚洲va欧美va天堂v国产综合| 亚洲自拍偷拍av| 亚洲图片欧美色图| 五月激情综合婷婷| 久久精品国产久精国产| 精品一区二区三区免费| 国产成人丝袜美腿| 99久久亚洲一区二区三区青草| 色综合久久天天|