This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Name: ________________________ Box:________ ECE2801 EXAM #2 – A Term 2007 Show all work. Sign your test and all scrap paper. Circle final answer for each part of each question. Points are as indicated. Good Luck! 1) Fully answer the questions below. (25 pts) a) What is program counter (PC) and why is it important? b) A certain embedded system received data very infrequently from Port 1 Pin 5. The system programmer decides to use interrupts to service the input yet every time the Port 1 Pin 5 input is activated the system fails. Why? port1_ISR ; Interrupt service routine for Port 1 PUSH R5 CLR R5 MOV.B P1IN, R5 PUSH R4 MOV #0020h,R4 AND.B R4,R5 MOV.B R5, pin5 ; pin4 was declared as DS8 POP R4 ; restore R4 RETI c) Explain the operation of the instruction CALL #adder and its effect of the stack pointer (SP) and program counter (PC). d) Find 5 different errors (or at least examples of bad programming practice) in the code segment below badProc ; This procedure has some problems PUSH R4 PUSH R5 MOV A, R5 MOV &B, R4 CMP R5, R4 JZ exitError ; SUB R4, R5 DEC PC MOV SP, R7 ADD R7, #1000h POP R4 POP R5 RETI exitError ; main error handler . . . .....
View Full Document
- Fall '08
- SEPTA Regional Rail, Interrupt, Interrupt handler, MOV sideA,MPY MOV