|
楼主 |
发表于 2010-3-24 09:05:03
|
显示全部楼层
谢谢,还要这样用啊,那就不大方便了,手册里这样写的
The contents of PCLATH and PCLATU are transferred
to the program counter by any operation that writes to
PCL. Similarly, the upper 2 bytes of the program
counter are transferred to PCLATH and PCLATU by an
operation that reads PCL. This is useful for computed
offsets to the PC (see Section 5.1.6.1 “Computed
GOTO”).
The PC addresses bytes in the program memory. To
prevent the PC from becoming misaligned with word
instructions, the Least Significant bit (LSb) of PCL is
fixed to a value of ‘0’. The PC increments by two to
address sequential instructions in the program
memory.
The CALL, RCALL, GOTO and program branch
instructions write to the program counter directly. For
these instructions, the contents of PCLATH and
PCLATU are not transferred to the program counter.
(原文件名:未命名.jpg)
上面不是说在读PCL的时候 PCLATH,PCLATU不是自动从PC更新过来吗?奇怪
;******************************************************************************
;Start of main program
; The main program code is placed here.
ORG 0x1000
TABLE
;ADDWF PCL
;MOVWF PCL,F
ADDWF PCL,F
RETLW H'0F'
RETLW H'0E'
RETLW H'0D'
RETLW H'0C'
RETLW H'0B'
RETLW H'0A'
RETLW H'09'
RETLW H'08'
RETLW H'07'
Main:
MOVLW H'10'
MOVWF PCLATH
MOVLW D'4'
CALL TABLE
GOTO $ |
|