Mikroprotsessorid PIC16F876A KÄSUD. Instruction decode – mis teha tuleb Loe mälust Töötle andmeid Kirjuta mällu.

Slides:



Advertisements
Similar presentations
Instruction formats for the PIC series. ROM encoding Instructions are encoded in binary in ROM. The instructions are fixed format, each occupying 14 bits.
Advertisements

CS25410 Memory Machine Code. Common types of non-rotating memory (1) RAMRandom Access Memory In reality, read/write memory This is usually volatile, meaning.
Experiment 2 PIC Program Execution & Built-In Self-Test.
Negative Numbers Module M3.3 Section 2.4. Negative Numbers Subtract by adding ’s complement Ignore carry.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 27: PIC instruction set.
Microprocessor Systems Design I
Microcontroller Architecture— PIC18F Family
Rodolfo Rodriguez Kevin Zhang MJ Gellada
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
9/20/6Lecture 21 -PIC Architecture1 PIC Architecture Instruction Set.
9/20/6Lecture 21 -PIC Architecture1 PIC Architecture Programmers Model and Instruction Set.
ECE 447 Fall 2009 Lecture 5: TI MSP430 Software Development in C and Assembly pt. 2.
Building Assembler Programs Chapter Five Dr. Gheith Abandah1.
Directives, Memory, and Stack. Directives Special commands to the assembler May or may not generate machine code Categories by their function Programming.
Microprocessor and Interfacing PIC Code Execution
PIC18F Programming Model and Instruction Set
University Of Engineering And Technology Taxila REF::NATIONAL TAIWANOCEAN UNIVERSITY 國立台灣海洋大學 Chapter 3 JUMP, LOOP and CALL Instructions.
Embedded System Spring, 2011 Lecture 5: The PIC Microcontrollers Eng. Wazen M. Shbair.
PIC Processor Design CPE 428/528 April 29, 2002 Dr. Milenkovic Presented by: David Fatzer Le Pitts William Cruger Donn Hall.
Embedded System Spring, 2011 Lecture 11: Bank Switching Eng. Wazen M. Shbair.
ECE 448 – FPGA and ASIC Design with VHDL George Mason University Lab 1 Introduction to Aldec Active HDL Implementing Combinational Logic in VHDL.
Eng. Husam Alzaq The Islamic Uni. Of Gaza
Department of Electronic & Electrical Engineering Template program. Input / Output (IO) ● Template program. ● Introduction to IO ● Setting up for IO ●
Department of Electronic & Electrical Engineering Lecture 2 ● Introduction to IO ● Using a subroutine ● Driving a 7seg display.
PIC12F629/675. “Wide variety” 8-84 pin RISC core, 12/14/16bit program word USART/AUSART, I 2 C, ADC, ICSP, ICD OTP/UV EPROM/FLASH/ROM Families: PIC12,
Department of Electronic & Electrical Engineering Lecture 4. ➢ Loops ➢ Delays ➢ Conditional instructions ➢ Simple clock example.
Department of Electronic & Electrical Engineering Lecture 3. ● Template program. ● Introduction to IO ● PORTA PORTB TRISA TRISB ● Using a subroutine ●
Programming PIC 16F84A in Assembly. PIC16F84 pin-out and required external components.
I/O PORTS. General purpose I/O pins can be considered the simplest of peripherals. They allow the PICmicro™ to monitor and control other devices. To add.
Dr. Iyad Jafar Introducing the PIC 16 Series and the 16F84A.
1.  List all addressing modes of PIC18 uCs  Contrast and compare the addressing modes  Code PIC18 instructions to manipulate a lookup table.  Access.
“ INSTRUCTIONS SET OF AVR MICROCONTROLLER ” SIGMA INSTITUTE OF ENGINEERING Prepared By: SR.NO NAME OF STUDENT ENROLLMENT 1 Abhishek Lakhara
Microprocessor Systems Design I
Unit 1 Instruction set M.Brindha AP/EIE
Microprocessor Systems Design I
Microprocessor Systems Design I
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
C. K. PITHAWALA COLLEGE OF ENGINEERING AND TECHNOLOGY
Microprocessor Systems Design I
Lecture Set 5 The 8051 Instruction Set.
PIC 16F877.
16.317: Microprocessor System Design I
ECE,JYOTHI ENGG COLLEGE
Machine control instruction
Assembly Language Programming Part 2
Overview Introduction General Register Organization Stack Organization
EECE.3170 Microprocessor Systems Design I
Instruction Set.
Data Processing Instructions
The 8051 Assembly Language Arithmetic & Logic Instructions
به نام یگانه مهندس هستی معماری کامپیوتر مهدی قدیری
Introduction to Micro Controllers & Embedded System Design Instruction set Department of Electrical & Computer Engineering Missouri University of Science.
EECE.3170 Microprocessor Systems Design I
INSTRUCTION SET OF 8085.
EECE.3170 Microprocessor Systems Design I
Introduction to Micro Controllers & Embedded System Design Instruction set Department of Electrical & Computer Engineering Missouri University of Science.
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
By: A. H. Abdul Hafez Computer Architecture and Organization: L06: Stored program and Instruction code.
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
Md. Atiqur Rahman Ahad PIC18… Ch. 3.1 Md. Atiqur Rahman Ahad
Presentation transcript:

