• slider image 442
  • slider image 492
  • slider image 493
  • slider image 494
  • slider image 495
  • slider image 496
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: RES設定的問題
#8
版主
版主


查看用戶資訊
參照:
請問 ee位址 如何自動接續於 bb 之後?


這是你所要問的問題,而上一個又是另外一個問題,這是不一樣的解答。請問真正的問題是?

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


Re: RES設定的問題
#7
資深會員
資深會員


查看用戶資訊

找到版主以前的文章

My_RAM1       udata
Table_Header1 res Table_Size
/2
KeyBoard_Table_Header res KEYBOARD_TABLE_SIZE

My_RAM0       udata
Table_Header0 res Table_Size
/2
I2C_Addr res 1
Delay_Counter res 1
Delay_Counter1 res 1

1. 必須修改 Section Name to My_RAM0 
My-RAM1
2. Section Name 必須在 LKR 檔裡加入其名稱。
[color=FF0000]
p16F887.lkr 要加入的宣告

SECTION    NAME=My_RAM0      RAM=gpr0         // RAM variable space - Bank0
SECTION    NAME=My_RAM1       RAM=gpr1          // RAM variable space - Bank1 
[/color]
2008/04/16 11:12

多個 ASM 檔
,也會自動分配RAM

感謝版主


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


Re: RES設定的問題
#6
版主
版主


查看用戶資訊
參照:

shpeng 寫道:


請教版主
大字.比較容易閱讀
;=================
;
於 .LKR 檔
;=================
  
DATABANK   NAME=gpr0     START=0x20     END=0x6F
  DATABANK   NAME
=gpr1     START=0xA0     END=0xEF
  DATABANK   NAME
=gpr2     START=0x120    END=0x16f

;=================
;
於 A.asm 檔
;=================
gpr1A    UDATA    0xA0    
     aa REG 1
     bb REG 1

gpr2A    UDATA    0x120    
     cc REG 1
     dd REG 1
     
.
     .
     .
     
end

;=================
;
於 B.asm 檔
;=================
gpr1B    UDATA  <?>
     ee REG 1   <----請問 ee位址 如何自動接續於 bb 之後?
     ff REG 1
     .
     .
     .
     end
請問有文件可以參考嗎? TKS



這有點複雜,因為屬不同的兩個 asm 檔。一般是不會這樣宣告的,要被對方使用到或使用對方宣告的變數是可以使用 global & extern 來擴展變數的視野的。你應先崁解一下這兩個虛指令的用法。以妳的例子只能強制給位址:
gpr1B UDATA 0xA2
ee REG 1
ff REG 1
.

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


Re: RES設定的問題
#5
版主
版主


查看用戶資訊
參照:

小游 寫道:
原來是如此,可以再請問例如我A已經使用RES分配一個位址了,那如果B要跟A共用同一個位址的話要如何設定呢?謝謝


PIC16Fxxx 可以使用 udata_ovr 的宣告來共用 RAM,其說明如下:
myaoscn       udata_ovr  0x40
u8a
:          res 1
u8b
:          res 1
u8c
:          res 1
u8d
:          res 1
myaoscn       udata_ovr  0x40
u16a
:         res 1
u16b
:         res 1
u16c
:         res 1
u16d
:         res 1


1. Section name (節區名稱) 要一樣 : myaoscn,如果有指定位址其位址也要一樣 (範例中為 0x40)
2. 這樣組譯後的位址: u8a = 0x40 = u16a, u8b=u16b=0x41

myaoscn       udata_ovr   
u8a
:          res 1
u8b
:          res 1
u8c
:          res 1
u8d
:          res 1
myaoscn       udata_ovr   
u16a
:         res 1
u16b
:         res 1
u16c
:         res 1
u16d
:         res 1


不指定位址,原則上會從最前面的位址 0x20 開始排起。
這樣組譯後的位址: u8a = 0x20 = u16a, u8b=u16b=0x21

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


Re: RES設定的問題
#4
資深會員
資深會員


查看用戶資訊


請教版主
大字.比較容易閱讀
;=================
;
於 .LKR 檔
;=================
  
DATABANK   NAME=gpr0     START=0x20     END=0x6F
  DATABANK   NAME
=gpr1     START=0xA0     END=0xEF
  DATABANK   NAME
=gpr2     START=0x120    END=0x16f

;=================
;
於 A.asm 檔
;=================
gpr1A    UDATA    0xA0    
     aa REG 1
     bb REG 1

gpr2A    UDATA    0x120    
     cc REG 1
     dd REG 1
     
.
     .
     .
     
end

