review-midterm - engineeringece.uprm.edu/~mtoledo/web/4206/s2019/review-midterm.pdfexam information...
TRANSCRIPT
INEL 4206Repaso Examen I
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
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 1
© 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)
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 1
© 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
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 1
Chapter 3: Architecture
© 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
© 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
© 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
© 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
© 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
© 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
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3
© 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
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3
MSP430 Assembly Language
https://www.ti.com/sc/docs/products/micro/msp430/userguid/as_5.pdf
https://www.ti.com/sc/docs/products/micro/msp430/userguid/as_5.pdf
© 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
© 2014 by M. Jiménez, R. Palomera, & I. Couvertier
INTRODUCTION TO EMBEDDED SYSTEMS: Using Microcontrollers and the MSP430 Chapter 3
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
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
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