week2 - Week 2 8051 Assembly Language Programming Chapter 2...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Week 2 8051 Assembly Language Programming Chapter 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Outline 2.1 Inside the 8051 2.2 Introduction to 8051 Assembly programming 2.3 Assembling and running an 8051 program 2.4 The program counter and ROM space in the 8051 2.5 8051 data types and directives 2.6 8051 flag bits and the PSW register 2.7 8051 register banks and stack
Background image of page 2
3 Inside the 8051 ± On-chip ROM to save your program ² Program is burned in ROM. ² Program is fixed and is not supposed to change. ± On-chip RAM to save some temporary data generated in execution time ² Data can be changed. ² Data is lost when the 8051 powers down. ± Register s to store information temporarily ² Some registers are used for internal operations of the 8051. ² Some registers are located in RAM. Some have their special locations.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 On-chip RAM
Background image of page 4
5 8051 Registers ± General Purpose Registers are used to store information temporarily. ± The 8051 has 8-bit registers and 16-bit registers. ² many 8-bit registers in Figure 2-1 (a) ² two 16-bit registers in Figure 2-1(b)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6 Main Registers R0 R4 R5 R2 R1 R3 R6 R7 B A Accumulator for all arithmetic and logic instructions Registers R0-R7 set of general- purpose registers Register B helps Register A for arithmetic/logical operations, ex: MUL, DIV
Background image of page 6
7 16 bit Registers ± DPTR: data pointer - the 16-bit address for the data located in program (ROM) or external data memory (RAM or ROM) ² DPL low byte of DPTR ² DPH high byte of DPTR ± PC program counter - the address of the next instruction
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
8 Special Function Registers SFR
Background image of page 8
9 Bit addressable Registers ± The 8051 uses 8-bit data type. ² Example: integer and character are 8 bits. ± Any data larger than 8-bits must be broken into 8-bit chunks before it is processed. ± Bit-addressable (ex: P0) vs. not bit- addressable (ex: DPH) D6 D5 D4 D3 D2 D1 D7 D0 most significant bit (MSB) least significant bit (LSB) Bit-addressable
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
10 Instruction Set Summary Table A-1: 8051 Instruction Set Summary 1. Data Transfer get or store data ± MOV, PUSH, POP 2. Arithmetic Operations ± ADD, SUB, INC, DEC, MUL, DIV 3. Logical Operations ± ANL, ORL, XRL, CLR 4. Program Branching jump, loop, call instruction ± LCALL, RET, LJMP, JZ, JNZ, NOP
Background image of page 10
11 MOV Instruction ± Copy the source operand to the destination operand. MOV destination, source copy MOV A,#55H ;load value 55H into reg. A ;now A=55H (H: hexadecimal ) MOV R6,#12 ;load 12 decimal into R6 ;now R6=12=0CH MOV R0,A ;copy contents of A into R0 ;now A=55H, R0=55H ² The pound sign ” # ” indicates that it is an immediate value. ² You can write your comm ent after the semicolon “ ; ”.
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
12 MOV - more ± Other examples MOV R5,#0F9H ;load F9H into R5 ;now R5=F9H ± A 0 is used between the # and F to indicate that F is a hex number and not a letter.
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 71

week2 - Week 2 8051 Assembly Language Programming Chapter 2...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online