0% found this document useful (0 votes)
31 views

Qauid-I-Azam University Islamabad: Chapter No # 9

1) This document contains the answers to assignment questions from Microcontroller Interfacing class for QAUID-I-AZAM UNIVERSITY ISLAMABAD. 2) The answers include programming code to set timer values, display output on ports, and calculate baud rate values for various clock speeds and baud rates. 3) Equations are provided to calculate the SPBRG register values needed to achieve standard baud rates like 9600, 19200, 38400 given a crystal frequency. Error rates are also calculated for different baud rate configurations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Qauid-I-Azam University Islamabad: Chapter No # 9

1) This document contains the answers to assignment questions from Microcontroller Interfacing class for QAUID-I-AZAM UNIVERSITY ISLAMABAD. 2) The answers include programming code to set timer values, display output on ports, and calculate baud rate values for various clock speeds and baud rates. 3) Equations are provided to calculate the SPBRG register values needed to achieve standard baud rates like 9600, 19200, 38400 given a crystal frequency. Error rates are also calculated for different baud rate configurations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

QAUID-I-AZAM UNIVERSITY ISLAMABAD

Assignment No # 02

Submitted to :- Mam TAYYBA


Name :- NASEEB_ULLAH
Reg No :- 04101613044
Subject :- Microcontroller Interfacing
Class :- BS 5th
Department :- ELECTRONICS

CHAPTER NO # 9
Question No#48
Ans:-
TMR3H=0xEC
TMR3L=0x78
Question No #49
Ans:-
TMR3H = 0xF9
TMR3L = 0xE5

Question No # 50
Ans:-Timer3 event counter, display PORTB, PORTD
continuously … OUTPUT
Question No#51
Ans:- The are same output Question 50 / 51 to convert
Assambly to C ,
OUTPUT

Question No #53
Ans:-

OUTPUT

Question No #54
Ans:- OUTPUT
CHAPTER No 10

Question No#36
Ans:- XTAL =10MHz, find SPBRG value …
first We have 10MHz/4 =2.5MHz
T = 2.5/16 = 156250
Now each is calculate by using X=(156250/Desired Band
Rate)- formula
(a) 156,250/9600 - 1 = 15 = F in hex
(b) 156,250/4800 - 1 = 32 = 20 in hex
(c) 156,250/1200 - 1 = 129 = 81 in hex

Question No# 37
Ans:-
XTAL =10 MHz
SPBRG = 15
Band Rate 9600

Question No#38
Ans:- The latter ‘’ Z ’’ Continuously at 1200 band rate ,
XTAL =10MHz
OUTPUT

Question No# 39
Ans:- The Message ‘’The earth is but one country and
mankind its citizens’’ Continuously at 57,600 band rate
,XTAL=10MHz
OUTPUT

Question No# 47
Ans:- XTAL=16Mhz , BRGH =0
First we have 16 MHz/4 = 4 MHz and 4 MHz/16 =
250,000.
Now the each is calculated by using X = (250,000/
Desired Baud Rate) –1
(a) 250,000/9600 - 1 = 26.04 - 1 = 25 = 19 in hex
(b) 250,000/19200 - 1 = 13.02 – 1 = 12 = 0C in hex
(c) 250,000/38400 - 1 = 6.51 – 1 = 5.5 = 5
(d) 250,000/57600 - 1 = 4.34 - 1 = 3.34 = 3

Question No#49
Ans:-XTAL =20MHz , BRGH =1
First we have 20 MHz/4 = 5 MHz and 5 MHz/16 =
312,500 Hz.
Now The each is calculated by using X = (312500 Hz/
Desired Baud Rate) –1
(a) 312500Hz/9600 - 1 = 32.55 - 1 = 31 = 1F in hex.
(b) 312500Hz/19200 - 1 = 16.27 – 1 = 15 = F in hex.
(c) 312500Hz/38400 - 1 = 8.13 – 1 = 7 .
(d) 312500Hz/57600 - 1 = 5.42 - 1 = 4 = 4

Question No#50
Ans:- XTAL = 20 , BRGH =1
First we have 20 MHz/4 = 5 MHz and 5 MHz/4 = 1.25
MHz.
Now the each is calculated by using X = (1.25MHz/
Desired Baud Rate) –1
(a) 1.25MHz/9600 - 1 = 130.2 - 1 = 129 = 81 in hex.
(b) 1.25MHz/19200 - 1 = 65.1 – 1 = 64 = 40 in hex
(c) 1.25MHz/38400 - 1 = 32.55 – 1 = 31 = 1F in hex.
(d) 1.25MHz/57600 - 1 = 21.7 - 1 = 22 - 1 = 21 = 15 in
hex.
Question No# 51
Ans:- band rate of error for Question 47
(a) 250,000/9600 -1 = 26.04 - 1 = 25.04 and error rate is
(25.04-25)/26 = 0.1 %
(b) 250,000/19200-1 = 13.02 – 1=12.02 and error rate is
(12.02 – 12)/13 = 0.1 %
(c) 250,000/38400 - 1 = 6.51 – 1 = 5.5 and error rate is
(5.5-5)/6 = 8%
(d) 250,000/57600 - 1 = 4.34 - 1 = 3.34 and error rate is
(3.34 – 3) / 4 = .8.5%

Question No#52
Ans:- Band rate error for Question 48,
(a) 1MHz/9600-1=104.16-1 = 103.16 and error rate is
(103.16 – 103)/104 =0.15%
(b) 1MHz/19200 - 1 = 52.08 – 1 = 51.08 and error rate is
(51.08- 51)/52 = 0.15%
(c) 1MHz/38400 -1 = 26.04 – 1 = 25.04 and error rate is
(25.04 – 25)/26 = 0.15%
(d) 1MHz/57600 - 1 = 17.36 - 1 = 16.36 and error rate is
(16.36- 16)/17 = 2%

Question No#53
Ans:- OUTPUT

Question No# 54
Ans:- OUTPUT

You might also like