Assignment2 - movlw h’2A’ movwf DATA addlw h’06’...

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

View Full Document Right Arrow Icon
EE331: Microprocessor, 2010-11, Term 1 Page 1 of 1 Assignment 2: 10 marks Q1. Given is an assembly code. Assume that the timer (TMR0) is running by the internal Q4 clock ( f osc /4) and the prescaler is OFF. At the end of the program execution: (a) What is the final content in w? (b) What is the final content in DATA? (c) What is content of TMR0? (d) How long will it take for the program to complete? Assume that the microprocessor is running by an external oscillator with a frequency of 8MHz. ( 4 m a r k s ) DATA equ h’20’ STATUS equ 3 DC equ 1 TMR0 equ 1 ;--------------------------------------- clrf w
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: movlw h’2A’ movwf DATA addlw h’06’ movwf TMR0 btfss STATUS, DC addlw -h’06’ incf DATA, f movlw h’30’ andwf DATA, w Q2. (a) Write an assembly program (using direct addressing) that reads a byte (X) from Port B and compares with the data (Y) stored in h’2A’. If X = Y, set RA0 high; If X > Y, replace Y with X in the same location; If X < Y, set RA1 high. Your code should include appropriate directives and initialization of the ports as needed at the beginning o f y o u r p r o g r a m . ( 4 m a r k s ) (b) Rewrite the program using indirect addressing. (2 marks)...
View Full Document

This note was uploaded on 01/20/2011 for the course EE 331 taught by Professor Wahid during the Fall '10 term at University of Saskatchewan- Management Area.

Ask a homework question - tutors are online