• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   2 Anonymous Users






Re: 請教PIC16F630編譯錯誤問題?
#10
版主
版主


查看用戶資訊
最主要的是像 PICkit2 & 3 , ICD2 & 3 , Real ICE 等工具都會佔用伊小塊的記憶體作為除錯之用,佔用的情形是越小顆越明顯,所以有時會找科較大記憶容量的 PIC 來解決此問題。

發表於: 2009/4/10 10:26
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教PIC16F630編譯錯誤問題?
#9
新會員
新會員


查看用戶資訊
是的我是用ICD2來Debug
原來是ICD2的LKR檔有這訊息
又多了解到一些要點了
感謝版主與各位板大幫忙~謝謝

發表於: 2009/4/9 14:58
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教PIC16F630編譯錯誤問題?
#8
版主
版主


查看用戶資訊
如果使用 ICD2 加 16F630 的除錯 Header 的話,0x300 ~ 0x3FF 是要保留給ICD2 除錯的 firware 使用,所以 user 就只有 0x000 ~ 0x2FF 的程式空間了。所以只要用燒錄模式就OK了。

Sample ICD2 linker command file for 16F630

LIBPATH  
.

CODEPAGE   NAME=page       START=0x0      END=0x2FF
[color=ff0000]CODEPAGE   NAME=debug      START=0x300    END=0x3FE    PROTECTED[/color]
CODEPAGE   NAME=oscval     START=0x3FF    END=0x3FF    PROTECTED
CODEPAGE   NAME=.idlocs    START=0x2000   END=0x2003   PROTECTED

發表於: 2009/4/9 14:01
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教PIC16F630編譯錯誤問題?
#7
新會員
新會員


查看用戶資訊
參照:

hellowanz 寫道:
Select Device有選對型號嗎?


恩~這設定沒有問題
所以這就蠻奇怪的不知那邊出了問題

發表於: 2009/4/9 10:11
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教PIC16F630編譯錯誤問題?
#6
資深會員
資深會員


查看用戶資訊
Select Device有選對型號嗎?

發表於: 2009/4/9 9:43
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教PIC16F630編譯錯誤問題?
#5
新會員
新會員


查看用戶資訊
另外發現依各問題感到奇怪
我於MPLAB 的 Program Memory視窗裡看到
我程式若超出 2FFh 便會出現此錯誤訊息
可是datasheet裡指出程序儲存區是可到 000h~3FFh
雖然現在程式寫並不長可正常編譯
但這狀況實在令小弟搞不懂阿=.=?

發表於: 2009/4/9 9:21
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教PIC16F630編譯錯誤問題?
#4
版主
版主


查看用戶資訊
絕對定只要使用 ORG 定位,不需使用到 LKR 描述檔。
參考一下 Microchip 所提供的範例:
list      p=16f630           ; list directive to define processor
    
#include <p16F630.inc>        ; processor specific variable definitions

    
errorlevel  -302              suppress message 302 from list file

    __CONFIG   _CP_OFF 
_CPD_OFF _BODEN_OFF _MCLRE_ON _WDT_OFF _PWRTE_ON _INTRC_OSC_NOCLKOUT 

'__CONFIG' directive is used to embed configuration word within .asm file.
The lables following the directive are located in the respective .inc file.
See data sheet for additional information on configuration word settings.




;***** 
VARIABLE DEFINITIONS
w_temp        EQU     0x20        
variable used for context saving 
status_temp   EQU     0x21        
variable used for context saving






;**********************************************************************
        
ORG     0x000             processor reset vector
        
goto    main              go to beginning of program
    

        ORG     0x004             
interrupt vector location
        movwf   w_temp            
save off current W register contents
        movf    STATUS
,w          move status register into W register
        movwf    status_temp       
save off contents of STATUS register


isr code can go here or be located as a call subroutine elsewhere


        movf    status_temp
,w     retrieve copy of STATUS register
        movwf    STATUS            
restore pre-isr STATUS register contents
        swapf   w_temp
,f
        swapf   w_temp
,w          restore pre-isr W register contents
        retfie                    
; return from interrupt


these first 4 instructions are not required if the internal oscillator is not used
main
        call    0x3FF             
retrieve factory calibration value
        bsf     STATUS
,RP0        set file register bank to 1 
        movwf   OSCCAL            
update register with factory cal value 
        bcf     STATUS
,RP0        set file register bank to 0


remaining code goes here



initialize eeprom locations

        ORG    0x2100
        DE    0x00
0x010x020x03


        END                       
directive 'end of program'

發表於: 2009/4/8 15:17
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教PIC16F630編譯錯誤問題?
#3
新會員
新會員


