在线时间237 小时
UID146802
注册时间2015-3-6
NXP金币0
TA的每日心情 | 开心 2019-7-11 19:28 |
---|
签到天数: 141 天 连续签到: 1 天 [LV.7]常住居民III
金牌会员
 
- 积分
- 2492
- 最后登录
- 2020-9-16
|
本帖最后由 chifen 于 2016-11-1 10:24 编辑
- /*********************************************************************************************************
- ** Function name: myDelay
- **
- ** Descriptions: 软件延时
- ** input parameters: ulTime:延时时间(ms)
- ** output parameters: 无
- ** Returned value: 无
- *********************************************************************************************************/
- void myDelay (uint32_t ulTime)
- {
- uint32_t i;
- while (ulTime--) {
- for (i = 0; i < 2401; i++);
- }
- }
- int main(void) {
- // Local variables
- uint32_t temp;
-
- // Configure the debug uart (see Serial.c)
- setup_debug_uart();
-
- // Reset the GPIO module and enable its clock. See peripherals_lib
- GPIOInit();
- // Config. (red LED), (blue LED), (green LED) as outputs,
- // with LEDs off ('1' = off). See utilities_lib
- Config_LEDs(RED | BLUE | GREEN);
- GPIOSetDir( PORT0, 16, 1 );
-
- for(temp=0;temp<20;temp++)
- {
- LEDs_On( GREEN);//兰灯亮
-
- GPIOSetBitValue( PORT0, 16, 1 );//绿灯灭
-
- myDelay(1000);
-
- LEDs_Off( GREEN); //兰灯灭
-
- GPIOSetBitValue( PORT0, 16, 0 );//绿灯亮
-
- myDelay(1000);
- }
-
- //----------------------
-
- }
复制代码 这里用到 延时,可能不准,只能是大概的时间, 对IO控制 使用了两种控制方式 ,
|
|