diff options
author | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:27:19 +0530 |
commit | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch) | |
tree | dbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /3682/CH10/EX10.5/Ex10_5.sce | |
parent | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff) | |
download | Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2 Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip |
initial commit / add all books
Diffstat (limited to '3682/CH10/EX10.5/Ex10_5.sce')
-rw-r--r-- | 3682/CH10/EX10.5/Ex10_5.sce | 31 |
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)');
|