diff options
Diffstat (limited to '45/CH10')
-rwxr-xr-x | 45/CH10/EX10.1/example_10_1.sce | 10 | ||||
-rwxr-xr-x | 45/CH10/EX10.10/example_10_10.sce | 4 | ||||
-rwxr-xr-x | 45/CH10/EX10.12/example_10_12.sce | 42 | ||||
-rwxr-xr-x | 45/CH10/EX10.13/example_10_13.sce | 28 | ||||
-rwxr-xr-x | 45/CH10/EX10.14/example_10_14.sce | 63 | ||||
-rwxr-xr-x | 45/CH10/EX10.15/example_10_15.sce | 18 | ||||
-rwxr-xr-x | 45/CH10/EX10.2/example_10_2.sce | 17 | ||||
-rwxr-xr-x | 45/CH10/EX10.3/10_3.jpg | bin | 0 -> 36428 bytes | |||
-rwxr-xr-x | 45/CH10/EX10.3/example_10_3.sce | 96 | ||||
-rwxr-xr-x | 45/CH10/EX10.5/example_10_5.sce | 4 | ||||
-rwxr-xr-x | 45/CH10/EX10.6/example_10_6.sce | 5 | ||||
-rwxr-xr-x | 45/CH10/EX10.7/example_10_7.sce | 16 | ||||
-rwxr-xr-x | 45/CH10/EX10.8/example_10_8.sce | 12 | ||||
-rwxr-xr-x | 45/CH10/EX10.9/10_9.jpg | bin | 0 -> 33176 bytes | |||
-rwxr-xr-x | 45/CH10/EX10.9/example_10_9.sce | 86 |
15 files changed, 401 insertions, 0 deletions
diff --git a/45/CH10/EX10.1/example_10_1.sce b/45/CH10/EX10.1/example_10_1.sce new file mode 100755 index 000000000..dcd7c8130 --- /dev/null +++ b/45/CH10/EX10.1/example_10_1.sce @@ -0,0 +1,10 @@ +//example 10.1 +clc; +clear; +//c= input('Enter the period of the waveform at C in micro seconds : '); +c=24;// given period of waveform +clk= c/8; +clkf = 1/(clk*10^-3); +printf('The clock period is %f micro seconds \n',clk);//displaying the results +printf('The clock frequenc must be %f KHz ', clkf); + diff --git a/45/CH10/EX10.10/example_10_10.sce b/45/CH10/EX10.10/example_10_10.sce new file mode 100755 index 000000000..1dde98ea0 --- /dev/null +++ b/45/CH10/EX10.10/example_10_10.sce @@ -0,0 +1,4 @@ +//example 10.10
+clc;
+clear;
+printf('The correct expresion is ""8"" = Qd Qc'' Qb Qa''');
\ No newline at end of file diff --git a/45/CH10/EX10.12/example_10_12.sce b/45/CH10/EX10.12/example_10_12.sce new file mode 100755 index 000000000..258fea5ba --- /dev/null +++ b/45/CH10/EX10.12/example_10_12.sce @@ -0,0 +1,42 @@ +//example 10.12
+clc
+clear
+//pro= ('Enter the value to whic counter should progress:');
+pro =11; // given input
+q=1;
+aa=pro;
+for i=1:4 //converting the given number in to binary
+ x=modulo(aa,2);
+ b(q)=x;
+ aa=aa/2;
+ aa=floor(aa);
+ q=q+1;
+end
+
+bi=' '; // then printing the NAND gate inputs
+for i=1:4
+ if i==1 & b(i)==1 then
+ bi=strcat([bi 'Qa']);
+ elseif i==1 & b(i)== 0 ;
+ bi=strcat([bi 'Qa''']);
+ end
+ if i==2 & b(i)==1 then
+ bi=strcat([bi 'Qb']);
+ elseif i==2 & b(i)== 0 ;
+ bi=strcat([bi 'Qb''']);
+ end
+ if i==3 & b(i)==1 then
+ bi=strcat([bi 'Qc']);
+ elseif i==3 & b(i)== 0 ;
+ bi=strcat([bi 'Qc''']);
+ end
+ if i==4 & b(i)==1 then
+ bi=strcat([bi 'Qd']);
+ elseif i==4 & b(i)== 0 ;
+ bi=strcat([bi 'Qd''']);
+ end
+
+end
+disp('The NAND gate inputs must be :');
+disp(bi)
+
diff --git a/45/CH10/EX10.13/example_10_13.sce b/45/CH10/EX10.13/example_10_13.sce new file mode 100755 index 000000000..6e5020d7d --- /dev/null +++ b/45/CH10/EX10.13/example_10_13.sce @@ -0,0 +1,28 @@ +//example 10.13
+clc;
+clear
+//pre=input("Enter the number where the counter is preset");
+pre = 1001; // given preset value
+q=1;
+b=0;
+f=0;
+a=pre;
+while(a>0) //converting to decimal
+ r=modulo(a,10);
+ b(1,q)=r;
+ a=a/10;
+ a=floor(a);
+ q=q+1;
+end
+for m=1:q-1
+ c=m-1
+ f = f + b(1,m)*(2^c);
+end
+disp("The counter will count down to 15 , Then preset back to %d, The resulting state diagram is shown below");
+for k=1:3
+for i=9:-1:0 // this will print the states
+printf('%d ',i);
+end;
+printf('15 ');
+
+end;
\ No newline at end of file diff --git a/45/CH10/EX10.14/example_10_14.sce b/45/CH10/EX10.14/example_10_14.sce new file mode 100755 index 000000000..4a5ecfc4e --- /dev/null +++ b/45/CH10/EX10.14/example_10_14.sce @@ -0,0 +1,63 @@ +//example 10.14
+//this program uses the following functions
+//kmap3.sci
+//noof.sci and noof0.sci
+//the above programs should be executed before executing these programs
+clc;
+n= [ 0 0 0;
+ 0 0 1;
+ 0 1 0;
+ 0 1 1;
+ 1 0 0;
+ 1 0 1;
+ 1 1 0;
+ 1 1 1];
+ for i= 1 : 5
+ n1(i,:)= n(i+1,:)
+ end
+ for i=6:8
+ n1(i,:)=[0 0 0]
+ end;
+ p=1;
+ for i= 1:3 //making the state table
+ for j = 1:8
+ if n(j,i)== 0
+ jf(j,p)= n1(j,i);
+ jf(j,p+1)= 2;
+ elseif n(j,i) == 1
+ jf(j,p)=2;
+ jf(j,p+1)=bitcmp(n1(j,i),1);
+ end
+ end
+ p=p+2
+end;
+disp('State tabel for mod 6 counter:'); //displaying the state table
+di= [n n1 jf];
+disp(' Cn Bn An Cn1 Bn1 An1 Jc Kc Jb Kb Ja Ka');
+disp(di);
+disp('Here ''2'' represents a don''t care condition');
+disp('These below Karnaugh maps give the design equations');
+
+jc=[0 0 1 0;2 2 2 2] //Krnaugh Maps for the design equations
+JC=kmap3(jc); //calling the 3-variable kmap
+printf('\n\nJC = %s \n',JC); //displaying the result
+
+kc=[2 2 2 2;0 1 1 1]
+KC=kmap3(kc);//calling the 3-variable kmap
+printf('\n\nKC = %s \n',KC); //displaying the result
+
+jb=[0 1 2 2;0 0 2 2]
+JB=kmap3(jb);//calling the 3-variable kmap
+printf('\n\nJB = %s \n',JB); //displaying the result
+
+kb=[2 2 1 0;2 2 1 1]
+KB=kmap3(kb);//calling the 3-variable kmap
+printf('\n\nKB = %s \n',KB); //displaying the result
+
+ja=[1 2 2 1;1 2 2 0]
+JA=kmap3(ja);//calling the 3-variable kmap
+printf('\n\nJA = %s \n',JA); //displaying the result
+
+ka=[2 1 1 2;2 1 1 2]
+KA=kmap3(ka);//calling the 3-variable kmap
+printf('\n\nKA = %s \n',KA); //displaying the result
diff --git a/45/CH10/EX10.15/example_10_15.sce b/45/CH10/EX10.15/example_10_15.sce new file mode 100755 index 000000000..3c69197bb --- /dev/null +++ b/45/CH10/EX10.15/example_10_15.sce @@ -0,0 +1,18 @@ +//example 10.15
+//this program use kmap2.sci
+//kmap2.sci should be executed before executing this program
+clc;
+a= [0 0 1 1]
+b= [0 1 0 1]
+y= [1 1 0 1]
+k= [1 1 ; 0 1]
+bi = kmap2(k); // calling 2-variable kmap
+disp(" A B Y");
+for i=1:3
+ Y(i,1) = a(i);
+ Y(i,2) = b(i);
+ Y(i,3) = y(i);
+end
+disp(Y);
+disp('The minimised expression from karnaugh map is');// displaying the result
+disp(bi);
\ No newline at end of file diff --git a/45/CH10/EX10.2/example_10_2.sce b/45/CH10/EX10.2/example_10_2.sce new file mode 100755 index 000000000..6994f5600 --- /dev/null +++ b/45/CH10/EX10.2/example_10_2.sce @@ -0,0 +1,17 @@ +//example 10.2
+clc;
+clc
+c=128; // given counters
+d=32;
+e=64;
+fc=log2(c);//making necessar calculations
+fd=log2(d);
+printf('A mod-128 conter should have %d flipflops\n', fc);
+printf(' A mod-32 conter should have %d flipflops\n', fd); //displaying the results
+fe=log2(e);
+n=2^fe - 1 ;
+printf(' The largest decimal no that can be stored in a mod-64 counter is %d',n);
+
+
+
+
diff --git a/45/CH10/EX10.3/10_3.jpg b/45/CH10/EX10.3/10_3.jpg Binary files differnew file mode 100755 index 000000000..efe9c9562 --- /dev/null +++ b/45/CH10/EX10.3/10_3.jpg diff --git a/45/CH10/EX10.3/example_10_3.sce b/45/CH10/EX10.3/example_10_3.sce new file mode 100755 index 000000000..c27633205 --- /dev/null +++ b/45/CH10/EX10.3/example_10_3.sce @@ -0,0 +1,96 @@ +clc;
+clear;
+close;
+t=320;
+p=1;
+while p<t*1 //making arrays for ploting
+ if p==1 | modulo(p,t)==0 then
+ for k=1:t/2
+ qd(p+k)=0;
+ end
+ p=p+t/2;
+ else
+ qd(p)=1;
+ p=p+1;
+ end
+end
+t=160;
+p=1;
+while p<t*2
+ if p==1 | modulo(p,t)==0 then
+ for k=1:t/2
+ qc(p+k)=0;
+ end
+ p=p+t/2;
+ else
+ qc(p)=1;
+ p=p+1;
+ end
+end
+t=80;
+p=1;
+while p<t*4
+ if p==1 | modulo(p,t)==0 then
+ for k=1:t/2
+ qb(p+k)=0;
+ end
+ p=p+t/2;
+ else
+ qb(p)=1;
+ p=p+1;
+ end
+end
+t=40;
+p=1;
+while p<t*8
+ if p==1 | modulo(p,t)==0 then
+ for k=1:t/2
+ qa(p+k)=0;
+ end
+ p=p+t/2;
+ else
+ qa(p)=1;
+ p=p+1;
+ end
+end
+t=20;
+p=1;
+while p<t*16
+ if p==1 | modulo(p,t)==0 then
+ for k=1:t/2
+ clk(p+k)=0;
+ end
+ p=p+t/2;
+ else
+ clk(p)=1;
+ p=p+1;
+ end
+end
+for i=320:350
+ clk(i)=0;
+ qa(i)=0;
+ qb(i)=0;
+ qc(i)=0;
+ qd(i)=0;
+end;
+y=[3 3]; //ploting the graphs
+subplot(5,1,1)
+title('Clock')
+plot(clk)
+plot(y)
+subplot(5,1,2)
+title('Qa')
+plot(qa)
+plot(y)
+subplot(5,1,3)
+title('Qb')
+plot(qb)
+plot(y)
+subplot(5,1,4)
+title('Qc')
+plot(qc)
+plot(y)
+subplot(5,1,5)
+title('Qd')
+plot(qd)
+plot(y)
\ No newline at end of file diff --git a/45/CH10/EX10.5/example_10_5.sce b/45/CH10/EX10.5/example_10_5.sce new file mode 100755 index 000000000..43a79cc5d --- /dev/null +++ b/45/CH10/EX10.5/example_10_5.sce @@ -0,0 +1,4 @@ +//example 10.5 +clc; +clear; +printf('The correct expression is : (count-up clock)''(Qa)(Qb)(Qc)');
\ No newline at end of file diff --git a/45/CH10/EX10.6/example_10_6.sce b/45/CH10/EX10.6/example_10_6.sce new file mode 100755 index 000000000..eaf9d8e75 --- /dev/null +++ b/45/CH10/EX10.6/example_10_6.sce @@ -0,0 +1,5 @@ +//example 10.6 + +clc; +clear; +printf('The correct logic expression is : (down-up)''(Qa)(Qb)(Qc)(enable)''');
\ No newline at end of file diff --git a/45/CH10/EX10.7/example_10_7.sce b/45/CH10/EX10.7/example_10_7.sce new file mode 100755 index 000000000..45edcce0f --- /dev/null +++ b/45/CH10/EX10.7/example_10_7.sce @@ -0,0 +1,16 @@ +//example 10.7 +clc; +clear; +mod = input("Enter the n value in your desired mod-n counter:");//taking the input +m=mod; +while 1 + n= log2(mod); //checking whether the given number is a power of 2 + k=modulo(n,1); + if k==0 then + printf('The number of flip flops used in mod-%d counter are:',m); // if yes the print th outpu. + printf('%d',n); + return; + end + mod =mod+1; + end + diff --git a/45/CH10/EX10.8/example_10_8.sce b/45/CH10/EX10.8/example_10_8.sce new file mode 100755 index 000000000..6da38fcd5 --- /dev/null +++ b/45/CH10/EX10.8/example_10_8.sce @@ -0,0 +1,12 @@ +//example 10.8 +clc; +clear; +//ff = input('Enter the no of flip-flops :'); +ff=4; //given input +k=2^ff; +if(k==2) then //output display + printf('With given flipflop we can only count 2, we can have a modulus 2 counter'); + else +printf('With given number of flip-flops the counter will have a natural count of %d\n',k); +printf('We can thus construct any counter that has a modulus between %d and 2',k ) +end;
\ No newline at end of file diff --git a/45/CH10/EX10.9/10_9.jpg b/45/CH10/EX10.9/10_9.jpg Binary files differnew file mode 100755 index 000000000..6f3c02999 --- /dev/null +++ b/45/CH10/EX10.9/10_9.jpg diff --git a/45/CH10/EX10.9/example_10_9.sce b/45/CH10/EX10.9/example_10_9.sce new file mode 100755 index 000000000..d59245d48 --- /dev/null +++ b/45/CH10/EX10.9/example_10_9.sce @@ -0,0 +1,86 @@ +//example 10.9
+
+clc;
+clear;
+close;
+c = [0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0]; //taking the values for a mod -6 counter
+q = [0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0];
+a = [0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0];
+b = [0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0];
+y1=q;
+y2=a;
+y3=b;
+y11p=1;
+y22p=1;
+y33p=1;
+y44p=1;
+cp=1;
+yf1p=1;
+for i=1:25 // making arrays to draw the output
+ if y1(i)==1 then
+ for o=1:100
+ y11(y11p)=1;
+ y11p=y11p+1;
+ end
+ else
+ for o=1:100
+ y11(y11p)=0;
+ y11p=y11p+1;
+ end
+
+end
+if y2(i)==1 then
+ for o=1:100
+ y21(y22p)=1;
+ y22p=y22p+1;
+ end
+ else
+ for o=1:100
+ y21(y22p)=0;
+ y22p=y22p+1;
+ end
+
+end
+if y3(i)==1 then
+ for o=1:100
+ y31(y33p)=1;
+ y33p=y33p+1;
+ end
+ else
+ for o=1:100
+ y31(y33p)=0;
+ y33p=y33p+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
+
+end
+z=[2 2];
+subplot(4,1,1); //ploting the out put
+title('Timing Diagram');
+plot(c1);
+plot(z);
+ylabel('C');
+subplot(4,1,2);
+plot(y11);
+ylabel('Q');
+plot(z);
+subplot(4,1,3);
+plot(y21);
+ylabel('A');
+plot(z);
+subplot(4,1,4);
+plot(z);
+ylabel('B');
+plot(y31);
|