發新話題
打印

UART1中斷被忽略

UART1中斷被忽略

請問一下,我目前使用F340+AB4在開發產品,目前遇到一個問題,就是F340與AB4連接後,套用AB4的TCP範例,結果UART1的interrupt就沒用了;接AB4不跑範例主程式就可以,請問有解嗎?

AB4範例主程式:

//UART1中斷檢查 加在這裡ok
//CheckUART1();


while(1)
{
  // Initialize the TCP/IP stack.
  if (mn_init() < 0)
  {
    // If code execution enters this while(1) loop, the stack failed to initialize.
    // Verify that all boards are connected and powered properly.
    while(1);
  }

  // Connect to the network
  establish_network_connection();
                       
  // Run the TCP example
  TCP(); //UART1中斷檢查 加在這裡面就失敗

                       
  // Start the Application Layer Services
  // If this routine exits, check the return value for an error code.
  retval = mn_server();
}

TOP

你所使用的 C8051F340 每個內建的 devices 都有自己的中斷向量位址,initial 後,只要該 device 發生 Interr,程式就會跳到該 devices 中斷向量位址,你可試試這個使用方法,先確認是否會進 UART 中斷向量位址?

TOP

謝謝版主回覆,目前問題已經解決:
我原本做法是發生interrupt後,在ISR裡設定某個變數的值為1,然後在原本程式裡(TCP())會去檢查變數是不是為1,但是怎麼檢查變數永遠為0(但已經確定有進去過ISR了).
後來我直接把要做的事在ISR裡完成,這樣就搞定了.

TOP

發新話題