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


Browsing this Thread:   1 Anonymous Users






Re: re-locatable ASM
#4
版主
版主


查看用戶資訊
程式改好了,是 10 進制表示的語法關係。
[color=ff0000]        list p=16f887
        
include <p16f887.inc>

#define SCAN_IN0 Temp_Portd,0
#define SCAN_IN1 Temp_Portd,1
#define SCAN_IN2 Temp_Portd,2
#define SCAN_IN3 Temp_Portd,3
#define SCAN_IN4 Temp_Portd,4
#define SCAN_IN5 Temp_Portd,5
#define SCAN_IN6 Temp_Portd,6
#define SCAN_IN7 Temp_Portd,7
#define SCAN_DEC_EN porta,7
#define SCAN_DEC_OUT0 porte,0
#define SCAN_DEC_OUT1 porte,1
#define SCAN_DEC_OUT2 porte,2
#define IN_CODE0 0
#define IN_CODE1 1
#define IN_CODE2 2
#define IN_CODE3 3
#define IN_CODE4 4
#define IN_CODE5 5
#define IN_CODE6 6
#define IN_CODE7 7
#define Table_Size .128
#define KEYBOARD_TABLE_SIZE .16

#define KEY_BREAK 0
#define KEY_MAKE .128  ; 改10進制語法
#define KEY_REPEAT .130
#define KEY_STEP .16


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

My_RAM1         udata
Table_Header1     res Table_Size
/2
KeyBoard_Table_Header res     KEYBOARD_TABLE_SIZE

    udata_shr
W_Temp         res 1
Status_Temp     res 1
Pclath_Temp     res 1

Temp_Scan_Code     res 1
Temp_Scan_Out     res 1
Temp_Portd         res 1
Temp_Scan_In     res 1
Temp_Clear_Update_Table res 1



STARTUP code 0x00

    nop
    end 
[/color]

Table_Header0 at 0x20
Table_Header1 at 0xA0
W_temp at 0x71

發表於: 2008/4/16 13:19
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: re-locatable ASM
#3
新會員
新會員


查看用戶資訊
Dear Ryang,
剛剛把

SECTION NAME=My_RAM0 RAM=gpr0 // RAM variable space - Bank0
SECTION NAME=My_RAM1 RAM=gpr1 // RAM variable space - Bank1

加到 lkr file 里;asm 加上

list p=16f887
#include "p16f887.inc"

#define SCAN_IN0 Temp_Portd,0
#define SCAN_IN1 Temp_Portd,1
#define SCAN_IN2 Temp_Portd,2
#define SCAN_IN3 Temp_Portd,3
#define SCAN_IN4 Temp_Portd,4
#define SCAN_IN5 Temp_Portd,5
#define SCAN_IN6 Temp_Portd,6
#define SCAN_IN7 Temp_Portd,7
#define SCAN_DEC_EN porta,7
#define SCAN_DEC_OUT0 porte,0
#define SCAN_DEC_OUT1 porte,1
#define SCAN_DEC_OUT2 porte,2
#define IN_CODE0 0
#define IN_CODE1 1
#define IN_CODE2 2
#define IN_CODE3 3
#define IN_CODE4 4
#define IN_CODE5 5
#define IN_CODE6 6
#define IN_CODE7 7
#define TABLE_SIZE 128
#define KEYBOARD_TABLE_SIZE 16

#define KEY_BREAK 0
#define KEY_MAKE 128
#define KEY_REPEAT 130
#define KEY_STEP 16

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

W_Temp res 1
Status_Temp res 1
Pclath_Temp res 1

Temp_Scan_Code res 1
Temp_Scan_Out res 1
Temp_Portd res 1
Temp_Scan_In res 1
Temp_Clear_Update_Table res 1



STARTUP code 0x00

nop
end



還是看到 Table_Header1 的address 為 0x20 (bank0) 並不是我指的 bank1(0xa0-0xef)


謝謝

發表於: 2008/4/16 11:39
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: re-locatable ASM
#2
版主
版主


查看用戶資訊
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 檔裡加入其名稱。

p16F887
.lkr 要加入的宣告: [color=ff0000]

SECTION    NAME=My_RAM0      RAM=gpr0         // RAM variable space - Bank0
SECTION    NAME=My_RAM1       RAM=gpr1          // RAM variable space - Bank1 [/color]


發表於: 2008/4/16 11:12
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


re-locatable ASM
#1
新會員
新會員


查看用戶資訊
Dear 版主,
在下面的sample code 中,我發現 Table_Header1並不在gpr1的範圍內(用debug SIM watch看的) , 請幫我看一下我哪里寫錯,謝謝。


list p=16f887
#include "p16f887.inc"

#define SCAN_IN0 Temp_Portd,0
#define SCAN_IN1 Temp_Portd,1
#define SCAN_IN2 Temp_Portd,2
#define SCAN_IN3 Temp_Portd,3
#define SCAN_IN4 Temp_Portd,4
#define SCAN_IN5 Temp_Portd,5
#define SCAN_IN6 Temp_Portd,6
#define SCAN_IN7 Temp_Portd,7
#define SCAN_DEC_EN porta,7
#define SCAN_DEC_OUT0 porte,0
#define SCAN_DEC_OUT1 porte,1
#define SCAN_DEC_OUT2 porte,2
#define IN_CODE0 0
#define IN_CODE1 1
#define IN_CODE2 2
#define IN_CODE3 3
#define IN_CODE4 4
#define IN_CODE5 5
#define IN_CODE6 6
#define IN_CODE7 7
#define TABLE_SIZE 128
#define KEYBOARD_TABLE_SIZE 16

#define KEY_BREAK 0
#define KEY_MAKE 128
#define KEY_REPEAT 130
#define KEY_STEP 16

gpr1 udata
Table_Header1 res Table_Size/2
KeyBoard_Table_Header res KEYBOARD_TABLE_SIZE

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

W_Temp res 1
Status_Temp res 1
Pclath_Temp res 1

Temp_Scan_Code res 1
Temp_Scan_Out res 1
Temp_Portd res 1
Temp_Scan_In res 1
Temp_Clear_Update_Table res 1



STARTUP code 0x00

nop
end

發表於: 2008/4/16 10:54
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... ]

教育訓練中心

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