Browsing this Thread:
1 Anonymous Users
|
關於mplab 使用 startup.as 做 reset 動作流程
|
|
新會員
Joined
: 2009/4/23 18:53 最後登入時間
: 2020/5/7 10:45
Group:
註冊會員
Level : 2 HP : 0 / 49 MP : 6 / 2171 EXP : 97
|
目前我使用Mplab中選項 keep generated startup.as 生成後,按照Hi-Tech PICC v2.0.pdf 教學文件的第131頁,去修改 startup.as。在取消keep generated startup.as 。在編譯,去查看Program Memory 並沒有把startup.as載入進去 。不知道是否要勾選甚麼選項才會載入。
目前我把 mystartup() 放在main.c裡面 void mystartup( void ) { PORTC = 0x00; TRISC = 0x00; #asm clrf _STATUS clrf _PORTB bsf _STATUS,5 clrf _TRISB movlw high start movwf _PCLATH goto ( start & 0x7FF ) #endasm }
然後修改的startup.as 內容為 ..... ..... extern mystartup
psect reset_vec reset_vec: ; No powerup routine ;global start
; jump to start ;goto start & 0x7FF | (reset_vec & not 0x7FF)
goto (mystartup & 0x7FF)
psect init start _exit psect end_init global start_initialization ..... .....
我有嘗試把 startup.as 放入到 soruec中更著一起編譯但出現了********** Build failed! ********** 沒有任何提示哪裡錯誤
請哪位有用過的大大幫幫我,目前成是都完成了 只差這個還搞不定 跪求了
發表於: 2020/5/7 12:18
|
|
|
Re: 關於mplab 使用 startup.as 做 reset 動作流程
|
|
版主
Joined
: 2004/4/30 10:53 最後登入時間
: 2021/11/30 18:11
From CAE, Microchip
Group:
站務管理者 註冊會員
Level : 75 HP : 744 / 1861 MP : 5367 / 108822 EXP : 45
|
之前我有寫了一粉 XC8 的參考教材 (在教育訓練光碟下) XC8T v1.0 。在教材的 118 頁有 "開機初始執行環境" 的章節。 請參考一下 Page 118 ~ Page 124 這幾頁的說明,Linker 那邊也也些要勾選也參考一下 Page 121。
startup.as 是 XC8 的啟動模組,主要是用來:
- 設定 data psects 的初始資料 - 清除 bss psects (uninitialised data) 區域 - 載入RC振盪器的校正值(有內建RC振盪器者) - 將程式控制權轉移至 main( )
如果要在一開機時就能先做 I/O 腳的電壓控制,請用 powerup.as 的組語加在 startup.as 之前。如貼圖:
Attach file: (0.00 KB)
發表於: 2020/5/7 17:00
|
|
You can view topic.
你 不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.