简单地使用__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 ); // 延时
}
}
转载于:https://my.oschina.net/u/3907010/blog/1927785
『本文转载自网络,版权归原作者所有,如有侵权请联系删除』