Re: PIC16C57 locate code in other page error
|
||||
---|---|---|---|---|
版主
|
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
|
|||
|
Re: PIC16C57 locate code in other page error
|
||||
---|---|---|---|---|
新會員
|
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
|
|||
|
Re: PIC16C57 locate code in other page error
|
||||
---|---|---|---|---|
資深會員
|
Post up your code right here that we can solve the problem.
發表於: 2009/10/28 17:49
|
|||
|
Re: PIC16C57 locate code in other page error
|
||||
---|---|---|---|---|
新會員
|
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
|
|||
|
Re: PIC16C57 locate code in other page error
|
||||
---|---|---|---|---|
資深會員
|
Check the datasheet. You must modify "PCLATH".
發表於: 2009/10/28 11:43
|
|||
|
PIC16C57 locate code in other page error
|
||||
---|---|---|---|---|
新會員
|
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
|
|||
|