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

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

?? bldc.c

?? 無刷電機驅動器源代碼。基于無傳感器方案的無刷電機啟動器。核心是換向角度檢測:即電機反電勢波形數據處理
?? 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一区二区三区免费野_久草精品视频
**欧美大码日韩| 91精品国产综合久久婷婷香蕉| 日本一区二区免费在线观看视频| 国产在线播放一区三区四| 精品国产凹凸成av人网站| 久久精品国产成人一区二区三区 | 久久久久久久电影| 国产**成人网毛片九色 | 福利一区二区在线| 中文字幕在线不卡视频| 一本一道久久a久久精品综合蜜臀| 中文字幕在线观看一区| 欧洲精品中文字幕| 日韩电影网1区2区| 国产日韩综合av| 一本一道久久a久久精品| 亚洲1区2区3区视频| 精品福利视频一区二区三区| 丁香五精品蜜臀久久久久99网站 | 欧美va亚洲va| 成人毛片视频在线观看| 一二三四社区欧美黄| 日韩美女在线视频| 91丝袜国产在线播放| 国产欧美一区二区精品久导航 | 日本一区二区成人在线| 色婷婷综合激情| 久久国产综合精品| 中文字幕一区二区三区在线播放 | 亚洲欧洲日韩在线| 6080日韩午夜伦伦午夜伦| 国产高清视频一区| 亚洲国产精品精华液网站| 久久蜜桃av一区精品变态类天堂| 一本到三区不卡视频| 久久精品国产99久久6| 亚洲免费三区一区二区| 日韩三级av在线播放| 色婷婷精品久久二区二区蜜臀av| 久久99九九99精品| 亚洲一区二区欧美| 国产欧美视频在线观看| 在线综合视频播放| 色综合天天综合色综合av| 国产一区二区在线视频| 首页亚洲欧美制服丝腿| **性色生活片久久毛片| 2020国产精品久久精品美国| 欧美日韩国产免费| 91免费在线播放| 国产乱人伦精品一区二区在线观看| 亚洲成人资源在线| 亚洲老妇xxxxxx| 中文字幕免费一区| 久久青草欧美一区二区三区| 欧美伦理影视网| 91成人免费电影| 99国产欧美另类久久久精品| 国产乱码精品一区二区三区忘忧草 | 亚洲综合网站在线观看| 国产精品久久看| 久久精品一区二区三区四区| 91精品国产综合久久精品麻豆 | 制服丝袜亚洲网站| 在线观看亚洲成人| 91色|porny| 99re这里只有精品6| 成人h动漫精品| 国产91精品一区二区| 国产成人综合亚洲网站| 国产乱码精品一区二区三区av| 毛片av一区二区三区| 日av在线不卡| 免费xxxx性欧美18vr| 免费在线看成人av| 蜜桃传媒麻豆第一区在线观看| 日韩中文字幕区一区有砖一区 | 99re热视频精品| 成人精品小蝌蚪| 成人性视频免费网站| 国产黄色精品网站| 国产精品996| 国产成人高清在线| 懂色av中文一区二区三区| 成人性生交大合| 成人av在线播放网站| 99久久久免费精品国产一区二区| 91猫先生在线| 欧美性猛交一区二区三区精品| 欧美中文一区二区三区| 欧美区视频在线观看| 欧美一卡2卡三卡4卡5免费| 日韩欧美久久一区| 国产欧美日韩在线观看| 最好看的中文字幕久久| 亚洲国产aⅴ天堂久久| 男人的j进女人的j一区| 国产一区二区在线视频| 99精品欧美一区二区三区小说| 欧洲一区二区三区免费视频| 欧美精品成人一区二区三区四区| 日韩欧美视频一区| 中文字幕不卡在线观看| 亚洲精品免费电影| 三级久久三级久久久| 精品无人码麻豆乱码1区2区| 粉嫩蜜臀av国产精品网站| 色欧美乱欧美15图片| 在线电影一区二区三区| 久久久久久99精品| 一区二区三区中文字幕| 蜜桃av噜噜一区| 国产 日韩 欧美大片| 欧美性猛交xxxx乱大交退制版| 日韩欧美激情在线| 国产精品国产三级国产aⅴ无密码| 伊人色综合久久天天| 久久99精品国产麻豆不卡| 99精品桃花视频在线观看| 日韩视频一区二区三区在线播放| 国产女人水真多18毛片18精品视频| 亚洲伦在线观看| 精品一区二区三区香蕉蜜桃| 99在线热播精品免费| 日韩视频一区二区三区在线播放| 亚洲欧美在线另类| 麻豆精品在线视频| 日本乱码高清不卡字幕| 欧美精品一区二区高清在线观看 | 亚洲最大的成人av| 国产精品一区免费视频| 在线视频观看一区| 中文字幕乱码日本亚洲一区二区 | 一区二区三区产品免费精品久久75| 久久se这里有精品| 欧美在线短视频| 国产精品欧美一区喷水| 久久精品国产成人一区二区三区| 欧美三级在线看| 中文字幕一区二区三区四区| 久久精品久久综合| 欧美日韩在线电影| 亚洲人成精品久久久久久 | 免费欧美在线视频| 欧美性受极品xxxx喷水| 亚洲色图20p| 国产91丝袜在线18| 2022国产精品视频| 韩国女主播一区二区三区| 在线91免费看| 亚洲一区二区中文在线| 97se狠狠狠综合亚洲狠狠| 国产亚洲欧美在线| 国产麻豆精品视频| 精品少妇一区二区三区| 青青草国产精品97视觉盛宴| 欧美日韩一区精品| 一区二区在线观看免费视频播放 | 亚洲超丰满肉感bbw| 91成人免费在线视频| 亚洲免费观看在线视频| 成人av网址在线观看| 国产日韩精品一区二区浪潮av| 激情欧美一区二区三区在线观看| 欧美一级日韩不卡播放免费| 午夜电影一区二区| 777午夜精品免费视频| 天天射综合影视| 91精品国产综合久久精品性色| 日本va欧美va精品发布| 日韩欧美国产电影| 精品一二三四区| 国产视频不卡一区| 不卡一卡二卡三乱码免费网站| 国产精品视频免费看| 成人天堂资源www在线| 综合精品久久久| 91丨porny丨蝌蚪视频| 亚洲精选在线视频| 欧美日韩黄视频| 久久国产麻豆精品| 久久久不卡网国产精品一区| 国产精品综合av一区二区国产馆| 国产亚洲短视频| 91最新地址在线播放| 亚洲一区二区三区爽爽爽爽爽| 欧美亚州韩日在线看免费版国语版| 婷婷久久综合九色综合绿巨人| 91精品国产色综合久久不卡电影| 久久精品国产**网站演员| 久久这里都是精品| youjizz国产精品| 亚洲精品成人a在线观看| 666欧美在线视频| 国产九色sp调教91| 亚洲综合网站在线观看| 精品国产乱码久久久久久图片| 成人美女视频在线观看18| 午夜精品久久久久久久蜜桃app| 精品999久久久|