itloverhpu

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

1.os_time.c里面  

  #if OS_TIME_DLY_HMSM_EN > 0
  INT8U OSTimeDlyHMSM (INT8U hours, INT8U minutes, INT8U seconds, INT16U ms)

2.有一次竟然把参数 ms赋了1000,殊不知最大值为999,

  

*Arguments : hours specifies the number of hours that the task will be delayed (max. is 255)
* minutes specifies the number of minutes (max. 59)
* seconds specifies the number of seconds (max. 59)
* milli specifies the number of milliseconds (max. 999)

3.所以在调用库函数的过程中要搞清楚函数的参数

4.另外在阅读系统函数的过程中,可以汲取编程风格。比如:OSTimeDlyHMSM函数

  

/*
*********************************************************************************************************
* DELAY TASK FOR SPECIFIED TIME
*
* Description: This function is called to delay execution of the currently running task until some time
*                     expires. This call allows you to specify the delay time in HOURS, MINUTES, SECONDS and
*                     MILLISECONDS instead of ticks.
*
* Arguments :  hours specifies the number of hours that the task will be delayed (max. is 255)
*         minutes specifies the number of minutes (max. 59)
*           seconds specifies the number of seconds (max. 59)
*           milli specifies the number of milliseconds (max. 999)
*
* Returns : OS_ERR_NONE
*       OS_ERR_TIME_INVALID_MINUTES
*         OS_ERR_TIME_INVALID_SECONDS
*         OS_ERR_TIME_INVALID_MS
*         OS_ERR_TIME_ZERO_DLY
*         OS_ERR_TIME_DLY_ISR
*
* Note(s) : The resolution on the milliseconds depends on the tick rate. For example, you can't do
*         a 10 mS delay if the ticker interrupts every 100 mS. In this case, the delay would be
*       set to 0. The actual delay is rounded to the nearest tick.
*********************************************************************************************************
*/

 

 

posted on 2013-07-13 11:19  itloverhpu  阅读(1026)  评论(0)    收藏  举报