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.
*********************************************************************************************************
*/

 

 

相关文章:

  • 2021-04-05
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-11-11
猜你喜欢
  • 2022-01-12
  • 2022-01-17
  • 2021-08-18
  • 2021-11-05
  • 2021-11-26
  • 2021-12-20
  • 2022-12-23
相关资源
相似解决方案