blob: ed15265fb9d4487e97e7618d0f0de68303e80691 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
//Example11.11 // to find the resolution and analog output voltage of 8-bit D/A converter
clc;
clear;
close;
VFS = 10 ;
N = 8 ;
BI = 10101111 ; BI = 11100011 ; BI = 00101001 ; BI = 01000110
// the resolution of 8-bit D/A converter is defined as
Resolution = VFS/(2^N-1) ;
// An analog output voltage of D/A converter is given by
// Vo = Resolution*(2^-0*b0+2^-1*b1+....+2^-N*bn-1)
// Vo = Resolution*(2^-0*b0+2^-1*b1+2^-2*b2+2^-3*b3+2^-4*b4+2^-5*b5+2^-6*b6+2^-7*b7);
// For the BI 10101111 output analog voltage is
BI = '10101111';
BI = bin2dec(BI);
Vo = Resolution*BI ;
disp('For the BI 10101111 output analog voltage is = '+string(Vo)+ ' V ');
// For the BI 11100010 output analog voltage is
BI = '11100010';
BI = bin2dec(BI);
Vo = Resolution*BI ;
disp('For the BI 11100010 output analog voltage is = '+string(Vo)+ ' V ');
// For the BI 00101001 output analog voltage is
BI = '00101001';
BI = bin2dec(BI);
Vo = Resolution*BI ;
disp('For the BI 00101001 output analog voltage is = '+string(Vo)+ ' V ');
// For the BI 01000110 output analog voltage is
BI = '01000110';
BI = bin2dec(BI);
Vo = Resolution*BI ;
disp('For the BI 01000110 output analog voltage is = '+string(Vo)+ ' V ');
|