From 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 Mon Sep 17 00:00:00 2001 From: prashantsinalkar Date: Tue, 10 Oct 2017 12:27:19 +0530 Subject: initial commit / add all books --- 3554/CH17/EX17.4/Ex17_4.sce | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 3554/CH17/EX17.4/Ex17_4.sce (limited to '3554/CH17/EX17.4') diff --git a/3554/CH17/EX17.4/Ex17_4.sce b/3554/CH17/EX17.4/Ex17_4.sce new file mode 100644 index 000000000..db85b5236 --- /dev/null +++ b/3554/CH17/EX17.4/Ex17_4.sce @@ -0,0 +1,22 @@ +// Exa 17.4 + +clc; +clear all; + +// Given data +Vref=5;//Reference voltage(V) +R=5;// k Ohms + +// Solution + +disp("From fig. 17.18(c) , for a 4-bit D/A converter I=Vref/R* (D3+D2*2^-1+D1*2^-2+D0*^-3)"); +//16-input combinations are as follows +Ip={[0 0 0 0];[0 0 0 1];[0 0 1 0];[0 0 1 1];[0 1 0 0];[0 1 0 1];[0 1 1 0];[0 1 1 1];[1 0 0 0];[1 0 0 1]; +[1 0 1 0];[1 0 1 1];[1 1 0 0];[1 1 0 1];[1 1 1 0];[1 1 1 1]};//[D3 D2 D1 D0 bits] + +disp(" Input Bits Output Current(mA) percent Fraction of maximum "); +for i=1:16 +Iout(i)=Vref/R * (Ip(i,1)+Ip(i,2)*2^-1+Ip(i,3)*2^-2+Ip(i,4)*2^-3); + +printf(' %d %d %d %d %.3f %.3f \n',Ip(i,1),Ip(i,2),Ip(i,3),Ip(i,4),Iout(i),(Iout(i)/1.875)*100);//1.875(mA) is the highest output current +end -- cgit