AN90114自带例程[img]file:///D:\LIN\QQjilu\2477669460\Image\C2C\`{_FQE`_~9(@RX$3ZTP[P]Y.jpg[/img]
/* Update the match register for generating a periodic WDT ISR.
Note: In order to do a periodic ISR using WDT, Match value needs to be
updated every WDT ISR with the desired time value added on top of the
existing match value */
CySysWdtWriteMatch(ILODelayCycles);
if(proximityState && proxComplete)
{
/* Configure the wake up period to 30ms */
ILODelayCycles = WDT_MATCH_VALUE_30MS;
/* Initialize the flag that is used to indicate a successful scan of the touchpad*/
touchpadComplete = TRUE;
/* Scan touchpad widget */
CapSense_ScanEnabledWidgets();
/* Enter and remain the CapSense scan is complete */
while(CapSense_IsBusy() != 0)
/******************************************************************************
* Function Name: WDT_ISR_Handler
*******************************************************************************
*
* Summary:
* Interrupt Service Routine for the watchdog timer interrupt. The periodicity
* of the interrupt is depended on the match value written into the counter
* register using API - CySysWdtWriteMatch().
*
******************************************************************************/
CY_ISR(WDT_ISR)
{
/* Flag to indicate a non-CSD interrupt*/
intrFlag = TRUE;
/* Clear WDT interrupt */
CySysWdtClearInterrupt();
/* Write WDT_MATCH with current match value + desired match value */
CySysWdtWriteMatch((uint16)CySysWdtReadMatch()+ILODelayCycles);
}
一开始只需要 CySysWdtWriteMatch(ILODelayCycles); 填入 ILODelayCycles 比较值即可
为什么在看门狗函数里 还要加上 CySysWdtReadMatch() ??
网友们有空帮忙看下,谢谢!
|