定时器2是比较特殊,它给计时器寄存器赋值不能使用这个API函数,这个API函数只适合用在定时器0和定时器1
CySysWdtWriteMatch(CY_SYS_WDT_COUNTER2, WDT_COUNT3_MATCH);
定时器2写计时器寄存器的API函数是以下这个API函数:
/*******************************************************************************
* Function Name: CySysWdtSetToggleBit
********************************************************************************
*
* Summary:
* Configures which bit in WDT counter 2 to monitor for a toggle. When that
* bit toggles, an interrupt is generated if the mode for counter 2 has
* enabled interrupts.
*
* Parameters:
* bit:
* Valid range [0-31]. Counter 2 bit to monitor for a toggle.
*
* Return:
* None.
*
* Side effects:
* WDT Counter 2 should be disabled. Otherwise this function call has no
* effect.
*
* If the specified counter is enabled, call the CySysWdtDisable() function with
* the corresponding parameter to disable the specified counter and wait for it to
* stop. This may take up to 3 LFCLK cycles.
*
*******************************************************************************/
void CySysWdtSetToggleBit(uint32 bits)
定时的计算公式是:(2bits)/32768