/*includes*/
#include "vxWorks.h"
#include "stdio.h"
#include "wdLib.h"
#include "semLib.h"
#include "sysLib.h"
#include "tickLib.h"
WDOG_ID mywdId;
SEM_ID semId;
int times;
int tickCounts;
void delay(void)
{
semId=semBCreate(SEM_Q_PRIORITY,0);
mywdId = wdCreate();
times = 0;
tickCounts = 0;
tickSet(0);
FOREVER
{
wdStart (mywdId,sysClkRateGet(), (FUNCPTR)semGive, (int)semId);
semTake (semId, WAIT_FOREVER);
printf("delayed %d times \n",++times);
if(times==60)
{
wdDelete(mywdId);
break;
}
}
tickCounts = tickGet();
printf("finished,%d ticks eclipsed \n",tickCounts);
}
运行结果是finished,3600 ticks eclipesed.
但是我觉得远远不止60s,大概接近两分钟了,是什么原因?