lecture22

lecture22 - FoundationsofEmbeddedSystems CTermSpring2010

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

View Full Document Right Arrow Icon
Foundations of Embedded Systems C Term Spring 2010 Reading for Today: User's Guide Ch 7 Reading for Next Class: MSP430 User's Guide Ch 2 HW#6 (on web) Due Next Thursday in class Lab #4 (on web): Report due Friday 3/5/2010 by 12 pm EXAM #3 – Friday 3/5/2010 Last Class:   More on conditional jumps >> Implementing procedures in assembly language and their effects on the stack Function CALLs and RET auto-magically affect Stack and PC CALL   dest    ; PUSH PC onto stack then sets PC =  dest   ; At the end of function, RET pops the PC from the top of    ; the stack. Execution resumes with next instruction MOV  R4, R6   What exactly is the Stack and how does it work? >> The Stack is temporary storage used in the course of program execution  Specifically during calls to Functions and Interrupts  >> The Stack is a Last In First Out (LIFO) data structure >> R1 = Stack Pointer (SP) holds the address of current Top of the Stack >> Words (16-bit words only) are placed on the stack using PUSH   src >> Words are recalled from the stack using POP   dest main MOV #0A00h, SP MOV #1234h, R7 PUSH R7 ; Memory location 0x210 is labeled FOO PUSH #FOO ... POP R10 ... POP R7
Background image of page 1

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

View Full DocumentRight Arrow Icon
Function Etiquette: >> One point of entry, one exit (RET statement!) --> DO NOT jump out of functions!  
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/04/2010 for the course ECE 2801 taught by Professor Jarvis during the Spring '08 term at WPI.

Page1 / 7

lecture22 - FoundationsofEmbeddedSystems CTermSpring2010

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

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