7 PIC18 InstructionSet Assembly Machine PDF
7 PIC18 InstructionSet Assembly Machine PDF
7 PIC18 InstructionSet Assembly Machine PDF
Opcode a f f f f f f f f
OR
Opcode d a f f f f f f f f
File Register Address
Destination( W or F) Access Bank
Or BSF
ADDWF 0x 25 ,W ,A
File Register Address Use Access Bank
Destination ( Optional)
Instruction Set Overview
Bit Oriented Operations
15 11 9 8 7 0
Opcode b b b a f f f f f f f f
File Register Address
BSF 0x25, 3, A
File Register Address Access Bank
Bit Position (Optional)
Instruction Set Overview
Literal and Control Operations
15 8 7 Literal Value 0
Opcode k k k k k k k k
OR
Opcode
MOVLW 0 x25
Literal Value
Instruction Set Overview
- Two-word instruction
Byte to Byte Move Operations( 2Words)
15 12 11 Source Register Address 0
Opcode fs fs fs fs fs fs fs fs fs fs fs fs
Opcode fd fd fd fd fd fd fd fd fd fd fd fd
Destination Register Address
Opcode n8 n7 n6 n5 n4 n3 n2 n1
Opcode n20 n19 n18 n17 n16 n15 n14 n13 n12 n11 n10 n9
CALL 0x 1125
Subroutine Address
Machine Control Instructions
o CLRWDT ;Clear Watchdog Timer
n Helps recover from software malfunction
n Uses its own free-running on-chip RC oscillator
n WDT is cleared by CLRWDT instruction
The PIC18 has a 12-bit RAM address space, divided into 16 pages of 256 bytes. The 8-bit f field determines the address in combination with the a bit
and the 4-bit bank select register (BSR). If a=0, the BSR is ignored and the f field is sign-extended to the range 0x000–0x07F (global RAM) or
0xF80–0xFFF (special function registers). If a=1, the f field is extended with the BSR to generate the 12-bit address.
The PIC18 extends the FSR/INDF mechanism used in previous PICmicro processors for indirect addressing in two ways. First, it provides three file
select registers. The FSRn registers are 12 bits long (each split into two 8-bit portions FSR0L through FSR2H), and access to the corresponding
INDFn register (INDF0 through INDF2) acts as an alias for the addressed byte.
Second, there are addressing modes. For each of the three, there is not just one INDFn register, but five, and the one used determines the addressing
mode:
There are also instructions to directly load an FSR pair with a 12-bit address, and a MOVFF instruction that moves a byte between two 12-bit addresses.