查看用戶資訊
感謝Ryang板大熱心回覆
小弟參照教材重新設定依然出現相同狀況
而改使用Absolute code方式也是如此
剛編輯完回覆看到了板大於樓下回應了

小弟之後將所有副程式砍了卻編譯成功了
副程式一塊一塊加回後發現
程式尾端填滿的 GOTO INITIAL超出程序儲存範圍

此狀況與ERROR訊息已有些差異實在是令人納悶
另外小細節的忽略真的讓我這新手卡關卡很大
最後感謝各位板大的支援~謝謝!^^

發表於: 2009/4/8 15:09

Edited by icebee on 2009年04月08日 16:23:19
Edited by icebee on 2009年04月08日 16:27:15
Edited by icebee on 2009年04月08日 16:29:57
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請教PIC16F630編譯錯誤問題?
#2
版主
版主


查看用戶資訊
程式位址從 0x0000 開始連續擺放,但 Link 在此位置只能放 32 個,所以要重新修改 Code 節區的設定。
參考一下 Microchip 所提供的範例如下,相關檔案位置 : C:\Program Files\Microchip\MPASM Suite\Template\Object

也可以看一下 RTC 教材 MPASM 那裡有詳細的說明:
http://www.microchip.com.tw/modules/w ... nglefile.php?cid=4&lid=32


list      p=16F630           ; list directive to define processor
    
#include <p16F630.inc>        ; processor specific variable definitions

    
errorlevel  -302              suppress message 302 from list file

    __CONFIG   _CP_OFF 
_CPD_OFF _BODEN_OFF _MCLRE_ON _WDT_OFF _PWRTE_ON _INTRC_OSC_NOCLKOUT 

'__CONFIG' directive is used to embed configuration word within .asm file.
The lables following the directive are located in the respective .inc file.
See data sheet for additional information on configuration word settings.



;***** 
VARIABLE DEFINITIONS (examples)

example of using Shared Uninitialized Data Section
INT_VAR     UDATA_SHR   0x20   
w_temp      RES     1       
variable used for context saving 
status_temp RES     1       
variable used for context saving


;**********************************************************************
RESET_VECTOR    CODE    0x0000      processor reset vector
        
goto    start           go to beginning of program

INT_VECTOR  CODE    0x0004      
interrupt vector location

INTERRUPT

        movwf   w_temp          
save off current W register contents
        movf    STATUS
,w        move status register into W register
        movwf   status_temp     
save off contents of STATUS register

isr code can go here or be located as a call subroutine elsewhere

        movf    status_temp
,w   retrieve copy of STATUS register
        movwf   STATUS          
restore pre-isr STATUS register contents
        swapf   w_temp
,f
        swapf   w_temp
,w        restore pre-isr W register contents
        retfie                  
; return from interrupt

MAIN_PROG   CODE

these first 4 instructions are not required if the internal oscillator is not used
start
        call    0x3FF             
retrieve factory calibration value
        bsf     STATUS
,RP0        set file register bank to 1 
        movwf   OSCCAL            
update register with factory cal value 
        bcf     STATUS
,RP0        set file register bank to 0

remaining code goes here

initialize eeprom locations

EE      CODE    0x2100
        DE  0x00
0x010x020x03

        END                       
directive 'end of program'

發表於: 2009/4/8 10:30
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請教PIC16F630編譯錯誤問題?
#1
新會員
新會員


查看用戶資訊
大家好,小弟想請教一下,
我在build 16f630時,會出現錯誤如下

MPLINK 4.30.01Linker
Copyright 
(c2009 Microchip Technology Inc.
Error section '.org_0' can not fit the absolute sectionSection '.org_0' start=0x00000000length=0x0000075e
Errors    
1

Link step failed
.
----------------------------------------------------------------------
Debug build of project `C:WORKMTOUCHKT1.mcp' failed.
Language tool versions: MPASMWIN.exe v5.30.01, mplink.exe v4.30.01
Preprocessor symbol 
`__DEBUG' is defined.
Wed Apr 08 10:01:11 2009
----------------------------------------------------------------------
BUILD FAILED

但小弟於程式開頭未使用ORG 0X00
不過還按照此訊息我先去爬文找到Ryang板主提出的方法參照:

vectors section 位址範圍太小了,改大一點看看:

CODEPAGE NAME=vectors START=0x0000 END=0x0001F PROTECTED
CODEPAGE NAME=page0 START=0x00020 END=0x07FF


小弟依此修改後還是依樣狀況,另於網路上相關的解決方法,比如刪去LKR檔....等等但修改後編譯依舊無法解決此問題,
不知是否有改錯的地方或那裏遺漏掉

在這請各問板大們幫忙指點~謝謝!

發表於: 2009/4/8 10:22
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







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.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------