Mikroprotsessorid PIC16F876A KÄSUD

Instruction decode – mis teha tuleb Loe mälust Töötle andmeid Kirjuta mällu

1FFFh + 1 = 0000h Käske täidetakse järjest. Peale igat käsku tehakse PC = PC + 1 Erandid: GOTO ja CALL

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode

OPCODE OPCODE11-bitine aadress kkkkkkkkkkk OPCODE8-bitine Literal kkkkkkkk OPCODE3-bitine biti aadress bbb 7-bitine registri aadress fffffff OPCODEd=0: dest=W d=1: dest=f 7-bitine registri aadress fffffff PIC16F876A käskude struktuurAddress modes Käsud registriga Käsud bitiga Käsud konstandiga Absoluutne suunamine Käsud operandita

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> d Z dfffffff Decrement ff-1 --> d Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode OPCODEd=0: dest=W d=1: dest=f 7-bitine registri aadress fffffff f tähendab mõnda registrit sellest tabelist W tähendab Work registrit Kui dest=W, siis 1.võetakse registri f väärtus, 2.Tehakse sellega midagi 3.Tulemus pannakse W-sse 4.Register f ise ei muutu Kui dest=f, siis 1.võetakse registri f väärtus, 2.Tehakse sellega midagi 3.Tulemus pannakse f-sse tagasi 4.Register W ei muutu x3hSTATUSIRPRP1RP0_TO_PDZDCC Mälupanga number tuleb registrist STATUS

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> d Z dfffffff Decrement ff-1 --> d Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode OPCODEd=0: dest=W d=1: dest=f 7-bitine registri aadress fffffff Move Liida Lahuta Loogika Rotate Liida Lahuta + Tingimuslik suunamine

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> d Z dfffffff Decrement ff-1 --> d Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode OPCODE3-bitine biti aadress bbb 7-bitine registri aadress fffffff Biti seadmine Tingimuslik suunamine f tähendab mõnda registrit sellest tabelist bbb tähendab biti numbrit (0...7)

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> d Z dfffffff Decrement ff-1 --> d Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode OPCODE8-bitine Literal kkkkkkkk NB! Kõik Literali käsud on ainult registriga W Move Liida Lahuta Loogika Return

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> d Z dfffffff Decrement ff-1 --> d Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode OPCODE 11-bitine aadress kkkkkkkkkkk xAhPCLATHA12A11 Go Aadressi vanemad 2 bitti tulevad registrist PCLATH

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> d Z dfffffff Decrement ff-1 --> d Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby ModeSleep OPCODE

OPCODE OPCODE11-bitine aadress kkkkkkkkkkk OPCODE8-bitine Literal kkkkkkkk OPCODE3-bitine biti aadress bbb 7-bitine registri aadress fffffff OPCODEd=0: dest=W d=1: dest=f 7-bitine registri aadress fffffff PIC16F876A käskude struktuurAddress modes Käsud registriga Käsud bitiga Käsud konstandiga Absoluutne suunamine Käsud operandita

Port B Register = 0x55 Kirjuta Register Porti B Inverteeri Register Näide: Genereeri PortB abil impulsse

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode Register = 0x55 Kirjuta Register Porti B Inverteeri Register

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode AadressBinHex 0x55 -> W: Move Literal to W k->W11 00xx kkkk kkkk Register = 0x55 Kirjuta Register Porti B Inverteeri Register

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode AadressBinHex 0x55 -> W: Move W to f W->f fff ffff W -> 20h: A00001 Register = 0x55 Kirjuta Register Porti B Inverteeri Register

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode AadressBinHex 0x55 -> W: Move W to f W->f fff ffff W -> 20h: A00001 W -> PORTB: Register = 0x55 Kirjuta Register Porti B Inverteeri Register

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode AadressBinHex 0x55 -> W: W -> 20h: A00001 W -> PORTB: Invert 20h: A00003 Complement f dfff ffff Register = 0x55 Kirjuta Register Porti B Inverteeri Register d=0: dest=W d=1: dest=f

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode AadressBinHex 0x55 -> W: W -> 20h: A00001 W -> PORTB: Invert 20h: A00003 Move f to d dfff ffff 20h -> W: Register = 0x55 Kirjuta Register Porti B Inverteeri Register d=0: dest=W d=1: dest=f

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode AadressBinHex 0x55 -> W: W -> 20h: A00001 W -> PORTB: Invert 20h: A Go to address 10 1kkk kkkk kkkk 20h -> W: Go to 0002: Register = 0x55 Kirjuta Register Porti B Inverteeri Register

Move Literal to Wk --> W 1100xxkkkk Move W to fW --> f Z fffffff Move f to df --> d Z dfffffff Clear W0 --> W Z xxxxxxx Clear f0 --> f Z fffffff Swap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff Add Literal and WW+k --> WCDCZ 11111xkkkk Add W and fW+f --> dCDCZ dfffffff Subtract Literal from WW-k --> WCDCZ 11110xkkkk Subtract f from WW-f --> dCDCZ dfffffff Increment ff+1 --> f Z dfffffff Decrement ff-1 --> f Z dfffffff AND Literal with WW.AND. k --> W Z kkkk AND W with fW.AND. f --> d Z dfffffff OR Literal with WW.OR. k --> W Z kkkk OR W with fW.OR. f --> d Z dfffffff XOR Literal with WW.XOR. k --> W Z kkkk XOR W with fW.XOR. f --> d Z dfffffff Complement ff --> d Z dfffffff Rotate f Left through carry C dfffffff Rotate f Right through carry C dfffffff Bit Clear bit b of f0 --> f(b) 0100bbbfffffff Bit Set bit b of f1 --> f(b) 0101bbbfffffff Go to address 101kkkkkkk Call subroutine 100kkkkkkk Return from subroutine Return with Literal in W 1101xxkkkk Return from Interrupt Bit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff Bit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff Decrement f, Skip if 0f-1->d, skip next if Z= dfffffff INcrement f, Skip if 0f+1->d, skip next if Z= dfffffff No Operation xx00000 Clear Watchdog Timer Go into Standby Mode AadressBinHex 0x55 -> W: W -> 20h: A00001 W -> PORTB: Invert 20h: A h -> W: Go to 0002: Tehtud!Kas see programm töötab ka? x3hSTATUSIRPRP1RP0_TO_PDZDCC xAhPCLATHA12A11 Registrite adresseerimisel peab Banga number olema registris STATUS! GOTO 2 vanemat bitti peavad olema registris PCLATH!

MOVLWkMove Literal to Wk --> W 1100xxkkkk MOVWFfMove W to fW --> f Z fffffff MOVFf,dMove f to df --> d Z dfffffff CLRW Clear W0 --> W Z xxxxxxx CLRFfClear f0 --> f Z fffffff SWAPFf,dSwap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff ADDLWkAdd Literal and WW+k --> WCDCZ 11111xkkkk ADDWFf,dAdd W and fW+f --> dCDCZ dfffffff SUBLWkSubtract Literal from WW-k --> WCDCZ 11110xkkkk SUBWFf,dSubtract f from WW-f --> dCDCZ dfffffff INCFf,dIncrement ff+1 --> f Z dfffffff DECFf,dDecrement ff-1 --> f Z dfffffff ANDLWkAND Literal with WW.AND. k --> W Z kkkk ANDWFf,dAND W with fW.AND. f --> d Z dfffffff IORLWkOR Literal with WW.OR. k --> W Z kkkk IORWFf,dOR W with fW.OR. f --> d Z dfffffff XORLWkXOR Literal with WW.XOR. k --> W Z kkkk XORWFf,dXOR W with fW.XOR. f --> d Z dfffffff COMFf,dComplement ff --> d Z dfffffff RLFf,dRotate f Left through carry C dfffffff RRFf,dRotate f Right through carry C dfffffff BCFf,bBit Clear bit b of f0 --> f(b) 0100bbbfffffff BSFf,bBit Set bit b of f1 --> f(b) 0101bbbfffffff GOTOkGo to address 101kkkkkkk CALLkCall subroutine 100kkkkkkk RETURN Return from subroutine RETLWkReturn with Literal in W 1101xxkkkk RETFIE Return from Interrupt BTFSCf,bBit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff BTFSSf,bBit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff DECFSZf,dDecrement f, Skip if 0f-1->d, skip next if Z= dfffffff INCFSZf,dINcrement f, Skip if 0f+1->d, skip next if Z= dfffffff NOP No Operation xx00000 CLRWDT Clear Watchdog Timer SLEEP Go into Standby Mode

MOVLWkMove Literal to Wk --> W 1100xxkkkk MOVWFfMove W to fW --> f Z fffffff MOVFf,dMove f to df --> d Z dfffffff CLRW Clear W0 --> W Z xxxxxxx CLRFfClear f0 --> f Z fffffff SWAPFf,dSwap nibbles in ff(7:4)(3:0)->f(3:0)(7:4) dfffffff ADDLWkAdd Literal and WW+k --> WCDCZ 11111xkkkk ADDWFf,dAdd W and fW+f --> dCDCZ dfffffff SUBLWkSubtract Literal from WW-k --> WCDCZ 11110xkkkk SUBWFf,dSubtract f from WW-f --> dCDCZ dfffffff INCFf,dIncrement ff+1 --> f Z dfffffff DECFf,dDecrement ff-1 --> f Z dfffffff ANDLWkAND Literal with WW.AND. k --> W Z kkkk ANDWFf,dAND W with fW.AND. f --> d Z dfffffff IORLWkOR Literal with WW.OR. k --> W Z kkkk IORWFf,dOR W with fW.OR. f --> d Z dfffffff XORLWkXOR Literal with WW.XOR. k --> W Z kkkk XORWFf,dXOR W with fW.XOR. f --> d Z dfffffff COMFf,dComplement ff --> d Z dfffffff RLFf,dRotate f Left through carry C dfffffff RRFf,dRotate f Right through carry C dfffffff BCFf,bBit Clear bit b of f0 --> f(b) 0100bbbfffffff BSFf,bBit Set bit b of f1 --> f(b) 0101bbbfffffff GOTOkGo to address 101kkkkkkk CALLkCall subroutine 100kkkkkkk RETURN Return from subroutine RETLWkReturn with Literal in W 1101xxkkkk RETFIE Return from Interrupt BTFSCf,bBit Test f, Skip if Clearskip next if f(b)=0 0110bbbfffffff BTFSSf,bBit Test f, Skip if Setskip next if f(b)=1 0111bbbfffffff DECFSZf,dDecrement f, Skip if 0f-1->d, skip next if Z= dfffffff INCFSZf,dINcrement f, Skip if 0f+1->d, skip next if Z= dfffffff NOP No Operation xx00000 CLRWDT Clear Watchdog Timer SLEEP Go into Standby Mode Aadress 0x55 -> W:0000 W -> 20h:0001 W -> PORTB: 0002 Invert 20h: h -> W:0004 Go to 0002:0005 PROCESSOR 16F876A #include "P16F876A.INC" ORG0x00 MOVLW0x55 MOVWF0x20 Loop MOVWFPORTB COMF0x20,1 MOVF0x20,0 GOTOLoop End 1:PROCESSOR 16F876A 2: #include "P16F876A.INC“ 3: 4: ORG0x00 5: MOVLW 0x556: MOVLW0x A0 MOVWF 0x207: MOVWF0x20 8: Loop MOVWF 0x69: MOVWFPORTB A0 COMF 0x20, F10: COMF0x20, MOVF 0x20, W11: MOVF0x20, GOTO 0x212: GOTOLoop Hex A A