🇩🇪
Sprung_anfang
movf PCL,w ;lese Program Counter
MOVF Temp0,W ;lade Offset
rlncf WREG, W ; 2Bytes pro Befehl
ADDWF PCL,F ;Addiere Offset
Bra Offset0
Bra Offset1
Sprung_ende
Bra Offset2
IF (high (Sprung_anfang) != high (Sprung_ende))
ERROR "PCL Ueberlauf"
ENDIF
Zitat von: pic18 in 04.02.2024, 19:50:11 CETIch habe im Datenblatt vom 18F4685 die Antwort gefunden. Ist schon so lange her das ich in Assembler programmiert habe.ZitatThe Program Counter (PC) specifies the address of the
instruction to fetch for execution. The PC is 21 bits wide
and is contained in three separate 8-bit registers. The
low byte, known as the PCL register, is both readable
and writable. The high byte, or PCH register, contains
the PC<15:8> bits; it is not directly readable or writable.
Updates to the PCH register are performed through the
PCLATH register. The upper byte is called PCU. This
register contains the PC<20:16> bits; it is also not
directly readable or writable. Updates to the PCU
register are performed through the PCLATU register.
The contents of PCLATH and PCLATU are transferred
to the program counter by any operation that writes to
the PCL. Similarly, the upper two 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.4.1 "Computed
GOTO").
movf PCLATH,w
movwf PCLATH
movf PCL,w ;lese Program Counter
movf PCL,w ;lese Program Counter
MOVF Temp0,W ;lade Offset
rlncf WREG, W ; 2Bytes pro Befehl
ADDWF PCL,F ;Addiere Offset
Bra Offset0
Bra Offset1
Bra Offset2