review-midterm - engineeringece.uprm.edu/~mtoledo/web/4206/s2019/review-midterm.pdfexam information...

29
INEL 4206 Repaso Examen I

Upload: others

Post on 11-Jul-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

INEL 4206Repaso Examen I

Page 2: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

EXAM INFORMATION• Date & place: March 14, 2019 in S103A during class

• Chapter 1: Introduction to Embedded Systems

• Chapter 2: Number systems

• Chapter 3: Architecture

• Chapter 4: Assembly language programming

• Laboratory exercises 1, 2 and 3

Page 3: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 1

Page 4: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 1

Also see Choosing a MCU for your next design; 8 bit or 32 bit? (Atmel)

Page 5: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 1

Page 6: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 1

• Binary, hexadecimal, octal, fractions

• Conversion between bases and between bases and decimal

• Addition in binary and 2’s complement

• Binary Coded Decimal (BCD)

• Half-precision floating-point

• Basic terms (byte, word, nibble), ASCII, etc.

Chapter 2: Number Systems

Page 7: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 1

Chapter 3: Architecture

Page 8: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

MCUs are more application oriented than MPUs

Page 9: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

! Hardware Components! Arithmetic Logic Unit (ALU)

! Control Unit (CU)! FSM! Fetch, decode, execute

! Set of Registers! Bus Interface Logic (BIL)

! Software Components! Instruction Set! Addressing Modes

Page 10: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

! Fetch State: ! PC = address of instruction! instruction is read ! address -> address bus! instruction -> data bus! stored in the instruction register (IR).

! Decoding State: ! instruction meaning is deciphered. ! signals are sent to the appropriate CPU components to execute the actions specified by the instruction

! Execution State:! the actions specified by the instruction are carried out

! PC has been incremented to point to the address of the next instruction in memory.

Fig. 3.4 States in control unit operation: fetch, decode, and execute

Page 11: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

! Arithmetic operations (ADD, SUBTRACT, COMPLEMENT)

! Logic operations (AND, OR, NOT, XOR)! SHIFT and ROTATE

ALU

REGISTERS! General purpose (GPR)! Instruction register (IR) ! Program counter = instruction pointer! Stack pointer! Status register

Page 12: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

REGISTERS! R4-R15! General purpose

! R0 = PC ! = Program counter

! SP = Stack pointer! SR = Status register

Page 13: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

! Individual bits indicate ALU operation result satisfies a particular condition! Z = Zero bit or flag! C = Carry bit! N = Negative or Sign bit! V = Overflow bit! GIE = general interrupt flag ! indicates if interrupts are enabled

Page 14: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

Page 15: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

Page 16: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

Page 17: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

Page 18: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

! A = B = 1 (both chips are disabled) if any of A15,A14,A13,A12,A11,A10,A9’,A8 are 1

! So for A = B = 0 => A15=A14=A13=A12=A11=A10=A9’=A8=0 ! A = B = 0 if Y=0, A0=0 and W/B’=1 ! A=0, B=1 if Y=0, A0=1 and W/B’=0 ! A=1, B=0 if Y=0, A0=0 and W/B’=0

Page 19: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

Page 20: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

MSP430 Assembly Language

https://www.ti.com/sc/docs/products/micro/msp430/userguid/as_5.pdf

Page 21: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

https://www.ti.com/sc/docs/products/micro/msp430/userguid/as_5.pdf

Page 22: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction
Page 23: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction
Page 24: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

! Px.n = pin n of port x! Port operation is controlled by registers! Direction Register (PxDIR): in (0) or out (1) direction function for pin

! Input Register (PxIN) = input data ! Output Register (PxOUT) = data to write signal to output

! Function Select Register (PxSEL): Selects between I/O port or peripheral module function.! PxSEL.n = 0, pin Px.n operates as an I/O pin port;

! PxSEL.n = 1, as a module pin.

MSP430 Ports

Page 25: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

© 2014 by M. Jiménez, R. Palomera, & I. Couvertier

INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3

Page 26: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction
Page 27: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

bis.b #1,&P1DIR ; P1.0 as output

main: NOP ; main program xor.b #1,&P1OUT ; Toggle P1.0 ; Wait mov #50000,R15 ; Delay to R15 L1: dec R15 ; Decrement R15 jnz L1 ; Delay over ? jmp main ; Againnop

Laboratory 1

Page 28: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

SetupP1: bis.b #1,&P1DIR ; P1.0 as output

main: ; main program xor.b #1,&P1OUT ; Toggle P1.0 call #Wait jmp main ; Again

; ----------; Subroutine Wait; -----------Wait:

mov #50000,R15 ; Delay to R15L1: dec R15 ; Decrement R15 jnz L1 ; Delay over ?

ret

Laboratory 2

Page 29: review-midterm - Engineeringece.uprm.edu/~mtoledo/web/4206/S2019/review-midterm.pdfEXAM INFORMATION • Date & place: March 14, 2019 in S103A during class • Chapter 1: Introduction

bic.b #LOCKLPM5, PM5CTL0 ; Not needed for G2553

SetupP1:bic.b #00001000b, &P2DIR ; P2.3 as input

bis.b #1,&P1DIR ; P1.0 as output bis.b #00001000b, &P2REN ; select internal res bis.b #00001000b, &P2OUT ; make it pull-up

POLL:bit.b #00001000b, &P2IN ;poll 2.3jz POLL

; Service codexor.b #1,&P1OUT ; Toggle P1.0

jmp POLL ; Again

Laboratory 3