Quick Reference. B.5 12-Bit Core Instruction Set APPENDICES

Similar documents
Section 29. Instruction Set

Chapter 2: Assembly Language Programming. The PIC18 Microcontroller. Han-Way Huang

AN880. Converting from 8051 to Microchip Assembler: A Quick Reference INTRODUCTION

Call Subroutine (PC<15:0>) TOS, (W15)+2 W15 (PC<23:16>) TOS, Process data. Write to PC NOP NOP NOP NOP

PIC Programming in Assembly. (

AN727. Credit Card Reader Using a PIC12C509 DATA ENCODING INTRODUCTION FIGURE 1: POSITION OF ISO TRACKS 1, 2 AND 3. Andrew M Errington

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

Four-Channel Digital Voltmeter with Display and Keyboard. 8 x 220W RB0 RB1 RB2 RB3 RB4 RB5 RB6 RB7 RA0 RA1 RA2 RA3 PIC16C71

10-bit Σ ADC from a PIC16F84

Section 14. Compare/Capture/PWM (CCP)

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

C Compiler Reference Manual. July 2003

Introduction to MPLAB IDE

Using The PIC I/O Ports

8085 INSTRUCTION SET

Microchip PIC18F452 Core Hardware. CPU, Memory, Interrupts, and I/O Ports

Z80 Instruction Set. Z80 Assembly Language

M6800. Assembly Language Programming

Programmer s Model = model of µc useful to view hardware during execution of software instructions

Section 44. CPU with Extended Data Space (EDS)

Section 8. Interrupts

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

PIC16F84A. 18-pin Enhanced Flash/EEPROM 8-Bit Microcontroller. Devices Included in this Data Sheet: Pin Diagrams. High Performance RISC CPU Features:

How To Program A Microcontroller With Memory On A Microchip Microcontroller

MICROPROCESSOR AND MICROCOMPUTER BASICS

PIC in Practice. A Project-Based Approach. D. W. Smith

1 Classical Universal Computer 3

PIC16F8X. 18-pin Flash/EEPROM 8-Bit Microcontrollers. Devices Included in this Data Sheet: Pin Diagrams. High Performance RISC CPU Features:

Memory organization. Memory blocks: Program memory (flash-type) 16 kword (32 kbyte) (instruction 16 bit wide) Data RAM 1536 byte (1.

Section 28. In-Circuit Serial Programming (ICSP )

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Simple Alarm System WIRELESS AND REMOTE CONTROLLED PERSONAL APPLIANCE CODE WORD ORGANIZATION TRANSMISSION FORMAT

SSPBUF. Shift Clock SSPSR. START bit, STOP bit, Acknowledge Generate

MACHINE ARCHITECTURE & LANGUAGE

SPI. Overview and Use of the PICmicro Serial Peripheral Interface. Getting Started: SPI

EECS 427 RISC PROCESSOR

PIC10F200/202/204/206 Data Sheet

PIC12F508/509/16F505 Data Sheet

Analog-to-Digital Converters

PIC12F629/675 Data Sheet

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB

In-Circuit Serial Programming (ICSP ) Guide

HC12 Assembly Language Programming

PART B QUESTIONS AND ANSWERS UNIT I

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Appendix C: Keyboard Scan Codes

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

PIC16F84A Data Sheet. 18-pin Enhanced FLASH/EEPROM 8-bit Microcontroller Microchip Technology Inc. DS35007B

AN851. A FLASH Bootloader for PIC16 and PIC18 Devices INTRODUCTION FIRMWARE. Basic Operation BOOTLOADER FUNCTIONAL BLOCK DIAGRAM COMMUNICATIONS

CPU Organization and Assembly Language

Chapter 7D The Java Virtual Machine

Section 9. I/O Ports

Traditional IBM Mainframe Operating Principles

Microprocessor & Assembly Language

8051 hardware summary

AN857. Brushless DC Motor Control Made Easy INTRODUCTION S 001 B. Anatomy of a BLDC SIMPLIFIED BLDC MOTOR DIAGRAMS. Microchip Technology Inc.

PROBLEMS (Cap. 4 - Istruzioni macchina)

2011, The McGraw-Hill Companies, Inc. Chapter 3

Instruction Set. Microcontroller Instruction Set. Instructions that Affect Flag Settings (1) The Instruction Set and Addressing Modes

Instruction Set Architecture

Binary Numbers. Binary Octal Hexadecimal

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

Decimal to Binary Conversion

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Instruction Set Architecture

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Embedded C Programming

Computer Organization and Architecture

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Introduction to PIC Programming

Real-Time Clock. * Real-Time Computing, edited by Duncan A. Mellichamp, Van Nostrand Reinhold

AN585. A Real-Time Operating System for PICmicro Microcontrollers INTRODUCTION. Why do I Need a Real-Time Kernel? What is Multitasking Anyway?

8051 MICROCONTROLLER COURSE

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

I 2 C Master Mode Overview and Use of the PICmicro MSSP I 2 C Interface with a 24xx01x EEPROM

Lecture N -1- PHYS Microcontrollers

PIC12F519 Data Sheet. 8-Pin, 8-Bit Flash Microcontrollers

c0003 A Simple PIC Application CHAPTER 3

AN974 APPLICATION NOTE

Central Processing Unit (CPU)

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

Systems I: Computer Organization and Architecture

Computer Science 281 Binary and Hexadecimal Review

Computer organization

CHAPTER 7: The CPU and Memory

Chapter 9 Computer Design Basics!

PIC16F526 Data Sheet. 14-Pin, 8-Bit Flash Microcontroller Microchip Technology Inc. Preliminary DS41326A

AN857. Brushless DC Motor Control Made Easy INTRODUCTION S 001 B. Anatomy of a BLDC SIMPLIFIED BLDC MOTOR DIAGRAMS

Flash Microcontroller. Memory Organization. Memory Organization

AN730. CRC Generating and Checking INTRODUCTION THEORY OF OPERATION EXAMPLE 1: MODULO-2 CALCULATION. Example Calculation. Microchip Technology Inc.

Microcomputer Components SAB 80515/SAB 80C515 8-Bit Single-Chip Microcontroller Family

CPEN Digital Logic Design Binary Systems

An Overview of Stack Architecture and the PSC 1000 Microprocessor

AN617. Fixed Point Routines FIXED POINT ARITHMETIC INTRODUCTION. Thi d t t d ith F M k Design Consultant

Introduction to Microcontrollers

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

How To Set The Sensor On A Powerpoint 3.5 (Powerpoint) On A Blackberry 2.5A (Powerplant) On An Iphone Or Ipad (Powerplant) On The Blackberry 3.2 (

AN734. Using the PICmicro SSP for Slave I 2 C TM Communication INTRODUCTION THE I 2 C BUS SPECIFICATION

Transcription:

Quic Reference B.5 12-Bit ore Instruction Set Microchip s base-line 8-bit microcontroller family uses a 12-bit wide instruction set. All instructions execute in a single instruction cycle unless otherwise noted. Any unused opcode is executed as a NOP. The instruction set is grouped into the following catagories: Table B.5: 12-Bit ore Literal and ontrol Operations E ANDLW AND literal and W.AND. W W 9 ALL all subroutine P + 1 TOS, P 004 LRWDT lear watchdog timer 0 WDT (and Prescaler if assigned) A GOTO Goto address ( is nine bits) P(9 bits) D IORLW Incl. OR literal and W.OR. W W MOVLW Move Literal to W W 002 OPTION Load OPTION Register W OPTION Register 8 RETLW Return with literal in W W, TOS P 003 SLEEP Go into Standby Mode 0 WDT, stop oscillator 00f TRIS f Tristate port f W I/O control reg f F XORLW Exclusive OR literal and W.XOR. W W Table B.6: 12-Bit ore Byte Oriented File Register Operations 1f ADDWF f,d Add W and f W + f d 14f ANDWF f,d AND W and f W.AND. f d 06f LRF f lear f 0 f 040 LRW lear W 0 W 24f OMF f,d omplement f.not. f d 0f DEF f,d Decrement f f - 1 d 2f DEFSZ f,d Decrement f, sip if zero f - 1 d, sip if zero 28f INF f,d Increment f f + 1 d 3f INFSZ f,d Increment f, sip if zero f + 1 d,sip if zero 10f IORWF f,d Inclusive OR W and f W.OR. f d 20f MOVF f,d Move f f d 02f MOVWF f Move W to f W f 000 NOP No operation 34f RLF f,d Rotate left f APPENDIES 1999 Microchip Technology Inc. DS33014G-page 181

MPASM User s Guide with MPLINK and MPLIB Table B.6: 12-Bit ore Byte Oriented File Register Operations (ontinued) 30f RRF f,d Rotate right f 08f SUBWF f,d Subtract W from f f - W d 38f SWAPF f,d Swap halves f f(0:3) f(4:7) d 18f XORWF f,d Exclusive OR W and f W.XOR. f d Table B.7: 12-Bit ore Bit Oriented File Register Operations 4bf BF f,b Bit clear f 0 f(b) 5bf BSF f,b Bit set f 1 f(b) 6bf BTFS f,b Bit test, sip if clear sip if f(b) = 0 7bf BTFSS f,b Bit test, sip if set sip if f(b) = 1 DS33014G-page 182 1999 Microchip Technology Inc.

Quic Reference B.6 14-Bit ore Instruction Set Microchip s mid-range 8-bit microcontroller family uses a 14-bit wide instruction set. This instruction set consists of 36 instructions, each a single 14-bit wide word. Most instructions operate on a file register, f, and the woring register, W (accumulator). The result can be directed either to the file register or the W register or to both in the case of some instructions. A few instructions operate solely on a file register (BSF for example). The instruction set is grouped into the following catagories: Table B.8: 14-Bit ore Literal and ontrol Operations 3E ADDLW Add literal to W + W W 39 ANDLW AND literal and W.AND. W W 2 ALL all subroutine P + 1 TOS, P 0064 LRWDT T lear watchdog timer 0 WDT (and Prescaler if assigned) 2 GOTO Goto address ( is nine bits) P(9 bits) 38 IORLW Incl. OR literal and W.OR. W W 30 MOVLW Move Literal to W W 0062 OPTION Load OPTION register W OPTION Register 0009 RETFIE Return from Interrupt TOS P, 1 GIE 34 RETLW Return with literal in W W, TOS P 0008 RETURN Return from subroutine TOS P 0063 SLEEP Go into Standby Mode 0 WDT, stop oscillator 3 SUBLW Subtract W from literal - W W 006f TRIS f Tristate port f W I/O control reg f 3A XORLW Exclusive OR literal and W.XOR. W W Table B.9: 14-Bit ore Byte Oriented File Register Operations 07ff ADDWF f,d Add W and f W + f d 05ff ANDWF f,d AND W and f W.AND. f d 018f LRF f lear f 0 f 0100 LRW lear W 0 W 09ff OMF f,d omplement f.not. f d 03ff DEF f,d Decrement f f - 1 d 0Bff DEFSZ f,d Decrement f, sip if zero f - 1 d, sip if 0 0Aff INF f,d Increment f f + 1 d 0Fff INFSZ f,d Increment f, sip if zero f + 1 d, sip if 0 04ff IORWF f,d Inclusive OR W and f W.OR. f d 08ff MOVF f,d Move f f d APPENDIES 1999 Microchip Technology Inc. DS33014G-page 183

MPASM User s Guide with MPLINK and MPLIB Table B.9: 14-Bit ore Byte Oriented File Register Operations (ontinued) 008f MOVWF f Move W to f W f 0000 NOP No operation 0Dff RLF f,d Rotate left f 0ff RRF f,d Rotate right f 02ff SUBWF f,d Subtract W from f f - W d 0Eff SWAPF f,d Swap halves f f(0:3) f(4:7) d 06ff XORWF f,d Exclusive OR W and f W.XOR. f d Table B.10: 14-Bit ore Bit Oriented File Register Operations 1bff BF f,b Bit clear f 0 f(b) 1bff BSF f,b Bit set f 1 f(b) 1bff BTFS f,b Bit test, sip if clear sip if f(b) = 0 1bff BTFSS f,b Bit test, sip if set sip if f(b) = 1 Table B.11: 12-Bit/14-Bit ore Special Instruction Mnemonics Mnemonic Description Equivalent Operation(s) Status ADDF f,d Add arry to File BTFS INF ADDDF f,d Add Digit arry to File BTFS INF B Branch GOTO - B Branch on arry BTFS GOTO BD Branch on Digit arry BTFS GOTO BN Branch on No arry BTFSS GOTO BND Branch on No Digit arry BTFSS GOTO BNZ Branch on No Zero BTFSS GOTO BZ Branch on Zero BTFS GOTO 3,0 f,d 3,1 f,d 3,0 3,1 3,0 3,1 3,2 3,2 Z Z - - - - - - DS33014G-page 184 1999 Microchip Technology Inc.

Quic Reference Table B.11: 12-Bit/14-Bit ore Special Instruction Mnemonics (ontinued) LR lear arry BF 3,0 - LRD lear Digit arry BF 3,1 - LRZ lear Zero BF 3,2 - LALL LGOTO Mnemonic Description MOVFW f Move File to W MOVF f,0 Z NEGF f,d Negate File OMF INF SET Set arry BSF 3,0 - SETD Set Digit arry BSF 3,1 - SETZ Set Zero BSF 3,2 - SKP Sip on arry BTFSS 3,0 - SKPD Sip on Digit arry BTFSS 3,1 - SKPN Sip on No arry BTFS 3,0 - SKPND Sip on No Digit arry BTFS 3,1 - SKPNZ Sip on Non Zero BTFS 3,2 - SKPZ Sip on Zero BTFSS 3,2 - SUBF f,d Subtract arry from File BTFS DEF SUBDF f,d Subtract Digit arry from File BTFS DEF Equivalent Operation(s) TSTF f Test File MOVF f,1 Z f,1 f,d 3,0 f,d 3,1 f,d Status Z Z Z APPENDIES 1999 Microchip Technology Inc. DS33014G-page 185

MPASM User s Guide with MPLINK and MPLIB B.7 16-Bit ore Instruction Set Microchip s high-performance 8-bit microcontroller family uses a 16-bit wide instruction set. This instruction set consists of 55 instructions, each a single 16-bit wide word. Most instructions operate on a file register, f, and the woring register, W (accumulator). The result can be directed either to the file register or the W register or to both in the case of some instructions. Some devices in this family also include hardware multiply instructions. A few instructions operate solely on a file register (BSF for example). Table B.12: 16-Bit ore Data Movement Instructions 6pff MOVFP f,p Move f to p f p b8 MOVLB Move literal to BSR BSR (3:0) bax MOVLP Move literal to RAM page select BSR (7:4) 4pff MOVPF p,f Move p to f p W 01ff MOVWF f Move W to F W f a8ff TABLRD t,i,f Read data from table latch into file f, then update table latch with 16-bit contents of memory location addressed by table pointer acff TABLWT t,i,f Write data from file f to table latch and then write 16-bit table latch to program memory location addressed by table pointer a0ff TLRD t,f Read data from table latch into file f (table latch unchanged) TBLATH f if t=1, TBLATL f if t=0; ProgMem(TBLPTR) TBLAT; TBLPTR + 1 TBLPTR if i=1 f TBLATH if t = 1, f TBLATL if t = 0; TBLAT ProgMem(TBLPTR); TBLPTR + 1 TBLPTR if i=1 TBLATH f if t = 1 TBLATL f if t = 0 a4ff TLWT t,f Write data from file f into table latch f TBLATH if t = 1 f TBLATL if t = 0 Table B.13: 16-Bit ore Arithmetic and Logical Instruction b1 ADDLW Add literal to W (W + ) W 0eff ADDWF f,d Add W to F (W + f) d 10ff ADDWF f,d Add W and arry to f (W + f + ) d b5 ANDLW AND Literal and W (W.AND. ) W 0aff ANDWF f,d AND W with f (W.AND. f) d 28ff LRF f,d lear f and lear d 0x00 f,0x00 d 12ff OMF f,d omplement f.not. f d 2eff DAW f,d Dec. adjust W, store in f,d W adjusted f and d 06ff DEF f,d Decrement f (f - 1) f and d 14ff INF f,d Increment f (f + 1) f and d b3 IORLW Inclusive OR literal with W (W.OR. ) W DS33014G-page 186 1999 Microchip Technology Inc.

Quic Reference Table B.13: 16-Bit ore Arithmetic and Logical Instruction (ontinued) 08ff IORWF f,d Inclusive or W with f (W.OR. f) d b0 MOVLW Move literal to W W bc MULLW Multiply literal and W ( x W) PH:PL 34ff MULWF f Multiply W and f (W x f) PH:PL 2cff NEGW f,d Negate W, store in f and d (W + 1) f,(w + 1) d 1aff RLF f,d Rotate left through carry 22ff RLNF f,d Rotate left (no carry) 18ff RRF f,d Rotate right through carry 20ff RRNF f,d Rotate right (no carry) 2aff SETF f,d Set f and Set d 0xff f,0xff d b2 SUBLW Subtract W from literal ( - W) W 04ff SUBWF f,d Subtract W from f (f - W) d 02ff SUBWFB f,d Subtract from f with borrow (f - W - c) d 1cff SWAPF f,d Swap f f(0:3) d(4:7), f(4:7) d(0:3) b4 XORLW Exclusive OR literal with W (W.XOR. ) W 0cff XORWF f,d Exclusive OR W with f (W.XOR. f) d Table B.14: 16-Bit ore Bit Handling Instructions 8bff BF f,b Bit clear f 0 f(b) 8bff BSF f,b Bit set f 1 f(b) 9bff BTFS f,b Bit test, sip if clear sip if f(b) = 0 9bff BTFSS f,b Bit test, sip if set sip if f(b) = 1 3bff BTG f,b Bit toggle f.not. f(b) f(b) APPENDIES 1999 Microchip Technology Inc. DS33014G-page 187

MPASM User s Guide with MPLINK and MPLIB Table B.15: 16-Bit ore Program ontrol Instructions e ALL Subroutine call (within 8 page) P+1 TOS, P(12:0), (12:8) PLATH(4:0), P(15:13) PLATH(7:5) 31ff PFSEQ f ompare f/w, sip if f = w f-w, sip if f = W 32ff PFSGT f ompare f/w, sip if f > w f-w, sip if f > W 30ff PFSLT f ompare f/w, sip if f< w f-w, sip if f < W 16ff DEFSZ f,d Decrement f, sip if 0 (f-1) d, sip if 0 26ff DFSNZ f,d Decrement f, sip if not 0 (f-1) d, sip if not 0 c GOTO Unconditional branch (within 8) P(12:0) (12:8) PLATH(4:0), P(15:13) PLATH(7:5) 1eff INFSZ f,d Increment f, sip if zero (f+1) d, sip if 0 24ff INFSNZ f,d Increment f, sip if not zero (f+1) d, sip if not 0 b7 LALL Long all (within 64) (P+1) TOS; PL, (PLATH) PH 0005 RETFIE Return from interrupt, enable interrupt (PLATH) PH: PL 0 GLINTD b6 RETLW Return with literal in W W, TOS P, (PLATH unchanged) 0002 RETURN Return from subroutine TOS P (PLATH unchanged) 33ff TSTFSZ f Test f, sip if zero sip if f = 0 Table B.16: 16-Bit ore Special ontrol Instructions 0004 LRWT lear watchdog timer 0 WDT,0 WDT prescaler, 1 PD, 1 TO 0003 SLEEP Enter Sleep Mode Stop oscillator,power down, 0 WDT, 0 WDT Prescaler 1 PD, 1 TO DS33014G-page 188 1999 Microchip Technology Inc.

Quic Reference B.8 Key to Enhanced 16-Bit ore Instruction Set Field Description File Addresses f 8-bit file register address fs 12-bit source file register address fd 12-bit destination file register address dest W register if d = 0; file register if d = 1 r 0, 1, or 2 for FSR number Literals 8-bit literal value b 4-bit literal value c bits 8-11 of 12-bit literal value d bits 0-7 of 12-bit literal value Offsets, Addresses nn 8-bit relative offset (signed, 2 s complement) nd 11-bit relative offset (signed, 2 s complement) ml bits 0-7 of 20-bit program memory address mm bits 8-19 of 20-bit program memory address xx any 12-bit value Bits b bits 9-11; bit address d bit 9; 0=W destination; 1=f destination a bit 8; 0=common bloc; 1=BSR selects ban s bit 0 (bit 8 for ALL); 0=no update; 1(fast)=update/save W, STATUS, BSR APPENDIES 1999 Microchip Technology Inc. DS33014G-page 189

MPASM User s Guide with MPLINK and MPLIB B.9 Enhanced 16-Bit ore Instruction Set Microchip s new high-performance 8-bit microcontroller family uses a 16-bit wide instruction set. This instruction set consists of 76 instructions, each a single 16-bit wide word (2 bytes). Most instructions operate on a file register, f, and the woring register, W (accumulator). The result can be directed either to the file register or the W register or to both in the case of some instructions. A few instructions operate solely on a file register (BSF for example) Table B.17: Enhanced 16-Bit ore Literal Operations 0F ADDLW ADD literal to WREG W+ W 0B ANDLW AND literal with WREG W.AND. W 0004 LRWDT lear Watchdog Timer 0 WDT, 0 WDT postscaler, 1 TO,1 PD 0007 DAW Decimal Adjust WREG if W<3:0> >9 or D=1, W<3:0>+6 W<3:0>, else W<3:0> W<3:0>; if W<7:4> >9 or =1, W<7:4>+6 W<7:4>, else W<7:4> W<7:4>; 09 IORLW Inclusive OR literal with WREG EFc F0d LFSR r,d:c Load 12-bit Literal to FSR (second word) 01b MOVLB b Move literal to low nibble in BSR W.OR. W d:c FSRr b BSR 0E MOVLW Move literal to WREG W 0D MULLW Multiply literal with WREG W * PRODH:PRODL 08 SUBLW Subtract W from literal W W 0A XORLW Exclusive OR literal with WREG Table B.18: Enhanced 16-Bit ore Memory Operations W.XOR. W 0008 TBLRD * Table Read (no change to TBLPTR) Prog Mem (TBLPTR) TABLAT 0009 TBLRD *+ Table Read (post-increment TBLPTR) Prog Mem (TBLPTR) TABLAT TBLPTR +1 TBLPTR 000A TBLRD *- Table Read (post-decrement TBLPTR) Prog Mem (TBLPTR) TABLAT TBLPTR -1 TBLPTR 000B TBLRD +* Table Read (pre-increment TBLPTR) TBLPTR +1 TBLPTR Prog Mem (TBLPTR) TABLAT 000 TBLWT * Table Write (no change to TBLPTR) TABLAT Prog Mem(TBLPTR) 000D TBLWT *+ Table Write (post-increment TBLPTR) TABLAT Prog Mem(TBLPTR) TBLPTR +1 TBLPTR DS33014G-page 190 1999 Microchip Technology Inc.

Quic Reference Table B.18: Enhanced 16-Bit ore Memory Operations (ontinued) 000E TBLWT *- Table Write (post-decrement TBLPTR) TABLAT Prog Mem(TBLPTR) TBLPTR -1 TBLPTR 000F TBLWT +* Table Write (pre-increment TBLPTR) TBLPTR +1 TBLPTR TABLAT Prog Mem(TBLPTR) Table B.19: Enhanced 16-Bit ore ontrol Operations E2nn B nn Relative Branch if arry if =1, P+2+2*nn P, else P+2 P E6nn BN nn Relative Branch if Negative if N=1, P+2+2*nn P,else P+2 P E3nn BN nn Relative Branch if Not arry if =0, P+2+2*nn P, else P+2 P E7nn BNN nn Relative Branch if Not Negative E5nn BNOV nn Relative Branch if Not Overflow if N=0, P+2+2*nn P, else P+2 P if OV=0, P+2+2*nn P, else P+2 P E1nn BNZ nn Relative Branch if Not Zero if Z=0, P+2+2*nn P, else P+2 P E4nn BOV nn Relative Branch if Overflow if OV=1, P+2+2*nn P, else P+2 P E0nd BRA nd Unconditional relative branch P+2+2*nd P E0nn BZ nn Relative Branch if Zero if Z=1, P+2+2*nn P, else P+2 P Eml Fmm EFml Fmm ALL mm:ml,s Absolute Subroutine all (second word) GOTO mm:ml Absolute Branch (second word) P+4 TOS, mm:ml P<20:1>, if s=1, W WS, STATUS STATUSS, BSR BSRS mm:ml P<20:1> 0000 NOP No Operation No operation 0006 POP Pop Top of return stac TOS-1 TOS 0005 PUSH Push Top of return stac P +2 TOS D8nd RALL nd Relative Subroutine all P+2 TOS, P+2+2*nd P 00FF RESET Generate a Reset (same as MR reset) 0010 RETFIE s Return from interrupt (and enable interrupts) 0 RETLW Return from subroutine, literal in W same as MLR reset TOS P, 1 GIE/GIEH or PEIE/GIEL, if s=1, WS W, STATUSS STATUS, BSRS BSR, PLATU/PLATH unchngd. W, 0012 RETURN s Return from subroutine TOS P, if s=1, WS W, STATUSS STATUS, BSRS BSR, PLATU/PLATH are unchanged 0003 SLEEP Enter SLEEP Mode 0 WDT, 0 WDT postscaler, 1 TO, 0 PD APPENDIES 1999 Microchip Technology Inc. DS33014G-page 191

MPASM User s Guide with MPLINK and MPLIB Table B.20: Enhanced 16-Bit ore Bit Operations 9bf BF f,b,a Bit lear f 0 f<b> 8bf BSF f,b,a Bit Set f 1 f<b> Bbf BTFS f,b,a Bit test f, sip if clear if f<b>=0, P+4 P, else P+2 P Abf BTFSS f,b,a Bit test f, sip if set if f<b>=1, P+4 P, else P+2 P 7bf BTG f,b,a Bit Toggle f f<b> f<b> Table B.21: Enhanced 16-Bit ore File Register Operations 24f ADDWF f,d,a ADD WREG to f W+f dest 20f ADDWF f,d,a ADD WREG and arry bit to f W+f+ dest 14f ANDWF f,d,a AND WREG with f W.AND. f dest 6Af LRF f,a lear f 0 f 1f OMF f,d,a omplement f f dest 62f PFSEQ f,a ompare f with WREG, sip if f=wreg 64f PFSGT f,a ompare f with WREG, sip if f > WREG 60f PFSLT f,a ompare f with WREG, sip if f < WREG 04f DEF f,d,a Decrement f f 1 dest f W, if f=w, P+4 P else P+2 P f W, if f > W, P+4 P else P+2 P f W, if f < W, P+4 P else P+2 P 2f DEFSZ f,d,a Decrement f, sip if 0 f 1 dest, if dest=0, P+4 P else P+2 P 4f DFSNZ f,d,a Decrement f, sip if not 0 f 1 dest, if dest 0, P+4 P else P+2 P 28f INF f,d,a Increment f f+1 dest 3f INFSZ f,d,a Increment f, sip if 0 f+1 dest, if dest=0, P+4 P else P+2 P 48f INFSNZ f,d,a Increment f, sip if not 0 f+1 dest, if dest 0, P+4 P else P+2 P 10f IORWF f,d,a Inclusive OR WREG with f W.OR. f dest 50f MOVF f,d,a Move f f dest fs Ffd MOVFF fs,fd Move fs to fd (second word) fs fd 6Ef MOVWF f,a Move WREG to f W f 02f MULWF f,a Multiply WREG with f W * f PRODH:PRODL 6f NEGF f,a Negate f f +1 f 34f RLF f,d,a Rotate left f through arry DS33014G-page 192 1999 Microchip Technology Inc.

Quic Reference Table B.21: Enhanced 16-Bit ore File Register Operations (ontinued) 44f RLNF f,d,a Rotate left f (no carry) 30f RRF f,d,a Rotate right f through arry 40f RRNF f,d,a Rotate right f (no carry) 48f SETF f,a Set f 0xFF f 54f SUBFWB f,d,a Subtract f from WREG with Borrow W f dest 5f SUBWF f,d,a Subtract WREG from f f W dest 58f SUBWFB f,d,a Subtract WREG from f with Borrow f W dest 38f SWAPF f,d,a Swap nibbbles of f f<3:0> dest<7:4>, f<7:4> dest<3:0> 66f TSTFSZ f,a Test f, sip if 0 P+4 P, if f=0, else P+2 P 18f XORWF f,d,a Exclusive OR WREG with f W.XOR. f dest APPENDIES 1999 Microchip Technology Inc. DS33014G-page 193

MPASM User s Guide with MPLINK and MPLIB B.10 Hexadecimal to Decimal onversion Byte Byte Hex Dec Hex Dec Hex Dec Hex Dec 0 0 0 0 0 0 0 0 1 4096 1 256 1 16 1 1 2 8192 2 512 2 32 2 2 3 12288 3 768 3 48 3 3 4 16384 4 1024 4 64 4 4 5 20480 5 1280 5 80 5 5 6 24576 6 1536 6 96 6 6 7 28672 7 1792 7 112 7 7 8 32768 8 2048 8 128 8 8 9 36864 9 2304 9 144 9 9 A 40960 A 2560 A 160 A 10 B 45056 B 2816 B 176 B 11 49152 3072 192 12 D 53248 D 3328 D 208 D 13 E 57344 E 3584 E 224 E 14 F 61440 F 3840 F 240 F 15 Using This Table: For each Hex digit, find the associated decimal value. Add the numbers together. For example, Hex A38F converts to 41871 as follows: Hex 1000 s Digit Hex 100 s Digit Hex 10 s Digit Hex 1 s Digit 40960 + 768 + 128 + 15 = Result 41871 Decimal DS33014G-page 194 1999 Microchip Technology Inc.