码迷,mamicode.com
首页 > 其他好文 > 详细

[MSP430DriverLib-2]使用延时让LED闪烁

时间:2018-08-14 17:03:12      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:简单   set   ogg   关闭   include   msp430   code   driver   模式   

???? 简单地使用__delay_cycles来达到延时效果。

#include "./DriverLib/driverlib.h"

int main()
{
    WDT_A_hold( WDT_A_BASE );                               // 关闭看门狗

    GPIO_setAsOutputPin( GPIO_PORT_P1 , GPIO_PIN0 );        // 配置P1.0为输出模式
    GPIO_setOutputLowOnPin( GPIO_PORT_P1 , GPIO_PIN0 );     // 让P1.0输出低电平,熄灭LED

    while( 1 ){
        GPIO_toggleOutputOnPin( GPIO_PORT_P1 , GPIO_PIN0 ); // 切换LED亮灭
        __delay_cycles( 1000000 );                          // 延时
    }
}

[MSP430DriverLib-2]使用延时让LED闪烁

标签:简单   set   ogg   关闭   include   msp430   code   driver   模式   

原文地址:https://www.cnblogs.com/RootChu/p/9475354.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!