summaryrefslogtreecommitdiff
path: root/3682/CH10/EX10.5/Ex10_5.sce
diff options
context:
space:
mode:
Diffstat (limited to '3682/CH10/EX10.5/Ex10_5.sce')
-rw-r--r--3682/CH10/EX10.5/Ex10_5.sce31
1 files changed, 31 insertions, 0 deletions
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)');