構文
void SetSystemTime(
  unsigned long time
);
パラメータ
- time
 - 
 [in] システムタイマの設定値(0〜4,294,967,295)を指定します。
 
戻り値
  なし
 
解説
設定したシステムタイマ値を取得するには、GetSystemTime関数を使用します。必要条件
ヘッダファイル:
lib.hライブラリファイル:
libSTARTUPOPH5000.a
サンプル
#include <stdio.h>
#include "lib.h"
#define HIGH_DELAY      13 * 5    // Note that these are prime numbers
#define MEDIUM_DELAY    23 * 5
#define LOW_DELAY       37 * 5
void main( void )
{
    unsigned long current_time;
    unsigned long next_high_time;
    unsigned long next_medium_time;
    unsigned long next_low_time;
    SetSystemTime(0);             // Reset system timer to zero
    next_high_time = HIGH_DELAY;
    next_medium_time = MEDIUM_DELAY;
    next_low_time = LOW_DELAY;
    SetFont(SMALL_FONT, NULL);
    printf("\f3 independent\ntimers using\nGetSystemTime");
    while( 1 )
    {
        current_time = GetSystemTime();
        if(current_time >= next_low_time)
        {
            Sound( TSTANDARD, VSTANDARD, SLOW, 0);
            GoodReadLed(RED,TIME_100MS*2);
            next_low_time += LOW_DELAY;
        }
        if(current_time >= next_medium_time)
        {
            Sound( TSTANDARD, VSTANDARD, SMEDIUM, 0);
            GoodReadLed(ORANGE,TIME_100MS*2);
            next_medium_time += MEDIUM_DELAY;
        }
        if(current_time >= next_high_time)
        {
            Sound( TSTANDARD, VSTANDARD, SHIGH, 0);
            GoodReadLed(GREEN,TIME_100MS*2);
            next_high_time += HIGH_DELAY;
        }
        Idle();
    }
}
最終更新日:2020/10/08