#include "target.h"
#include "xcp.h"
#include "LocatedVars.h"
#include "osek.h"
/**
* This task is activated every 10ms.
*/
long OSTICKDURATION;
TASK( Task10ms )
{
void XCP_FN_TYPE Xcp_CmdProcessor( void );
uint32 startTime = GetQueryPerformanceCounter();
/* Trigger DAQ for the 10ms XCP raster. */
if( XCPEVENT_DAQ_OVERLOAD & Xcp_DoDaqForEvent_10msRstr() )
{
++numDaqOverload10ms;
}
/* Update those variables which are modified every 10ms. */
counter16 += slope16;
/* Trigger STIM for the 10ms XCP raster. */
if( enableBypass10ms )
{
if( XCPEVENT_MISSING_DTO & Xcp_DoStimForEvent_10msRstr() )
{
++numMissingDto10ms;
}
}
duration10ms = (uint32)( ( GetQueryPerformanceCounter() - startTime ) / STOPWATCH_TICKS_PER_US );
}
什么是最简单(和/或最好)的同步到某个准确时钟以在特定时间间隔调用函数的方法,在正常情况下几乎没有抖动,来自 C++?我现在正在开发 WINDOWS 操作系统。上面的代码适用于 RTAS OSEK,但我想在 Windows 操作系统的特定时间间隔调用一个函数。任何人都可以用 C++ 语言帮助我吗?