summaryrefslogtreecommitdiff
path: root/45/CH2
diff options
context:
space:
mode:
Diffstat (limited to '45/CH2')
-rwxr-xr-x45/CH2/EX2.1/2_1.jpgbin0 -> 27849 bytes
-rwxr-xr-x45/CH2/EX2.1/example_2_1.sce40
-rwxr-xr-x45/CH2/EX2.10/example_2_10.sce22
-rwxr-xr-x45/CH2/EX2.11/2_11.jpgbin0 -> 35004 bytes
-rwxr-xr-x45/CH2/EX2.11/example_2_11.sce99
-rwxr-xr-x45/CH2/EX2.12/example_2_12.sce23
-rwxr-xr-x45/CH2/EX2.13/example_2_13.sce24
-rwxr-xr-x45/CH2/EX2.14/2_14.jpgbin0 -> 36963 bytes
-rwxr-xr-x45/CH2/EX2.14/example_2_14.sce106
-rwxr-xr-x45/CH2/EX2.15/example_2_15.sce23
-rwxr-xr-x45/CH2/EX2.2/2_2.jpgbin0 -> 28070 bytes
-rwxr-xr-x45/CH2/EX2.2/example_2_2.sce40
-rwxr-xr-x45/CH2/EX2.3/example_2_3.sce17
-rwxr-xr-x45/CH2/EX2.4/example_2_4.sce16
-rwxr-xr-x45/CH2/EX2.9/example_2_9.sce24
15 files changed, 434 insertions, 0 deletions
diff --git a/45/CH2/EX2.1/2_1.jpg b/45/CH2/EX2.1/2_1.jpg
new file mode 100755
index 000000000..29b6388dd
--- /dev/null
+++ b/45/CH2/EX2.1/2_1.jpg
Binary files differ
diff --git a/45/CH2/EX2.1/example_2_1.sce b/45/CH2/EX2.1/example_2_1.sce
new file mode 100755
index 000000000..664675c3d
--- /dev/null
+++ b/45/CH2/EX2.1/example_2_1.sce
@@ -0,0 +1,40 @@
+//exmaple 2.1
+//7404
+clc
+close
+clear
+//frq= input('Enter the square wave frequency in KHz :');
+frq=1 ;// frequency in KHz
+t=(1/frq)*100;
+t=round(t)
+for r=1:t*10
+ inputc(r)=0;
+ outputc(r)=0;
+end
+p=1;
+while p<t*10 // making arrays to plot the curve
+ if p==1 | modulo(p,t)==0 then
+ for k=1:t/2
+ inputc(p+k)=0;
+ outputc(p+k)=1;
+ end
+ p=p+t/2;
+ else
+ inputc(p)=1;
+ outputc(p)=0;
+ p=p+1;
+ end
+end
+y=[3 3];
+subplot(2,1,1) //ploting the curves
+title('input at pin 1')
+xlabel('Time X 10^-5 seconds');
+ylabel('Magnitude')
+plot(inputc)
+plot(y)
+subplot(2,1,2)
+title('output at pin 2')
+xlabel('Time X 10^-5 seconds');
+ylabel('Magnitude')
+plot(outputc)
+plot(y) \ No newline at end of file
diff --git a/45/CH2/EX2.10/example_2_10.sce b/45/CH2/EX2.10/example_2_10.sce
new file mode 100755
index 000000000..a998a05a1
--- /dev/null
+++ b/45/CH2/EX2.10/example_2_10.sce
@@ -0,0 +1,22 @@
+// exmple 2.10
+clc
+clear
+a=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1];
+b=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
+c=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
+d=[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
+for i=1:16
+ x=bitor(a(i),b(i));
+ y=bitor(c(i),d(i));
+ r(i)=bitand(x,y);
+end
+disp('Truth table :');
+disp(' A B C D Y')
+for i = 1 : 16 //displaying truth table
+ Y(i,1)=a(i);
+ Y(i,2)=b(i);
+ Y(i,3)=c(i);
+ Y(i,4)=d(i);
+ Y(i,5)=r(i);
+ end
+disp(Y);
diff --git a/45/CH2/EX2.11/2_11.jpg b/45/CH2/EX2.11/2_11.jpg
new file mode 100755
index 000000000..911a8d20e
--- /dev/null
+++ b/45/CH2/EX2.11/2_11.jpg
Binary files differ
diff --git a/45/CH2/EX2.11/example_2_11.sce b/45/CH2/EX2.11/example_2_11.sce
new file mode 100755
index 000000000..cd85ad755
--- /dev/null
+++ b/45/CH2/EX2.11/example_2_11.sce
@@ -0,0 +1,99 @@
+// exmple 2.11
+clc
+clear
+close
+a=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1];
+b=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
+c=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
+d=[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
+for i=1:16
+ x=bitor(a(i),b(i));
+ y=bitor(c(i),d(i));
+ r(i)=bitand(x,y);
+end
+Y=r
+ap=1;
+bp=1;
+cp=1;
+dp=1;Yp=1;
+for i=1:16 //Making array to plot the timing diagram
+ if a(i)==1 then
+ for o=1:100
+ a1(ap)=1;
+ ap=ap+1;
+ end
+ else
+ for o=1:100
+ a1(ap)=0;
+ ap=ap+1;
+ end
+end
+if b(i)==1 then
+ for o=1:100
+ b1(bp)=1;
+ bp=bp+1;
+ end
+ else
+ for o=1:100
+ b1(bp)=0;
+ bp=bp+1;
+ end
+
+end
+if c(i)==1 then
+ for o=1:100
+ c1(cp)=1;
+ cp=cp+1;
+ end
+ else
+ for o=1:100
+ c1(cp)=0;
+ cp=cp+1;
+ end
+end
+if d(i)==1 then
+ for o=1:100
+ d1(dp)=1;
+ dp=dp+1;
+ end
+ else
+ for o=1:100
+ d1(dp)=0;
+ dp=dp+1;
+ end
+ end
+if Y(i)==1 then
+ for o=1:100
+ Y1(Yp)=1;
+ Yp=Yp+1;
+ end
+ else
+ for o=1:100
+ Y1(Yp)=0;
+ Yp=Yp+1;
+ end
+ end
+end
+z=[2 2];
+subplot(5,1,1); //plotting timing diagram
+title('Timing Diagrm');
+plot(z);
+plot(a1);
+ylabel('A');
+subplot(5,1,2);
+plot(z);
+ylabel('B');
+plot(b1);
+subplot(5,1,3);
+plot(z);
+ylabel('C');
+plot(c1);
+subplot(5,1,4);
+plot(z);
+ylabel('D');
+plot(d1);
+subplot(5,1,5);
+plot(z);
+ylabel('Y');
+xlabel('Time in milli seconds');
+plot(Y1); \ No newline at end of file
diff --git a/45/CH2/EX2.12/example_2_12.sce b/45/CH2/EX2.12/example_2_12.sce
new file mode 100755
index 000000000..276bbd6e2
--- /dev/null
+++ b/45/CH2/EX2.12/example_2_12.sce
@@ -0,0 +1,23 @@
+//Example 2.12
+clc
+clear
+a=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1];
+b=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
+c=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
+d=[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
+for i=1:16 // finding Y and y1 for all possible inpt cases
+ x=bitand(a(i),b(i));
+ y=bitand(c(i),d(i));
+ r(i)=bitor(x,y);
+ x1=bitcmp(x,1);
+ y1=bitcmp(y,1);
+ z=bitand(x1,y1);
+ r1(i)=bitcmp(z,1);
+end
+disp(' Y Y1');
+for i = 1 : 16 // displaying result
+ Y(i,1)=r(i);
+ Y(i,2)=r1(i);
+ end
+disp(Y);
+disp('Both are logically equivalent');
diff --git a/45/CH2/EX2.13/example_2_13.sce b/45/CH2/EX2.13/example_2_13.sce
new file mode 100755
index 000000000..518f63305
--- /dev/null
+++ b/45/CH2/EX2.13/example_2_13.sce
@@ -0,0 +1,24 @@
+// exmple 2.13
+//NAND - NAND
+clc
+clear
+close
+a=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1];
+b=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
+c=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
+d=[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
+for i=1:16
+ x=bitand(a(i),b(i));
+ y=bitand(c(i),d(i));
+ r(i)=bitor(x,y);
+end
+disp('Truth table :');
+disp(' A B C D Y')
+for i = 1 : 16 // displaying the truth table
+ Y(i,1)=a(i);
+ Y(i,2)=b(i);
+ Y(i,3)=c(i);
+ Y(i,4)=d(i);
+ Y(i,5)=r(i);
+end
+disp(Y); \ No newline at end of file
diff --git a/45/CH2/EX2.14/2_14.jpg b/45/CH2/EX2.14/2_14.jpg
new file mode 100755
index 000000000..4b22b1f6f
--- /dev/null
+++ b/45/CH2/EX2.14/2_14.jpg
Binary files differ
diff --git a/45/CH2/EX2.14/example_2_14.sce b/45/CH2/EX2.14/example_2_14.sce
new file mode 100755
index 000000000..e089acb69
--- /dev/null
+++ b/45/CH2/EX2.14/example_2_14.sce
@@ -0,0 +1,106 @@
+// exmple 2.14
+clc
+clear
+close
+a=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1];
+b=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
+c=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
+d=[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
+for i=1:16
+ x=bitand(a(i),b(i));
+ y=bitand(c(i),d(i));
+ r(i)=bitor(x,y);
+end
+Y=r
+ap=1;
+bp=1;
+cp=1;
+dp=1;Yp=1;
+for i=1:16 //Making arrays to plot the timing diagram
+ if a(i)==1 then
+ for o=1:100
+ a1(ap)=1;
+ ap=ap+1;
+ end
+ else
+ for o=1:100
+ a1(ap)=0;
+ ap=ap+1;
+ end
+
+end
+if b(i)==1 then
+ for o=1:100
+ b1(bp)=1;
+ bp=bp+1;
+ //z(bp)=3
+ end
+ else
+ for o=1:100
+ b1(bp)=0;
+ bp=bp+1;
+ //z(bp)=3
+ end
+
+end
+if c(i)==1 then
+ for o=1:100
+ c1(cp)=1;
+ cp=cp+1;
+ end
+ else
+ for o=1:100
+ c1(cp)=0;
+ cp=cp+1;
+ end
+
+end
+if d(i)==1 then
+ for o=1:100
+ d1(dp)=1;
+ dp=dp+1;
+ end
+ else
+ for o=1:100
+ d1(dp)=0;
+ dp=dp+1;
+ end
+
+ end
+if Y(i)==1 then
+ for o=1:100
+ Y1(Yp)=1;
+ Yp=Yp+1;
+ end
+ else
+ for o=1:100
+ Y1(Yp)=0;
+ Yp=Yp+1;
+ end
+
+ end
+
+end
+z=[2 2];
+subplot(5,1,1); //plotting timing diagram
+title('Timing Diagrm');
+plot(z);
+plot(a1);
+ylabel('A');
+subplot(5,1,2);
+plot(z);
+ylabel('B');
+plot(b1);
+subplot(5,1,3);
+plot(z);
+ylabel('C');
+plot(c1);
+subplot(5,1,4);
+plot(z);
+ylabel('D');
+plot(d1);
+subplot(5,1,5);
+plot(z);
+ylabel('Y');
+xlabel('Time in milli seconds');
+plot(Y1);
diff --git a/45/CH2/EX2.15/example_2_15.sce b/45/CH2/EX2.15/example_2_15.sce
new file mode 100755
index 000000000..2fd06a11c
--- /dev/null
+++ b/45/CH2/EX2.15/example_2_15.sce
@@ -0,0 +1,23 @@
+//example 2.15
+clc
+clear
+s=0; // s from the register
+s(1)=input('Enter the value at S0 :')
+s(2)=input('Enter the value at S1 :')
+s(3)=input('Enter the value at S2 :')
+s(4)=input('Enter the value at S3 :')
+s(5)=input('Enter the value at S4 :')
+s(6)=input('Enter the value at S5 :')
+s(7)=input('Enter the value at S6 :')
+s(8)=input('Enter the value at S7 :')
+count =0;
+for i =1 :8 //loop to detect a '1'
+ if s(i)==1 then
+ disp('ZERO is LOW');
+ break;
+ end
+ count =count+1;
+end
+if count==8 then
+ disp('ZERO is HIGH');
+end; \ No newline at end of file
diff --git a/45/CH2/EX2.2/2_2.jpg b/45/CH2/EX2.2/2_2.jpg
new file mode 100755
index 000000000..26f788c09
--- /dev/null
+++ b/45/CH2/EX2.2/2_2.jpg
Binary files differ
diff --git a/45/CH2/EX2.2/example_2_2.sce b/45/CH2/EX2.2/example_2_2.sce
new file mode 100755
index 000000000..e438dfc46
--- /dev/null
+++ b/45/CH2/EX2.2/example_2_2.sce
@@ -0,0 +1,40 @@
+//exmaple 2.2
+//7404
+clc
+close
+clear
+//frq= input('Enter the square wave frequency in KHz :');
+frq=0.5 ;//KHz
+t=(1/frq)*100;
+t=round(t)
+for r=1:t*10
+ inputc(r)=0;
+ outputc(r)=0;
+end
+p=1;
+while p<t*10 // making arrays t plot the curve
+ if p==1 | modulo(p,t)==0 then
+ for k=1:t/2
+ inputc(p+k)=0;
+ outputc(p+k)=1;
+ end
+ p=p+t/2;
+ else
+ inputc(p)=1;
+ outputc(p)=0;
+ p=p+1;
+ end
+end
+y=[3 3];
+subplot(2,1,1) //ploting the graphs
+title('input at pin 1')
+xlabel('Time X 10^-5 seconds');
+ylabel('Magnitude')
+plot(inputc)
+plot(y)
+subplot(2,1,2)
+title('output at pin 2')
+xlabel('Time X 10^-5 seconds');
+ylabel('Magnitude')
+plot(outputc)
+plot(y) \ No newline at end of file
diff --git a/45/CH2/EX2.3/example_2_3.sce b/45/CH2/EX2.3/example_2_3.sce
new file mode 100755
index 000000000..b98eb2309
--- /dev/null
+++ b/45/CH2/EX2.3/example_2_3.sce
@@ -0,0 +1,17 @@
+// exmple 2.3
+clc
+clear
+close
+a=[0 0 1 1];
+b=[0 1 0 1];
+for i=1:4
+ r(i)= bitor(bitcmp(a(i),1), bitcmp(b(i),1)) // given expression
+end
+disp(' A B Y')
+for i = 1 : 4
+ Y(i,1)=a(i);
+ Y(i,2)=b(i);
+ Y(i,3)=r(i);
+ end
+disp(Y); //displaying truth table
+disp('''1'' represents a HIGH(H) and ''0'' represents a LOW(L)') \ No newline at end of file
diff --git a/45/CH2/EX2.4/example_2_4.sce b/45/CH2/EX2.4/example_2_4.sce
new file mode 100755
index 000000000..1db20ba81
--- /dev/null
+++ b/45/CH2/EX2.4/example_2_4.sce
@@ -0,0 +1,16 @@
+// exmple 2.4
+clear
+clc
+a=[0 0 1 1];
+b=[0 1 0 1];
+for i=1:4
+ r(i)= bitand(bitcmp(a(i),1), bitcmp(b(i),1)) //given expression
+end
+disp(' A B Y')
+for i = 1 : 4
+ Y(i,1)=a(i);
+ Y(i,2)=b(i);
+ Y(i,3)=r(i);
+ end
+disp(Y); //displaying truth table
+disp('''1'' represents a HIGH(H) and ''0'' represents a LOW(L)') \ No newline at end of file
diff --git a/45/CH2/EX2.9/example_2_9.sce b/45/CH2/EX2.9/example_2_9.sce
new file mode 100755
index 000000000..eb481f16d
--- /dev/null
+++ b/45/CH2/EX2.9/example_2_9.sce
@@ -0,0 +1,24 @@
+//Example 2.9
+clc
+clear
+close
+a=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1];
+b=[0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1];
+c=[0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1];
+d=[0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
+for i=1:16 // finding Y for all 16 cases
+ x=bitor(a(i),b(i));
+ y=bitor(c(i),d(i));
+ r(i)=bitand(x,y);
+ x1=bitcmp(x,1);
+ y1=bitcmp(y,1);
+ z=bitor(x1,y1);
+ r1(i)=bitcmp(z,1);
+end
+disp(' Y Y1');
+for i = 1 : 16
+ Y(i,1)=r1(i);
+ Y(i,2)=r(i);
+ end
+disp(Y); //displaying result
+disp('Both are logically equivalent');