[CC3200] CC3200 MCU 实验

[复制链接]
1035|8
 楼主| gaoke231 发表于 2019-7-31 15:36 | 显示全部楼层 |阅读模式
设备的所有数字针可以用作通用输入/输出(GPIO),GPIO 可用于各种目的, GPIO 模块由
4 部分组成,它们分别是:
 GPIO A0
 GPIO A1
 GPIO A2
 GPIO A3
GPIO 的每个部分包括 8 个 GPIO。 GPIO 模块支持 30 个可编程的 GPIO 引脚,用于外围设
备的使用。  

评论

感谢分享  发表于 2019-7-31 21:04
 楼主| gaoke231 发表于 2019-7-31 15:36 | 显示全部楼层
应用说明
这个应用程序的目的是展示通过调用 Driverlib 库中的 API 实现对 GPIO 控制, LED 灯
连接在 GPIO 管脚表示 GPIO 的输出,通过周期性的给 GPIO 引脚高低电平来实现 LED 灯的亮
灭。 在原理图中可以看出 LED 低电平点亮,即引脚输出低电平, LED 点亮,引脚输出高电
平, LED 熄灭。
 楼主| gaoke231 发表于 2019-7-31 15:39 | 显示全部楼层
原理图如下:
941035d41454194651.png
996845d414594dbb6b.png
 楼主| gaoke231 发表于 2019-7-31 16:38 | 显示全部楼层
void LEDBlinkyRoutine()
{
    //
    // Toggle the lines initially to turn off the LEDs.
    // The values driven are as required by the LEDs on the LP.
    //
    GPIO_IF_LedOff(MCU_ALL_LED_IND);
    while(1)
    {
        //
        // Alternately toggle hi-low each of the GPIOs
        // to switch the corresponding LED on/off.
        //
        MAP_UtilsDelay(8000000);
        GPIO_IF_LedOn(MCU_RED_LED_GPIO);
        MAP_UtilsDelay(8000000);
        GPIO_IF_LedOff(MCU_RED_LED_GPIO);
        MAP_UtilsDelay(8000000);
        GPIO_IF_LedOn(MCU_BLUE_LED_GPIO);
        MAP_UtilsDelay(8000000);
        GPIO_IF_LedOff(MCU_BLUE_LED_GPIO);
        MAP_UtilsDelay(8000000);
        GPIO_IF_LedOn(MCU_GREEN_LED_GPIO);
        MAP_UtilsDelay(8000000);
        GPIO_IF_LedOff(MCU_GREEN_LED_GPIO);
    }

}
 楼主| gaoke231 发表于 2019-7-31 16:39 | 显示全部楼层
static void
BoardInit(void)
{
/* In case of TI-RTOS vector table is initialize by OS itself */
#ifndef USE_TIRTOS
    //
    // Set vector table base
    //
#if defined(ccs)
    MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
#endif
#if defined(ewarm)
    MAP_IntVTableBaseSet((unsigned long)&__vector_table);
#endif
#endif
   
    //
    // Enable Processor
    //
    MAP_IntMasterEnable();
    MAP_IntEnable(FAULT_SYSTICK);

    PRCMCC3200MCUInit();
}
 楼主| gaoke231 发表于 2019-7-31 16:39 | 显示全部楼层
int
main()
{
    //
    // Initialize Board configurations
    //
    BoardInit();
   
    //
    // Power on the corresponding GPIO port B for 9,10,11.
    // Set up the GPIO lines to mode 0 (GPIO)
    //
    PinMuxConfig();
    GPIO_IF_LedConfigure(LED1|LED2|LED3);

    GPIO_IF_LedOff(MCU_ALL_LED_IND);
   
    //
    // Start the LEDBlinkyRoutine
    //
    LEDBlinkyRoutine();
    return 0;
}
 楼主| gaoke231 发表于 2019-7-31 16:41 | 显示全部楼层
void PinMuxConfig(void)
{
        //
    // Enable Peripheral Clocks
    //
        PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);
        PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK);

        //
    // Configure PIN_15 for GPIO Output
    //
        PinTypeGPIO(PIN_15, PIN_MODE_0, false);
        GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_OUT);

        //
    // Configure PIN_18 for GPIO Output
    //
        PinTypeGPIO(PIN_18, PIN_MODE_0, false);
        GPIODirModeSet(GPIOA3_BASE, 0x10, GPIO_DIR_MODE_OUT);

        //
    // Configure PIN_53 for GPIO Output
    //
        PinTypeGPIO(PIN_53, PIN_MODE_0, false);
        GPIODirModeSet(GPIOA3_BASE, 0x40, GPIO_DIR_MODE_OUT);
}
xinxianshi 发表于 2019-7-31 22:28 | 显示全部楼层
有点小费劲。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

54

主题

1310

帖子

5

粉丝
快速回复 在线客服 返回列表 返回顶部