1. 程式人生 > >UCOSIII軟體定時器-OSTmrStart()函式

UCOSIII軟體定時器-OSTmrStart()函式

建立好的軟體定時器需要呼叫OSTmrStart()函式來啟動軟體定時器

函式原型:CPU_BOOLEAN  OSTmrStart (OS_TMR  *p_tmr,                          OS_ERR  *p_err)

功能:This function is called by your application code to start a timer.   啟動一個軟體定時器。

引數:p_tmr:Is a pointer to an OS_TMR   定時器控制塊指標

            p_err: Is a pointer to an error code.  '*p_err' will contain one of the following:  返回錯誤型別

                           OS_ERR_NONE                            OS_ERR_OBJ_TYPE                       if 'p_tmr' is not pointing to a timer                            OS_ERR_TMR_INVALID                                OS_ERR_TMR_INACTIVE              if the timer was not created                            OS_ERR_TMR_INVALID_STATE   the timer is in an invalid state                            OS_ERR_TMR_ISR                          if the call was made from an ISR

返回值:DEF_TRUE,執行成功  is the timer was started

                DEF_FALSE,執行失敗。 if not or upon an error

注意事項:

1、建立前必須先申明一個定時器物件

2、一次性定時dly不能為0

3、週期定時period不能為0

4、不可以在中斷中呼叫該函式

在中斷函式中開啟定時器,一直開啟不成功!!!!!!!!!!!!!!!!!!!!