⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test3.c

📁 RTX 实现Windows 实时化的组件
💻 C
字号:
//
// TEST3.C
//
    
#include  "test3.h"



void 
_cdecl
wmain(
       int     argc,
       wchar_t **argv,
       wchar_t **envp
     )

{
	LARGE_INTEGER  Time1,Time2;
	// for periodic timer code
    int i = 0 ;
	LARGE_INTEGER  liPeriod;   // timer period
	LARGE_INTEGER  Time ;      // the parameter used in the TimerHandler()
	
    HANDLE         hTimer;     // timer handle

	//  RTX periodic timer code:
    //  TO DO: Set default timer period to your desired time.
    //         The period needs to be an even multiple of the HAL
    //         period found in the control panel.
    //         This example uses a period of 1 milisecond.

    liPeriod.QuadPart = 9000;

    // Create a periodic timer
    if (! (hTimer = RtCreateTimer(
                                  NULL,            // security
                                  0,               // stack size - 0 uses default
                                  TimerHandler,    // timer handler
                                  &Time,            // NULL context (argument to handler)
                                  RT_PRIORITY_MAX, // priority
                                  CLOCK_3) ))      // RTX HAL timer
    {
        
        // TO DO:  exception code here
        RtWprintf(L"RtCreateTimer error = %d\n",GetLastError());
        ExitProcess(1);
    }

    if (! RtSetTimerRelative( hTimer,
                              &liPeriod,
                              &liPeriod) )
    {
        
        // TO DO: exception code here
        RtWprintf(L"RtSetTimerRelative error = %d\n",GetLastError());
        ExitProcess(1);
    }

    //
    // TO DO:  your program code here
    //
	
	RtGetClockTime(CLOCK_3,pTime);
	Sleep(1000);

	RtDeleteTimer( hTimer );

	for (i = 2 ; i<=900 ; i++)
	{
		RtWprintf(L"%d\n",buffer[i].QuadPart - buffer[i-1].QuadPart);
	}

    ExitProcess(0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -