Microprocessor Systems Design I

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

Prof. Jorge A. Ramón Introducción a Microcontroladores.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 26: PIC microcontroller intro.
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 30: PIC data memory.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 27: PIC instruction set.
Microprocessor Systems Design I
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2014 Lecture 4: x86 memory.
Rodolfo Rodriguez Kevin Zhang MJ Gellada
9/20/6Lecture 21 -PIC Architecture1 PIC Architecture Instruction Set.
Embedded System Spring, 2011 Lecture 10: Arithmetic, Logic Instruction and Programs Eng. Wazen M. Shbair.
PIC18F Programming Model and Instruction Set
Lecture – 4 PIC18 Family Instruction Set 1. Outline Literal instructions. Bit-oriented instructions. Byte-oriented instructions. Program control instructions.
PIC Processor Design CPE 428/528 April 29, 2002 Dr. Milenkovic Presented by: David Fatzer Le Pitts William Cruger Donn Hall.
PIC – ch. 2b. Move to GPR Move [copy] contents of WREG  GPR/RAM MOVLW99H;WREG=99H MOVWF0H ;move [copy] WREG contents to location 0h … -Cant move literal.
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
V 0.11 Extended Precision Operations To represent larger numbers, more bits are needed. N bits can represent the unsigned range 0 to 2 N -1. Bytes 1 Byte.
V 0.41 C Arithmetic operators OperatorDescription +, -addition (i+j), subtraction (i-j) *, /multiplication (i*j), division (i/j) ++, --increment (i++),
Embedded System Spring, 2011 Lecture 11: Bank Switching Eng. Wazen M. Shbair.
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,
1.  List all addressing modes of PIC18 uCs  Contrast and compare the addressing modes  Code PIC18 instructions to manipulate a lookup table.  Access.
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
Lecture – 5 Assembly Language Programming
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
Micro-processor vs. Micro-controller
Microprocessor Systems Design I
Microprocessor Systems Design I
C. K. PITHAWALA COLLEGE OF ENGINEERING AND TECHNOLOGY
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
PIC – ch. 2b Md. Atiqur Rahman Ahad.
PIC 16F877.
16.317: Microprocessor System Design I
Microprocessor Systems Design I
16.317: Microprocessor System Design I
PIC18 CH. 4.
EECE.3170 Microprocessor Systems Design I
Instruction Set.
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
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
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
ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
Presentation transcript:

16.317 Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2013 Lecture 25: PIC instruction set (cont.)

Microprocessors I: Lecture 25 Lecture outline Announcements/reminders Lab 2 due today Lab 3, HW 4 to be posted Today’s lecture: Review PIC ISA covered so far Continue with PIC instructions 7/18/2018 Microprocessors I: Lecture 25

Review: PIC instructions Four instruction formats Upper bits of all hold opcode Byte-oriented includes 1 bit destination, 7 bit direct address Bit-oriented includes 3 bit position (0-7), 7 bit direct address Literal/control includes 8 bit literal CALL/GOTO includes 11 bit literal Variable declarations cblock <start_address>: start of variable declarations All names between cblock/endc directives assigned to consecutive bytes starting at <start_address> 7/18/2018 Microprocessors I: Lecture 25

Review: PIC instructions (cont.) Clearing register: clrw/clrf Moving values: movlw/movwf/movf Swap nibbles: swapf Single bit manipulation: bsf/bcf 7/18/2018 Microprocessors I: Lecture 25

Increment/Decrement/ Complement 7/18/2018 Increment/Decrement/ Complement incf f, F(W) ; increment f, putting result in F or W decf f, F(W) ;decrement f, putting result in F or W comf f, F(W) ;complement f, putting result in F or W STATUS bits: Z Examples: incf TEMP1, F ;Increment TEMP1 incf TEMP1, W ;W <- TEMP1+1; TEMP1 unchanged decf TEMP1, F ;Decrement TEMP1 comf TEMP1, F ;Change 0s and 1s to 1s and 0s 7/18/2018 Microprocessors I: Lecture 25 Chapter 9

