差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

exercise4_タイマー割り込みcmt [2015/03/01 15:58]
member
exercise4_タイマー割り込みcmt [2016/03/08 18:58] (現在)
member
ライン 1: ライン 1:
 +======Exercise4 タイマー割り込み======
 +
注意 注意
ライン 5: ライン 7:
<code c> <code c>
void interrupt_cmt0(void); void interrupt_cmt0(void);
-#pragma interrupt INT_CMT_CMTO+#pragma interrupt INT_CMT0_CMIO
void INT_CMT0_CMI0(void){ void INT_CMT0_CMI0(void){
interrupt_cmt0(); interrupt_cmt0();
} }
</code> </code>
 +
 +ただし、e2studioを使っている場合は、次のとおり書き換えてください。
 +
 +<code c>
 +void interrupt_cmt0(void);
 +void INT_CMT0_CMI0(void){
 + interrupt_cmt0();
 +}
 +</code>
 +
また、**reset_program.c**の21行目のSR_Initの0x000000F0を0x00000000にしましょう。 また、**reset_program.c**の21行目のSR_Initの0x000000F0を0x00000000にしましょう。
ライン 30: ライン 42:
何かのアプローチがあって割り込みが入る場合もありますが 何かのアプローチがあって割り込みが入る場合もありますが
今回は、時間で割り込みをかけてみたいと思います。 今回は、時間で割り込みをかけてみたいと思います。
-1sごとに指定された割り込み文を実行する、などと言うことです。+1msごとに指定された割り込み文を実行する、などと言うことです。
ライン 37: ライン 49:
タイマー割り込みをつかうには、初期設定が必要です。 タイマー割り込みをつかうには、初期設定が必要です。
-main文の上のほうに初期設定を以下のように書きます。+main文の上のほうに1msで割り込むCMTの初期設定を以下のように書きます。
<code c> <code c>
ライン 69: ライン 81:
void interrupt_cmt0(){//割り込む関数 void interrupt_cmt0(){//割り込む関数
-CMT1.CMCSR.BIT.CMF = 0;//フラグクリア+CMT0.CMCSR.BIT.CMF = 0;//フラグクリア
//中身 //中身
} }
/home/users/2/deca.jp-mice/web/cgi/dokuwiki/data/attic/exercise4_タイマー割り込みcmt.1425193091.txt.gz · 最終更新: 2015/03/01 15:58 by member
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0