summaryrefslogtreecommitdiff
path: root/3682/CH10
diff options
context:
space:
mode:
Diffstat (limited to '3682/CH10')
-rw-r--r--3682/CH10/EX10.1/Ex10_1.sce22
-rw-r--r--3682/CH10/EX10.2/Ex10_2.sce22
-rw-r--r--3682/CH10/EX10.3/Ex10_3.sce21
-rw-r--r--3682/CH10/EX10.4/Ex10_4.sce24
-rw-r--r--3682/CH10/EX10.5/Ex10_5.sce31
5 files changed, 120 insertions, 0 deletions
diff --git a/3682/CH10/EX10.1/Ex10_1.sce b/3682/CH10/EX10.1/Ex10_1.sce
new file mode 100644
index 000000000..ed3ffa07b
--- /dev/null
+++ b/3682/CH10/EX10.1/Ex10_1.sce
@@ -0,0 +1,22 @@
+// Exa 10.1
+
+clc;
+clear;
+
+// Given data
+
+//9-bit DAC
+step = 10.3; // mV
+y=[1 0 1 1 0 1 1 1 1];
+n = 9; // since 9 bit DAC
+
+// Solution
+
+i = n;
+add = 0;
+while(i>0)
+ op = step*2^(i-1)*y((n+1)-i);
+ i = i-1;
+ add = add + op
+ end
+printf('The output voltage for input 101101111 is %.2f V. \n',add*10^-3);
diff --git a/3682/CH10/EX10.2/Ex10_2.sce b/3682/CH10/EX10.2/Ex10_2.sce
new file mode 100644
index 000000000..da352492e
--- /dev/null
+++ b/3682/CH10/EX10.2/Ex10_2.sce
@@ -0,0 +1,22 @@
+// Exa 10.2
+
+clc;
+clear;
+
+// Given data
+
+// 8 bit DAC
+n = 8;
+Vmin = 0; // Volts
+Vmax = 10; // Volts
+
+// Solution
+
+printf(' For a 8-bit DAC :-\n\n');
+LSB = 1/2^n;
+LSB10 = LSB*Vmax;
+printf(' LSB = %.3f V (i.e. 1/256).\n',LSB10);
+MSB10 = (1/2)*Vmax;
+printf(' MSB = %d V.\n',MSB10);
+fso = (Vmax-LSB10);
+printf(' Full scale output = %.3f V. \n',fso);
diff --git a/3682/CH10/EX10.3/Ex10_3.sce b/3682/CH10/EX10.3/Ex10_3.sce
new file mode 100644
index 000000000..deb002d49
--- /dev/null
+++ b/3682/CH10/EX10.3/Ex10_3.sce
@@ -0,0 +1,21 @@
+// Exa 10.3
+
+clc;
+clear;
+
+// Given data
+
+// D/A converter is used
+Vmin = 0; // Voltage
+Vmax = 10; // Voltage
+ip1 = [1 0]; // for a 2-bit D/A converter(input 1)
+ip2 = [0 1 1 0]; // for a 4-bit DAC(input 2)
+ip3 = [1 0 1 1 1 1 0 0 ]; // foe a 8-bit DAC(input 3)
+
+// Solution
+V01 = Vmax*(ip1(1)*2^(-1)+ip1(2)*2^(-2)); // output 1
+printf(' The output voltage for input1 = [10] is %d V. \n ',V01);
+V02 = Vmax*(ip2(1)*2^(-1)+ip2(2)*2^(-2)+ip2(3)*2^(-3)+ip2(4)*2^(-4)); // Output 2
+printf(' The output voltage for input2 = [0110] is %.2f V. \n ',V02);
+V03 = Vmax*(ip3(1)*2^(-1)+ip3(2)*2^(-2)+ip3(3)*2^(-3)+ip3(4)*2^(-4)+ip3(5)*2^(-5)+ip3(6)*2^(-6)+ip3(7)*2^(-7)+ip3(8)*2^(-8)); // Output 3
+printf(' The output voltage for input3 = [10111100] is %.2f V. \n',V03);
diff --git a/3682/CH10/EX10.4/Ex10_4.sce b/3682/CH10/EX10.4/Ex10_4.sce
new file mode 100644
index 000000000..2d8f56861
--- /dev/null
+++ b/3682/CH10/EX10.4/Ex10_4.sce
@@ -0,0 +1,24 @@
+// Exa 10.4
+
+clc;
+clear;
+
+// Given data
+
+// A 16 bit dual slope ADC is specified
+n = 16; // 16 bit counter
+CR = 4*10^6; // clock rate in Hz
+Vimax = 10; // Maximum input voltage
+Vomax= -8; // Maximum integrator output voltage
+C = 0.1*10^-6; // Capacitor(Farads)
+
+// Solution
+
+//Referring Eqn 10.4, 10.5, 10.6, 10.7 given on page no 364 and 365;
+
+T1 = 2^n/CR; // Time Period
+// For the integrator
+// dell Vo= (-1/RC)*Vmax*T1;
+// Therefore
+R = -(Vimax*T1)/(Vomax*C); // Resistor value
+printf('The value of resistor R of the integrator is %d kΩ. \n ',round(R/1000));
diff --git a/3682/CH10/EX10.5/Ex10_5.sce b/3682/CH10/EX10.5/Ex10_5.sce
new file mode 100644
index 000000000..13f5389b9
--- /dev/null
+++ b/3682/CH10/EX10.5/Ex10_5.sce
@@ -0,0 +1,31 @@
+// Exa 10.5
+
+clc;
+clear;
+
+// Given data
+
+// A 16bit dual slope ADC is specified
+Va = 4.129; // Input analog Voltage
+Vr= 8; // Maximum integrator output voltage(Reference Voltage)
+n=16; // 16 bit counter
+
+// Solution
+
+disp("Referring to Eqn 10.7 on page no. 365 we get,")
+// Va = Vr*(N/2^n);
+N = round(Va * 2^n / Vr); // Digital count
+printf(' The digital count N = %d for which the binary equivalent = \n',N);
+
+// code to convert decimal to binary weuivalent
+Nbin = [0000000000000000];
+while (N > 0 & n > 0)
+ if (modulo(N,2)== 0)
+ Nbin(n)=0;
+ else
+ Nbin(n)=1;
+end
+n=n-1;
+N=int(N/2);
+end
+disp((Nbin)');