Addition/Subtraction 7/18/2018 Addition/Subtraction addlw k ;add literal value k into W addwf f, F(W) ;add w and f, putting result in F or W sublw k ;subtract W from literal value k, putting ;result in W subwf f, F(W) ;subtract W from f, putting result in F or W STATUS bits: C, DC, Z Examples: addlw 5 ; W <= 5+W addwf TEMP1, F ; TEMP1 <- TEMP1+W sublw 5 ; W <= 5-W (not W <= W-5 ) subwf TEMP1, F ; TEMP1 <= TEMP1 - W 7/18/2018 Microprocessors I: Lecture 25 Chapter 9

Microprocessors I: Lecture 25 Example Show the values of all changed registers after the following sequence cblock 0x20 varA varB varC endc clrf varA clrf varB clrf varC incf varA, W sublw 0x0F addwf varB, F decf varB, F comf varB, W subwf varC, F 7/18/2018 Microprocessors I: Lecture 25

Microprocessors I: Lecture 25 Example solution clrf varA  varA = 0 clrf varB  varB = 0 clrf varC  varC = 0 incf varA, W  W = varA + 1 = 1 sublw 0x0F  W = 0x0F – W = 0x0F – 1 = 0x0E addwf varB, F  varB = varB + W = 0x0E decf varB, F  varB = varB – 1 = 0x0D comf varB, W  W= ~varB = ~0x0D = 0xF2 subwf varC, F  varC = varC – W = 0x0E 7/18/2018 Microprocessors I: Lecture 25

Multi-bit Manipulation 7/18/2018 Multi-bit Manipulation andlw k ; AND literal value k into W andwf f, F(W) ; AND W with F, putting result in F or W iorlw k ; Inclusive-OR literal value k into W iorwf f, F(W) ; Inclusive-OR W with F, putting result in F or W xorlw k ; Exclusive-OR literal value k into W xorwf f, F(W) ; Exclusive-OR W with F, putting result in F or W Examples: andlw B’00000111’ ;force upper 5 bits of W to zero andwf TEMP1, F ;TEMP1 <- TEMP1 AND W andwf TEMP1, W ;W <- TEMP1 AND W iorlw B’00000111’ ;force lower 3 bits of W to one iorwf TEMP1, F ;TEMP1 <- TEMP1 OR W xorlw B’00000111’ ;complement lower 3 bits of W xorwf TEMP1, W ;W <- TEMP1 XOR W STATUS bits: Z 7/18/2018 Microprocessors I: Lecture 25 Chapter 9

Microprocessors I: Lecture 25 7/18/2018 Rotate rlf f, F(W) ; copy f into F or W; rotate F or W left through ; the carry bit rrf f, F(W) ; copy f into F or W; rotate F or W right through STATUS bits: C Examples: rlf TEMP1, F ; C <- TEMP1.bit(7), TEMP1.bit(i+1) <- TEMP1.bit(i) ; TEMP1.bit(0) <- C rrf TEMP1, W ; Copy TEMP1 to W and rotate W right through C ; TEMP1 unchanged 7/18/2018 Microprocessors I: Lecture 25 Chapter 9

Microprocessors I: Lecture 25 Example Show the values of all changed registers after the following sequence Assume the carry bit is initially 0 cblock 0x40 z endc clrf z movlw 0xF0 iorwf z, F xorlw 0xFF rrf z, F andwf z, W rlf z, F 7/18/2018 Microprocessors I: Lecture 25

Microprocessors I: Lecture 25 Example solution clrf z  z = 0 movlw 0xF0  W = 0xF0 iorwf z, F  z = z OR W = 0xF0 xorlw 0xFF  W = W XOR 0xFF = 0xF0 XOR 0xFF = 0x0F rrf z, F  Rotate z right thru carry Before rotate, (z, carry) = 1111 0000 02  z = 0111 10002 = 0x78, C = 0 andwf z, W  W = z AND W = 0x78 AND 0x0F = 0x08 rlf z, F  Rotate z left thru carry Before rotate, (z, carry) = 0 0111 10002  z = 1111 00002 = 0xF0, C = 0 7/18/2018 Microprocessors I: Lecture 25

Microprocessors I: Lecture 25 Final notes Next time Finish PIC ISA Reminders: Lab 2 due today Lab 3, HW 4 to be posted 7/18/2018 Microprocessors I: Lecture 25