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


Browsing this Thread:   1 Anonymous Users






Re: PIC16C57 locate code in other page error
#7
版主
版主


查看用戶資訊
PIC16C57 have 4 pages program and each page will be 512 instruction word due to both CALL & GOTO instruction which just have 8 & 9-bit address access.
therefore, we have to use the Page selection for all program memory access. and remember the CALL just can access location for 0x00 ~ 0xFF of each page.

Please see as below code example for using the MACRO instruction PAGESEL with MPASM.

pagesel Label
call Label ( subroutine access with 0x200 ~ 0x2ff)
:
:
org 0x0200
Label movlw 0x00
movwf 0x20
:
:
return

you also can see the MPASM Presentation as below web linker if you can read the Chinese.
http://www.microchip.com.tw/modules/w ... ds/visit.php?cid=4&lid=32

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


Re: PIC16C57 locate code in other page error
#6
新會員
新會員


查看用戶資訊
Problem is solved by adding one instruction(GOTO RESET) @ 000H. It's seems my codes run to 000H

Also :
org 0x7FFH
GOTO RESET


Thanks.

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


Re: PIC16C57 locate code in other page error
#5
資深會員
資深會員


查看用戶資訊
Post up your code right here that we can solve the problem.

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


Re: PIC16C57 locate code in other page error
#4
資深會員
資深會員


查看用戶資訊
Sorry,you're right.
STATUS REGISTER (ADDRESS: 03h)
PA<1:0>: Program page preselect bits
00 = Page 0 (000h - 1FFh)
01 = Page 1 (200h - 3FFh)
10 = Page 2 (400h - 5FFh)
11 = Page 3 (600h - 7FFh)

ex:(If this code section at page0.)
BSF STATUS,PA0
CALL test2h
BCF STATUS,PA0

org 200h
test2h: retlw 0

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


Re: PIC16C57 locate code in other page error
#3
新會員
新會員


查看用戶資訊
Sorry, this ins no PCLATH register for PIC16C57, only PCL found.
But even if this subfunction is NOT used at all, it still will cause my code can't work. This is very confusing to me.
In this case, I don't bother to modify PCLATH.

If I use this subfunction, I do modify bit 5 & 6 of STATUS for page switch. But still code fails .

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


Re: PIC16C57 locate code in other page error
#2
資深會員
資深會員


查看用戶資訊
Check the datasheet. You must modify "PCLATH".

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


PIC16C57 locate code in other page error
#1
新會員
新會員


查看用戶資訊
Dear All,
There is a strange problem when using PIC16C57.
If my main code is all ok located in page0, size 160 bytes.
Now if I just place one sub-function in page1 or 2, 3
like:
org 200h
test2h: retlw 0

Problem appears, code can't work whether test2h is invoked or not.
Please feel free to remark on this issue.

Thanks.

Emic.

發表於: 2009/10/28 11:12
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... ]

教育訓練中心

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