General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word....
Transcript of General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word....
![Page 1: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/1.jpg)
1
PIC16F877 Instruction Set
PIC – INSTRUCTION SET
Dr. Charles J. Kim
Howard University
![Page 2: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/2.jpg)
2
F877 Instruction Set� 14-Bit Word� Byte-Oriented Instruction
�F: File Register (or RAM)�D: Destination
⌧D=0: Destination � W⌧D=1: Destination � File Register
� Bit-Oriented Instruction�B: Bit Field�F: Register File where the Bit is located
� Literal and Control Operation�K: 8-bit constant
![Page 3: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/3.jpg)
3
General Form of Instruction
![Page 4: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/4.jpg)
4
Instruction List
![Page 5: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/5.jpg)
5
Destination of the result�D=0: Destination � W�D=1: Destination � File Register (Default)
�addwf PORTD ; ⌧Add content of PORTD to content of the W and
store the result back into PORTD
�addwf PORTD, 0 ;⌧Add content of PORTD to content of the W and
store the result into W
![Page 6: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/6.jpg)
6
Register Addressing Modes�Immediate Addressing
⌧(ex) MOVLW 0x0F�Direct Addressing
�Uses 7 bits of 14 bit instruction to identify a register file address
�8th and 9th bit comes from RP0 and RP1 bits of STATUS register.
� (ex) SSPCON EQU 0x14STATUS EQU 0x03SSPSTAT EQU 0x94BCF STATUS, 0x05BCF SSPCON, 0x01BSF STATUS, 0x05BCF SSPSTAT, 0x02
![Page 7: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/7.jpg)
7
Direct Addressing
![Page 8: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/8.jpg)
8
Indirect Addressing� INDF register
�Any instruction using the INDF actually accesses the register pointed to by the File Select Register (FSR).
� A 9-bit EA is obtained by concatenating the 8-bit FSR register and the IRP bit(STATUS<7>)
� Example: Erase the RAM section of 0x20-0x2F
Movlw 0x20; pointerMovwf FSR
Next clrf INDF
incf FSRbtfss FSR, 4
goto next
……
![Page 9: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/9.jpg)
9
Direct vs. Indirect Addressing
![Page 10: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/10.jpg)
10
Instruction Sets –description convention
![Page 11: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/11.jpg)
11
addlw
![Page 12: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/12.jpg)
12
addwf
![Page 13: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/13.jpg)
13
andlw
![Page 14: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/14.jpg)
14
andwf
![Page 15: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/15.jpg)
15
Bcf & bsf
![Page 16: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/16.jpg)
16
btfsc
![Page 17: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/17.jpg)
17
Btfss
![Page 18: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/18.jpg)
18
Call
![Page 19: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/19.jpg)
19
CLRF & CLRW
![Page 20: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/20.jpg)
20
COMF & DECF
![Page 21: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/21.jpg)
21
DECFSZ
![Page 22: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/22.jpg)
22
GOTO & INCF
![Page 23: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/23.jpg)
23
INCFSZ
![Page 24: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/24.jpg)
24
IORLW & IORWF
![Page 25: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/25.jpg)
25
MOVLW & MOVF
![Page 26: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/26.jpg)
26
MOVWF & NOP
![Page 27: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/27.jpg)
27
RETFIE & RETLW
![Page 28: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/28.jpg)
28
RETURN
![Page 29: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/29.jpg)
29
RLF & RRF
![Page 30: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/30.jpg)
30
SUBLW & SUBWF
![Page 31: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/31.jpg)
31
SWAPF & XORLW
![Page 32: General Form of Instruction PIC INST.pdf · 2012. 5. 8. · 2. F877 Instruction Set. 14-Bit Word. Byte-Oriented Instruction. F: File Register (or RAM) D: Destination ⌧ D=0: Destination](https://reader035.fdocuments.net/reader035/viewer/2022071416/611321b49f00750cea7485c2/html5/thumbnails/32.jpg)
32
XORWF