1. 程式人生 > 其它 >51微控制器(STC89C52)的中斷和定時器

51微控制器(STC89C52)的中斷和定時器

IDEA使用

針對Mac系統

IDEA快捷鍵

ctrl+r:執行(run)

ctrl+enter:generate

option+enter:萬能解錯,生成返回值變數

command+delete:刪除當前行

command+d:複製當前行

option+command+L:格式化程式碼

tab:縮排程式碼

shift+tab:反縮排程式碼

command+f:查詢

command+r:替換

ctrl+h:檢視類的繼承關係

command+滑鼠點選:檢視類、方法、變數等

command+option+左鍵:返回原來處

command+,:開啟設定

補充:mac自帶的快捷鍵

選中檔案+enter

:重新命名

IDEA模版

live templates:實時程式碼模版,它的原理就是配置一些常用程式碼字母縮寫,在輸入簡寫時,可以出現預定好的固定格式程式碼,使得開發效率大大提高,同時也可以增加個性化。(例如sout就是System.out.println)

IDEA中程式碼模版的所在位置:setting - editor - Live Templates / Postfix Completion

常用的模版:

  1. psvm/main:public static void main(String[] args){}

  2. sout:System.out.println();

    1. soutp:System.out.println("args = " + Arrays.deepToString(args));

      輸出引數

    2. soutm:System.out.println("shortcut.main");輸出方法名

    3. soutv:

      int num = 10;
      System.out.println("num = " + num);
      //輸出變數的值
      
  3. fori:

    for (int i = 0; i < ; i++) {
        
    }
    //迭代的時候使用
    
  4. iter:

    for (String s : a) {
        
    }
    //自動生成迭代器,無論是陣列和列表
    
  5. ifn:

    if (num == null) {
        
    }
    //自動生成判斷語句
    
  6. psf:public static final

    1. psfi:public static final int
    2. psfs: public static final String

IDEA除錯

  • step over:進入下一步,如果當前行斷點是一個方法,則不進入方法體內。
  • step into:進入下一步,如果當前行斷點是一個方法,則進入方法體內。
  • force step into:進入下一步,如果當前行斷點是一個方法,則進入方法內(強制進入,可以進入任何方法)。
  • step out:跳出。
  • resume program:恢復程式執行,但如果該斷點下面程式碼還有斷點則停在下一個斷點上。
  • stop:停止。
  • mute breakpoints:點中,使得所有的斷點失效。
  • view breakpoints:檢視所有斷點。

在除錯的時候有一個快捷鍵,用於查詢變數的值:ctrl+u