Forums: Help (Thread #6246)

あらためて周期ハンドラの動作 (2004-10-26 14:01 by hamayan #11650)

今度は、確認ではなく質問となります。

H83のサンプルプログラムを以下の様に改造して動かして見ました。
静的API
/* 周期ハンドラ */
CRE_CYC(CYC_ID, {TA_HLNG | TA_STA, 0, func, 1000, 0});

sample.c
void func( VP_INT exinf ) /*周期ハンドラ*/
{
SYSTIM st;

/* タイマ値取得 */
get_tim(&st);

/* タイマ値出力 */
Sci_PutChar('0' + (st.ltime / 10000) % 10);
Sci_PutChar('0' + (st.ltime / 1000) % 10);
Sci_PutChar('0' + (st.ltime / 100) % 10);
Sci_PutChar('0' + (st.ltime / 10) % 10);
Sci_PutChar('0' + (st.ltime / 1) % 10);
Sci_PutChar(':');
Sci_PutChar('\r');
Sci_PutChar('\n');
}

結果は、
HOS
01000:
02000:
03000:
04000:
となり正しい様に思えますが、仕様書を私なりに解釈すると、一番目の起動は、ハンドラの生成時に起動位相時間を加えた時間で、静的APIで生成した場合は、システムの初期化時から計時されるので、
HOS
00000:
01000:
02000:
03000:
04000:
となるような。

個人的に、HOSのAPIをまとめています。
質問ばかりですいません。

Reply to #11650×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: あらためて周期ハンドラの動作 (2004-10-26 14:58 by m-arai #11651)

起動位相の効果に付いては、その通りだと思います。

[#5113] hos-v4: 周期ハンドラの起動位相サポート
https://sourceforge.jp/tracker/index.php?func=detail&aid=5113&group_id=183&atid=780
Reply to #11650

Reply to #11651×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: あらためて周期ハンドラの動作 (2004-10-27 00:44 by hamayan #11665)

ちょっと家の用事が有った為に、つい先程試しました。

サンプルを改造したプログラムで
HOS
00001:
01000:
02000:
となりました。

CRE_CYC(CYC_ID, {TA_HLNG | TA_STA, 0, func, 1000, 5000});
とすれば、なんとなく5秒経過後から
HOS
05000:
06000:
と表示されています。

アドバイスのみならず、パッチまで提供頂いて、有難うございました。
Reply to #11651

Reply to #11665×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login