Skip to content

短時間內印出大量訊息後無回應

基本資訊

  • 學號:107327009
  • 課程名稱(微控、介面): 介面
  • 實驗:一

回報問題前確認動作

  1. 有引入 libc4m.a
  2. 使用 C4MLIB 版本為:
  3. 有加入參數 -Wl,-u,USE_C4MLIB_INTERRUPT ,以使用c4mlib中斷
  4. 有加入參數 -Wl,-u,USE_C4MLIB_STD_ISR ,以使用c4mlib標準中斷
  5. 有加入參數 -Wl,-u,vfscanf ,以輸入浮點數
  6. 有呼叫 C4M_DEVICE_set()

遇到問題

在while(true)裡面,print hello world,人機沒有回應。

期望結果

能正常hello world

實際結果

人機HMI當機

程式碼

#define F_CPU 11059200UL
#include <avr/io.h>
#include <stdbool.h>
#include <stdint.h>
#include "c4mlib.h"
void main() {
  // initialize M128
  C4M_DEVICE_set();
  printf("start\n");
  ASABUS_ID_init();
  ASABUS_ID_set(1);
  while(true) {
    printf("Hello world !!!\n");
  }
}