Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views9 pages

Fr. Conceicao Rodrigues College of Engineering (Frcrce) : Course, Subject & Experiment Details

The document outlines an experiment for the S.E. (ECs) course at Fr. Conceicao Rodrigues College of Engineering, focusing on interfacing temperature, ultrasonic, or optical sensors using an ADC with the 8051 microcontroller. It includes objectives, theory on ADCs, an algorithm for programming in assembly language, and post-lab questions related to ADC functionality. The experiment aims to design and simulate the system using KEIL Micro-Vision and Proteus VSM, emphasizing the importance of ADCs in converting analog signals to digital for processing.

Uploaded by

techolic13286
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views9 pages

Fr. Conceicao Rodrigues College of Engineering (Frcrce) : Course, Subject & Experiment Details

The document outlines an experiment for the S.E. (ECs) course at Fr. Conceicao Rodrigues College of Engineering, focusing on interfacing temperature, ultrasonic, or optical sensors using an ADC with the 8051 microcontroller. It includes objectives, theory on ADCs, an algorithm for programming in assembly language, and post-lab questions related to ADC functionality. The experiment aims to design and simulate the system using KEIL Micro-Vision and Proteus VSM, emphasizing the importance of ADCs in converting analog signals to digital for processing.

Uploaded by

techolic13286
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Fr.

CONCEICAO RODRIGUES COLLEGE OF ENGINEERING (FrCRCE)


MoJI DINCNER WyoCAN BUILA
THENAT10N
Denartment nf Flertronicsand Comnuter Srience (FCS)

Course, Subject & Experiment Details

2024- 2025
Academic year Estimated Time 02 Hours
Embedded systems
Course S.E.(ECs) Subject Name
Laboratory
Semester Chapter Title Sensor Interfacing
Experiment Type Coding Subject Code PCC12EC10

Aim & Obiective ofFxneriment

1.To write and execute an assembly language program to interface a


Temperature/Ultrasonic/O ptic al sensor using an ADC to the 8051 (Using
KEIL Micro-Vision)

2. To design the system (using Proteus VSM) and show simulation results.

Theory:

Analog to digital converters are among the most widely used devices for data acquisition.
Digital computers use binary (discrete) values but in the physical world, all param eters are
analog (continuous) in nature. Therefo re, we need an analogto digitalconverter to translate the
analog signals to digital to be processed by the microcontroller.

An ADC has n bit resolutio nwhere n can be 8,10, 12,16 or 24 bits. The higher resolution ADC
provides a smaller step size where step size is the smallest change that can be discerned by an
ADC. In addition to resolution, conversion time is another major factor in choosing an ADC.
Conversion tim e is defined as the time it takes for the ADC to convert from analog to dig ital.
ADC Chips can be serial or parallel. In parallel ADCs, multiple pins are used as output but in
serial ADC, We have only one pin for data out.

Note : ADC 0808/0 809 is a 8 bit ADC chip from National Sem iconductors. It is a 8 channel
ADC and each channel can be selected by using three select lines.

LM 35:The LM35 series are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM 35 thus has an
advantage over linear temperature sensors calibrated in Kelvin, as the user is not required to
subtract a large constant voltage from its output to obta in convenient Centigrade scaling.
The LM35 does not require any
external calibration or trimming to provide typical accuracies of +1/ 4°C at
room temperature and +3/ 4'C over a full - 55 to +150°C temperature
range. [Note add the re levant data for sensor used]

Fr. CONCEICAO RODRIGUES COLLEGE OF ENGINEERING (FrCRCE)


Department of Electronics and Computer Science (ECS)

Algorithm:

Finclude <reg51.h>
2 #include<string.h>
3
sbit RS = P2^5:
5 sbit RW = P2^6:
6 sbit EN - P2^7:
7 sbit ale=p2^3;
sbit oe-P2^4;
sbit start=P2^1:
10 sbit eoc-P2^O;
11 sbit clk=P2^2;
12 sbit addr c=P0^7# //Address pins for selecting input channels.
13 sbit addr b-P0^6:
14 sbit addr a=Po^5;
15
16 vOid delay (int t):
17 void lcd_ init (void)
18 vOid lcd command (char c):
10 void lcd data (char d):
20 void str (char a[] ):
21 void print (long float p) :
22
23 long float k;
24 unsigned long int a, I, X, Y, z:
25
26 void timer0 () interrupt 1 IL TIMER O interrupt ISR
27
20 clk-clk;

