blob: 08e72b336aabe161f87fa68c174f799236721eb4 (
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
|
//Example12.3 // to determine the binary output of the 8-bit dual slope A/D converter
clc;
clear;
close;
Vin = 8.5 ;
VR = 10 ;
f = 2 ; //MHz
N = 8 ;
C = 0.1*10^-6 ;
R = 2*10^3 ;
// the output of integrator is defined as
// Viao(T1) = -(Vin/R*C)*T1 ;
// charging time of capacitor
T1 = 2^N/f ;
disp('charging time of capacitor is = '+string(T1)+ ' u sec');
// the integrator output
T1 = T1*10^-6 ;
Viao =-(Vin/(R*C))*T1;
disp('the integrator output is = '+string(Viao)+ ' V');
// the binary output of a dual slope A/D converter
Bn = (2^N*Vin)/VR;
disp('the decimal output of a dual slope A/D converter is = '+string(Bn)+ ' = 218' );
Bn=218;
Bn = dec2bin(Bn) ;
disp(' The binary output of a dual slope A/D converter is = '+string(Bn)+ ' ' );
|