0% found this document useful (0 votes)
18 views5 pages

MBSD Task 9

This document describes a microprocessor-based system design task that involves using two microcontrollers to communicate over serial lines. The task requires sampling an input signal with a frequency of 50Hz using an ADC with a sampling rate of 500Hz, and transmitting the digital signal over serial lines to a second MCU with a DAC to reconstruct the analog output signal. Key aspects addressed include the sampling rate's effect on signal quality, reference voltages, input ranges, transmission limitations, and DAC speed capabilities. Code is provided for the two MCUs - one to sample and transmit and the other to receive and reconstruct the output signal.
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)
18 views5 pages

MBSD Task 9

This document describes a microprocessor-based system design task that involves using two microcontrollers to communicate over serial lines. The task requires sampling an input signal with a frequency of 50Hz using an ADC with a sampling rate of 500Hz, and transmitting the digital signal over serial lines to a second MCU with a DAC to reconstruct the analog output signal. Key aspects addressed include the sampling rate's effect on signal quality, reference voltages, input ranges, transmission limitations, and DAC speed capabilities. Code is provided for the two MCUs - one to sample and transmit and the other to receive and reconstruct the output signal.
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/ 5

MICROPROCESSOR BASED SYSTEM DESIGN

TASK 9

Spring 2022 CSE307 MBSD

Submitted by: M.Subhan Ghani


Registration No. : 19PWCSE1826 Class
Section: C

“On my honor, as student of University of Engineering and Technology, I have neither given nor
received unauthorized assistance on this academic work.”

Student Signature: ______________

Submitted to:
Dr. Bilal Habib

Department of Computer Systems Engineering


University of Engineering and Technology, Peshawar
Task:

In this project you are required to use two microcontrollers to communicate over serial lines as shown
below in figure 1.

• Input signal to ADC has a frequency (f_in) of 50Hz. How you supplied it.
Answer: I supplied this input frequency by editing the properties of sine generator.

• What happens if you decrease the sampling rate (fs) from 500HZ, 400HZ to 100HZ samples per
second? Answer: If we decrease the sampling rate from 500hz to 400hz and then to 100hz, the
output signal will be distorted as we are not taking enough samples to reform the original signal.
Output Signal :

• What reference voltage (V_ref) has been used for ADC?


Answer: I have used 1V reference voltage for ADC in this task. I did this by supplying 0.5V at the
Vref/2 Pin of the ADC.
• What is the relationship of V_ref to the amplitude of input signal.
Answer: The amplitude of input signal varies directly with the reference voltage. For example if
Vref = 3V then we can supply an input signal with an amplitude of 3V.

• What will be the step-size?


Answer: We know that Step-size = Vin/2n
So step-size = 1V/28 = 1V/256 = 3.90mV

• What is the input voltage range of ADC?


Answer: As my reference voltage is 1V so, the input voltage range of my ADC is 0V -1V.

• Can we increase the frequency of input signal (f_in) to 10KHz, if not then why?
Answer: No, we cannot increase the frequency of input signal to 10KHz because we will need a
sampling frequency of 1MHz for that, which is practically not possible to achieve.

• If transmission rate is increased to 19,200 bps. Is your design able to handle input frequency
(f_in) equal to 10KHz, without any loss of information? Assuming fs = = 10 x f_in.
Answer: No, my design will not be able to handle input frequency of 10KHz without any loss of
information even if we increase the transmission rate to 19200 bps.

• What is the limit of DAC, how fast it can work?


Answer: Number of DAC outputs = 2n = 28 = 256.
The setting time of DAC is 150 ns which is very fast.

Code:
MCU 1:

#include <reg51.h>
#include <stdio.h>

sbit RD_n = P3^4; //P3.4 is connected to the RD pin of ADC sbit


WR_n = P3^5; //P3.5 is connected to the WR pin of ADC sbit
INTR = P3^2; //P3.2 is connected to the INTR pin of ADC

void main(void)
{
P1 = 0xFF; //Set P1 as an input Port
INTR = 1; //Set P3.2 as an input pin
TMOD = 0x20; //Timer 1 mode 2
TH1 = 0xFD; //9600 bps
SCON = 0x40; //Mode 1 serial communication
PCON = 0x00; //SMOD = 0
TR1= 1; //Start timer 1

while (1)
{
RD_n = 1; //Set the RD pin to High
WR_n = 0;//WR = Low WR_n = 1;//Low-->High
while(INTR==1); //Wait for the ADC to Convert the given voltage
RD_n = 0; //Set the RD pin of ADC from HIGH to LOW
//The ADC sends the converted value to P1 SBUF = P1; //Send the
value at P1 to SBUF while(TI==0); //While the SBUF is not
transmitted, do nothing
TI = 0; //Reset the TI bit to 0
}
}

MCU 2:

#include <reg51.h>
#include <stdio.h>

void main(void)
{
P1 = 0x00; //Set P1 as an Output Port
TMOD = 0x20; //Timer 1 mode 2
TH1 = 0xFD; //9600 bps
SCON = 0x50; //Mode 1 serial communication with REN bit set to 1
PCON = 0x00; //SMOD = 0 TR1=
1; //Start timer 1 while
(1)
{
while(RI == 0); //While the value is not recieved, do nothing
RI = 0; //Reset the RI bit to 0
P1 = SBUF; //Send the value recieved at SBUF to P1
}
}
Output / Graphs / Plots / Results:
Schematic:

Oscilloscope Output:

You might also like