28 clk=clk:
29
30
31 void main () /I MAIN PROGRAM
32
33 lcd init () ; /I lcd initialization
349 Str ("! !welcome!!"):
35 lcd command (0x01) ; // clear display
36 Str ("Temp: "):
37 lcd_command (96) //custom character (°c) display
38 lcd data(0x10) :
3 lcd_data (0x07) :
40 lcd data(0x08) :
41 lcd_data (0x08) :
42 lcd data (0x08) :
43 lcd data (0x08) ;
44
lcd data(0x07) :
45 lcd_command (OxBb) ;
46 lcd data(4) :
47 eoc=l; I/ make eoc an input
48 ale=0;
49 oe=0;
50 start=0;
51 TMOD=0x02; / timer 0 in mode 2
52 THO=0xc2; // 15khz
53 IE=0x82: // set timer 0 interrupt
54 TRO=l; I/ start timer 0
55 while (1)
55 while (1)
56
57
58 addr _c=0; // select channel 0
59 addr b=0;
60 addr_a=0;
61 ale=l; // send high to low pulse on start and ale pin
62 start=l;
63 delay (1) :
64 ale=0:
65 start=0;
66 while (eoc==l): // wait for conversion
67 while (eoc==0) :
68 oe=l;
69 k=Pl;
70 lcd command (Ox85) :
71 print (k*2); / send the digital data to lcd
72 oe=0:
73
74
75
76
77 void str (char a[]) I lcd function to dísplay string
78
79
80 int j:
81 for (3=0;a[3]!=\0':3++)
82

76 L
77 void str (char al]) // 1cd function to display string
78
79
80 int j
81 tor (j-0;ati]!=*\o'j++)
82
83 lcd _data(a [3] ) :
84-}
85
86
87 void lcd init (void) /I lcd initialization
88
lcd command (Ox38): I/8 bit, 2 line, 5x8 dots
90 lcd command (0x01) ; /l clear display
9 lcd_command (0x0f) : // display on, cursor blinking
command (0x06) : //Entry mode
93 lcd command (Ox0c): Ilcursor off
lcd command (0xB0) ; /Iit torce cursor to beginning of first row
95
96
97 void lcd comnand (char c) / lcd command function
98
P3=c;
100 RS=0;
101 RW=0: / command register
102 EN=1:
103 delay (5) ;
103 delay(5)
104 EN=0;
105 delay (5)
106
107
108 void lcd data (char d) // lcd data function
109
110 P3=d;
11l RS=1: I/select data register
112 RW-0;
113 EN=1;
114 delay (2)
115 EN=0;
1l6 delay (2) :
117
118
119 void delay (int t) // delay function
120
121 int j:
122 for (j=0;j<t*1275;j++) ;
123
124
125 void print ( long float p) / number display function
126 t
127 xp*10;
128 if (x>=l000)
129
130

129 {
130
131 qx/1000;
132 Ft18:
133 y= (x$1000) /100;
134 y=y+48;
135
136 z=((x*1000) %100) /10;
137 z=z+48;
138 r=x$10;
139 r=r+48;
140 lcd data (q):
141 lcd data (y):
142 lcd data (z) :
143 lcd data(46) : /lascii value of point
144 lcd data(r) :
145
146
147
148 else
149 {
150
151 q=x/100;
152 qq+48;
153 y= (x*100) /10;
154 y=y+48:
155 z=x$10;
156 z=z+48;
138 r=x*10;
139 r*r+48:
140 lcd data (g) :
141 lcd data (y) :
142 lcd data(z) ;
143 lcd_data (46) ; Ilascii value of point
144 lcd _data(r):
145
146
147
148 else
149
150
151 qx/100;
152 qrg+48;
153 y= (x*100) /10 ;
154 y=y+48;
155 Z=X*10:
156 z=Z+48;
157 lcd data (q) :
158 lcd data (y):
159 lcd data(46) ; Ilascii value of point
l60 lcd data (z) :
161 r=0;
162 lcd data (r) :
163
164
l65 L)

U2

VOuT
R3

LoD1

PO OADH
PO.1AD

POADE lele.
U3 PO BGADE
RST PO 7AD
aox
START

IN FOC

ADO

VREF
VREF
OUTE

L
Post- Lab Questions
1. Explain the significance of the Vrefterm inal in the ADC 0808.

2. Explain the handshaking sequence with a neat tim ing dia gram.

3. Expla in the success ive approxim ation technique for A to D conversion.


COLLEGE OF ENGINEERING
FR. CONCEICAO RODRIGUES

Expuiment s
Pest &ab the
the Algnipicane of the Vue tisminal in
9! Explain
AD COS.O8
analo9 YQtage anqe thatwil
Vx deines the t h d i a i t o l o t p t
be mapped I0
c0nvett an an aloq i n p t (O to Vae£)
he ADC OSO8
ineo an 8-bit- digitaevale
|1gnipicance:

eeitien

gefiehce xatage Rnge Ngt- detaunines


NRIS the inýlt etaqe t h t
he m a i m m anoq
Ceeseepondu'o the highest di
qitoe eltput

seqence witn a neat


aEplain tne hands haking
Aming oiagaam C O d n ation mttnod betwien
Handuhokin ia o
eanvesion and eacLinq
tanhg ae dato le)atoutha adele
AlE ( ode7 latch Enab
aechanne Alectien
eonYeUin.
STAR I : Beging the conveseion is
Jncicate
£Oc(End a ConyLALarn)
CUmplte' eetput
OE(9tpLt Enable): Enables the oigitol
ines The sequene aefdhandihaking
' a s pins A,B,C
addeK te
adces
Plse ALE t9 lath the channel
Plie STAAT o begin Ato O cenvesesian
ajter eoc is high,ativate oe to ytad thu aigital datt
q3Eptinthu suctLSiVe approKimatran uhnique fou
A to Oconveien.
-cuccewive approimatian ttchnique (au Ato Dcanvsuian
hugh spud and acuusate convui an
tA SAR knd DAC woLe gether to pind thu clo42t digitol
N et the analoginput
Btarts with the MSe'and 8tlt to L,xemainina biti to 0
3 DAC (onvutt this tyi al digital codo ro an alog and
Cemparu it itwi th theinput
4-9} DAC itputs analoginput kup bit aueor
s- MevL tONt lowst bit and oepeat thupacH ttl
LSB i trattc

Advartages:
- tast ana piciant
Comnany heo in ADc0804 and athe modun ADCs.

You might also like