Rcall 31 word by 21 bit memory 5 bit stack pointer

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Stack is used to store the address • Stack Pointer is used to access the stack. 40 Return Address Stack Return • The program counter is pushed to the top The of the return address stack when a call or call rcall instruction is executed. rcall • 31-word-by-21-bit memory • 5-bit stack pointer (STKPTR) pointing to 5-bit the top of stack (TOS) the 41 Return Address Stack Pointer (STKPTR) • STKPTR is 0 when powered up • STKPTR is 1 upon the first call or STKPTR call rcall instruction. rcall • Thus, the stack has 31 spaces for Thus, address storage. address • The TOS address is readable and The writable through three registers: TOSU, TOSH, TOSL. TOSH, 42 call instruction call • call k – Increment stack Increment pointer pointer – Address of next Address instruction TOS 43 return instruction return • return – PC = TOS – Decrement stack Decrement pointer. 44 rcall instruction rcall • rcall n – Increment stack pointer – PC+2 Top of Return Address Stack (TOS) Address – 11 bits are used to store 11 the relative address of the targeting instruction rcall can jump forward for a max. of 1023 instructions and backward for a max. of 1024 instructions. 1024 45 46 4.5 Addressing Modes in PIC18 4.5 47 Outline Outline • • • • Immediate addressing mode Direct addressing mode Register Indirect addressing mode Indexed-ROM addressing mode 48 Register Indirect Addressing Mode Register • Three registers known as file select Three registers (FSRx, where x = 0, 1, 2) store registers addresses of the data RAM location (i.e., pointers). pointers). • A FSR is a 12-bit register which is split into FSR two 8-bit registers, known as FSRxL and FSRxH. FSRxH. • To load...
View Full Document

Ask a homework question - tutors are online