eee212_midterm2_2011_Summer_key - 13/07/2011 BILKENT...

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

View Full Document Right Arrow Icon
13/07/2011 BILKENT UNIVERSITY EEE212 Microprocessors Sections 1&2 Midterm 2 Open Textbook Closed Everything Else including Lecture Notes , No Calculators, No Cellular Phones USE THE BOXES ONLY FOR YOUR ANSWERS! Use comments for readability in your code ! Otherwise, the programs will be partially graded! Duration: 120 minutes Surname:______Key______________ Name:__________________________ Section:______________________ ID-Number:______________________ Signature:________________________ Q1 (35 points) Q2 (30 points) Q3 (35 points) TOTAL
Background image of page 1

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

View Full DocumentRight Arrow Icon
Q1) a) [20 pts] A square-wave generator is connected to Pin 5 of Port 3 (P3.5) of an 8051 microcontroller. You are asked to write a subroutine with the name COUNT that counts the number of pulses (i.e., falling edges) arriving at pin P3.5 observed within a period of 10 milliseconds after the call to that subroutine. As an outcome of the subroutine, the count will be placed as a binary number in registers: R6 for low byte, R7 for high byte. Assume we use DS89C430 with a XTAL frequency of 12 MHz and no more than 16 2 pulses can arrive in a period of ten milliseconds. Also write the configuration part of the main program below: ORG 0H CONFIG: MOV TMOD, #_ _51H_ ____________ ; complete here ONLY MOV R6,# 0 _______ MOV R7,# 0 _________ ; the main program’s job is ; not relevant COUNT EQU -10000 MOV TH0, #HIGH COUNT MOV TL0, #LOW COUNT ; 10000 * 1us = 10 ms MOV TH1, #00 MOV TL1, #00 SETB P3.5 SETB TR0 SETB TR1 COUNT: JNB TF0, COUNT ; write the subroutine here MOV A, TH1 MOV B, TL1 CJNE A, TH1, $ MOV R7, A MOV R6, B CLR TF0 CLR TR0 CLR TR1 END
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/23/2011 for the course ENGINEERIN 102 taught by Professor Pablo during the Spring '11 term at Bilkent University.

Page1 / 6

eee212_midterm2_2011_Summer_key - 13/07/2011 BILKENT...

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