<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] > # 說明 mcu的靈魂--中斷,用周末的時間將它添加進去了,目前只有一個中斷輸入口,但是我們可以通過設置外部中斷標志寄存器對其進行擴展,單個中斷和多個中斷在項目中我都給了例子。 處理器處理一條命令需要兩個時鐘,為了能響應中斷信號只有一個高電平的最極限情況,mcu內部通過打兩排,將中斷信號擴展成兩個時鐘的高電平,這樣以來,中斷響應的時間大概在1 - 2.5個時鐘之間,保證了中斷一定會響應。 > # 特別注意 設計的中斷,在寫程序的時候,要讓中斷服務程序從`0x3ff`的地址作為其入口地址,這是因為,我寫的腳本,也就是將編譯后的機器編碼轉成存儲在`rom`上的文件時,當檢測到程序中使用了中斷的時候,將會直接跳到`0x3ff`的地址搜索中斷服務程序,并將中斷服務程序的指令動態的拼接到前面非中斷程序的后面。中斷服務程序寫法示例: ![](https://img.kancloud.cn/ba/c8/bac8b6cbb926cafc02b04b5ad42f30d8_896x539.png) > # 1位中斷程序實例 ``` ;系統時鐘為12MHz ;目標硬件為 小腳丫FPGA step-maxo2-c,這個型號是U盤模式,流文件會下載到mcu,每次上電由mcu配置FPGA constant var_a,00 ; 定義變量a,存儲地址為 00 start: load s1,05 load s0,01 add s0,01 load s0,01 enable interrupt wait: add s1,01 jump wait ;循環等待 ;中斷入口地址 -- 此處必須這樣寫,我寫的腳本如果檢測到你使能了中斷會默認去這個地址找 ;找到后將地址動態連接到前面程序的地址后面 ADDRESS 3FF ISR: disable interrupt ;關閉中斷響應,準備處理中斷的事情 add s0,01 ;中斷中讓寄存器0數值加1 returni enable ``` > # 8通道中斷程序 ``` ;系統時鐘為12MHz ;目標硬件為 小腳丫FPGA step-maxo2-c,這個型號是U盤模式,流文件會下載到mcu,每次上電由mcu配置FPGA ;功能 : 對應中斷來了,與其對應的寄存器值加1 constant var_a,00 ; 定義變量a,存儲地址為 00 constant isr_port, ff; 定義用于區分中斷的io地址 start: load s1,05 load s0,00 load s1,00 load s2,00 load s3,00 load s4,00 load s5,00 load s6,00 load s7,00 load sA,00 output sA,isr_port ; 初始化時所有中斷標志清零 enable interrupt ;使能中斷 wait: jump wait isr0: add s0,01 load sC,sB and sC,11111110'b ;' output sC,isr_port ;清除中斷0的標志 return isr1: add s1,01 load sC,sB and sC,11111101'b ;' output sC,isr_port ;清除中斷1的標志 return isr2: add s2,01 load sC,sB and sC,11111011'b ;' output sC,isr_port ;清除中斷2的標志 return isr3: add s3,01 load sC,sB and sC,11110111'b ;' output sC,isr_port ;清除中斷3的標志 return isr4: add s4,01 load sC,sB and sC,11101111'b ;' output sC,isr_port ;清除中斷4的標志 return isr5: add s5,01 load sC,sB and sC,11011111'b ;' output sC,isr_port ;清除中斷5的標志 return isr6: add s6,01 load sC,sB and sC,10111111'b ;' output sC,isr_port ;清除中斷6的標志 return isr7: add s7,01 load sC,sB and sC,01111111'b ;' output sC,isr_port ;清除中斷7的標志 return ;中斷入口地址 -- 此處必須這樣寫,我寫的腳本如果檢測到你使能了中斷會默認去這個地址找 ;找到后將地址動態連接到前面程序的地址后面 ADDRESS 3FF ISR: disable interrupt ;關閉中斷響應,準備處理中斷的事情 input sB,isr_port ;讀取中斷標志 load sC,sB and sC,00000001'b ;' compare sC,01 call z ,isr0 ;中斷0來臨 load sC,sB and sC,00000010'b ;' compare sC,00000010'b ;' call z ,isr1 ;中斷1來臨 load sC,sB and sC,00000100'b ;' compare sC,00000100'b ;' call z ,isr2 ;中斷2來臨 load sC,sB and sC,00001000'b ;' compare sC,00001000'b ;' call z ,isr3 ;中斷3來臨 load sC,sB and sC,00010000'b ;' compare sC,00010000'b ;' call z ,isr4 ;中斷4來臨 load sC,sB and sC,00100000'b ;' compare sC,00100000'b ;' call z ,isr5 ;中斷5來臨 load sC,sB and sC,01000000'b ;' compare sC,01000000'b ;' call z ,isr6 ;中斷6來臨 load sC,sB and sC,10000000'b ;' compare sC,10000000'b ;' call z ,isr7 ;中斷7來臨 returni enable ``` ![](https://img.kancloud.cn/a8/24/a824b17507ccfd8523d94fb05d97414c_1133x702.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看