2017年11月1日 星期三

[ThreadX, 6] system clock & timer

timer:
  • application timer,與HW timer類似,但不同的地方在於,他們不能相互中斷。
  • 範例:
/* Create an application timer that executes "my_timer_function" after 100 timer-ticks initially and then
after every 25 timer-ticks. This timer is specified to start immediately. */
status = tx_timer_create(&my_timer,"my_timer_name", my_timer_function, 0x1234, 100, 25, TX_AUTO_ACTIVATE);
  • 假設多個timer時間周其設一樣,其執行順序會按照啟動順序。
  • priority 0


system clock:
  • 時間計算是以tick為單位(通常是10ms)
  • measure performance:
current_time  tx_time_get();

printf(“Current Time: %5lu Speedy_Thread finished cycle...\n”, current_time);

沒有留言:

張貼留言