blob: e3d889d409b5e0d1f5f4d055509be9610d2c14fb (
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
|
//Example11.2 // determine the output voltage of D/A converter for the binary inputs a) 10101010 b) 11001100 c) 11101110 d) 00010001
clc;
clear;
close;
del = 12*10^-3 ; // mA
// the input voltage of D/A converter
//Vo = del*binary input (BI)
// For BI 10101010 the output
BI = '10101010' ;
BI = bin2dec(BI);
Vo = del*BI ;
disp('For BI 10101010 the output of D/A converter is = ' +string(Vo)+ ' V ');
// For BI 11001100 the output
BI = '11001100' ;
BI = bin2dec(BI);
Vo = del*BI ;
disp('For BI 11001100 the output of D/A converter is = ' +string(Vo)+ ' V ');
// For BI 11101110 the output
BI = '11101110' ;
BI = bin2dec(BI);
Vo = del*BI ;
disp('For BI 11101110 the output of D/A converter is = ' +string(Vo)+ ' V ');
// For BI 00010001 the output
BI = '00010001' ;
BI = bin2dec(BI);
Vo = del*BI ;
disp('For BI 00010001 the output of D/A converter is = ' +string(Vo)+ ' V ');
|