;=================
;
於 B.asm 檔
;=================
gpr1B    UDATA  <?>
     ee REG 1   <----請問 ee位址 如何自動接續於 bb 之後?
     ff REG 1
     .
     .
     .
     end
請問有文件可以參考嗎? TKS


發表於: 2009/6/25 0:48
少年不知愁滋味,老來方知路難行。
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: RES設定的問題
#3
新會員
新會員


查看用戶資訊
原來是如此,可以再請問例如我A已經使用RES分配一個位址了,那如果B要跟A共用同一個位址的話要如何設定呢?謝謝

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


Re: RES設定的問題
#2
版主
版主


查看用戶資訊
因為 RAM 0x70~0x7F 是屬於 Share Bank,所以不能用一般的 GP RAM 的方式去定義它,要使用 UDATA_SHR 的方式。參考底下的範例:
LIST      p=16F723             ; list directive to define processor
     
#INCLUDE <P16F723.INC>         ; processor specific variable definitions

;------------------------------------------------------------------------------
;
CONFIGURATION WORD SETUP
;
The 'CONFIG' directive is used to embed the configuration word within the 
; .asm fileThe lables following the directive are located in the respective 
; .inc file.  See the data sheet for additional information on configuration 
word settings.
;
;------------------------------------------------------------------------------

     
__CONFIG    _CONFIG1_DEBUG_OFF _PLL_DIS _BORV_1_9 _BOR_OFF _CP_OFF _MCLR_EN _PWRT_EN _WDT_OFF _INTOSCIO 
     __CONFIG    _CONFIG2
_VCAP_DIS

;------------------------------------------------------------------------------
;
VARIABLE DEFINITIONS
;
Available Data Memory divided into Bank 0 through Bank 3.  Each Bank contains
Special Function Registers and General Purpose Registers at the locations 
below:  
;
;           
SFR           GPR               SHARED GPR's
; Bank 0    0x00-0x1F     0x20-0x6F         0x70-0x7F    
; Bank 1    0x80-0x9F     0xA0-0xEF         0xF0-0xFF  
; Bank 2    0x100-0x11F   0x120-0x12F       0x170-0x17F
; Bank 3    0x180-0x19F                     0x1F0-0x1FF
;
;------------------------------------------------------------------------------

; Example of using Shared Uninitialized Data Section
INT_VAR        UDATA_SHR       0x7D
W_TEMP         RES        1    ; w register for context saving (Shared)
STATUS_TEMP    RES        1    ; status used for context saving 
PCLATH_TEMP    RES        1    ; variable used for context saving

; Example of using GPR Uninitialized Data
GPR_VAR        UDATA           0x20
MYVAR1         RES        1    ; User variable located at address 0x20
MYVAR2         RES        1    ; User variable located at address 0x21
MYVAR3         RES        1    ; User variable located at address 0x22

;------------------------------------------------------------------------------
; RESET VECTOR
;------------------------------------------------------------------------------

RESET     CODE    0x0000            ; processor reset vector
          pagesel START
          GOTO    START             ; go to beginning of program

;------------------------------------------------------------------------------
; INTERRUPT SERVICE ROUTINE
;------------------------------------------------------------------------------

ISR       CODE    0x0004            ; interrupt vector location
;         Context saving for ISR
          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
          MOVF    PCLATH,W          ; move pclath register into W register
          MOVWF   PCLATH_TEMP       ; save off contents of PCLATH register

;------------------------------------------------------------------------------
; USER INTERRUPT SERVICE ROUTINE GOES HERE
;------------------------------------------------------------------------------

;         Restore context before returning from interrupt

          MOVF    PCLATH_TEMP,W     ; retrieve copy of PCLATH register
          MOVWF   PCLATH            ; restore pre-isr PCLATH register contents
          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 PROGRAM
;------------------------------------------------------------------------------

START

;------------------------------------------------------------------------------
; PLACE USER PROGRAM HERE
;------------------------------------------------------------------------------

          GOTO $

          END

發表於: 2009/6/24 18:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


RES設定的問題
#1
新會員
新會員


查看用戶資訊
我使用PIC16F723,使用RES,定義"BANK0_20 iDATA 0x20" "BANK1_A0 IDATA 0xA2",用RES去設定RAM位址,但是在BANK0只要超過0x6F就會出現錯誤,BANK0不是可以定義到0x7F嗎?然後我定義"BANK0_70 IDATA 0x70"想再從0x70開始排RAM的位址,結果出現"Error - section 'BANK0_70' can not fit the absolute section. Section 'BANK0_70' start=0x00000070, length=0x0000000",請問要該如何解決?謝謝

發表於: 2009/6/24 16:44
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... ]

教育訓練中心

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