処理時間測定
Page last updated 06 May 2018, by .
0
replies
処理時間測定
// Systickレジスタ
#define STK_CTRL *((volatile unsigned long *)0xE000E010)
#define STK_LOAD *((volatile unsigned long *)0xE000E014)
#define STK_VAL *((volatile unsigned long *)0xE000E018)
STK_LOAD = 0x00ffffff; // リロード値に最大値を設定, 24ビットダウンカウンタ
STK_VAL = 0x00000000; // カウンタ値にリロード値を設定
STK_CTRL = 0x00000004; // コアクロックを選択, 割り込みなし
STK_CTRL |= 0x00000001; // カウンタ動作許可
wait_ms(1);
temp0 = STK_VAL; // start
// 測定対象の処理
temp1 = STK_VAL; // end
if (temp0 >= temp1) {
time = temp0 - temp1;
printf ("time:%2d[clk]\r\n", time);
} else {
printf ("time:error!\r\n");
}
Please log in to post comments.
