summaryrefslogtreecommitdiff
path: root/2522/CH6
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /2522/CH6
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '2522/CH6')
-rwxr-xr-x2522/CH6/EX6.1/exm6_1.sce7
-rwxr-xr-x2522/CH6/EX6.1/exm6_1_output.jpgbin0 -> 6961 bytes
-rwxr-xr-x2522/CH6/EX6.2/exm6_2.sce11
-rwxr-xr-x2522/CH6/EX6.2/exm6_2_output.jpgbin0 -> 17482 bytes
-rwxr-xr-x2522/CH6/EX6.3/exm6_3.sce21
-rwxr-xr-x2522/CH6/EX6.3/exm6_3_output.jpgbin0 -> 8952 bytes
-rwxr-xr-x2522/CH6/EX6.4/exm6_4.sce17
-rwxr-xr-x2522/CH6/EX6.4/exm6_4_output.jpgbin0 -> 7477 bytes
-rwxr-xr-x2522/CH6/EX6.5/exm6_5.sce29
-rwxr-xr-x2522/CH6/EX6.5/exm6_5_output.jpgbin0 -> 8371 bytes
-rwxr-xr-x2522/CH6/EX6.6/exm6_6.sce31
-rwxr-xr-x2522/CH6/EX6.6/exm6_6_output.jpgbin0 -> 11593 bytes
-rwxr-xr-x2522/CH6/EX6.7/exm6_7.sce39
-rwxr-xr-x2522/CH6/EX6.7/exm6_7_output.jpgbin0 -> 22315 bytes
-rwxr-xr-x2522/CH6/EX6.8/exm6_8.sce11
-rwxr-xr-x2522/CH6/EX6.8/exm6_8_output.jpgbin0 -> 13716 bytes
-rwxr-xr-x2522/CH6/EX6.9/exm6_9.sce11
-rwxr-xr-x2522/CH6/EX6.9/exm6_9_output.jpgbin0 -> 14178 bytes
18 files changed, 177 insertions, 0 deletions
diff --git a/2522/CH6/EX6.1/exm6_1.sce b/2522/CH6/EX6.1/exm6_1.sce
new file mode 100755
index 000000000..e0ba67ec4
--- /dev/null
+++ b/2522/CH6/EX6.1/exm6_1.sce
@@ -0,0 +1,7 @@
+//page no 164
+//example no 6.1
+//LOAD A DATA TO ONE REGISTER AND MOVE IT TO ANOTHER.
+clc;
+A=hex2dec(['82']); //storing the decimal value of hexadecimal no 82 in accumulator A
+B=dec2hex([A]); //storing the hexadecimal value of A in B
+print(%io(2),B); //displaying the hexadecimal number in register B
diff --git a/2522/CH6/EX6.1/exm6_1_output.jpg b/2522/CH6/EX6.1/exm6_1_output.jpg
new file mode 100755
index 000000000..9171e0314
--- /dev/null
+++ b/2522/CH6/EX6.1/exm6_1_output.jpg
Binary files differ
diff --git a/2522/CH6/EX6.2/exm6_2.sce b/2522/CH6/EX6.2/exm6_2.sce
new file mode 100755
index 000000000..951ba780f
--- /dev/null
+++ b/2522/CH6/EX6.2/exm6_2.sce
@@ -0,0 +1,11 @@
+//page no 164
+//example 6.2
+//TO SWITCH ON SOME DEVICES
+//let the switches which are ON are at bit no D0,D1,D2,D3,D6;
+clc;
+x=hex2dec(['4F']); //hexadecimal to decimal conversion
+y=dec2bin(x); //decimal to binary conversion
+printf('At output port 01H: '); //same input appears at the putput
+disp(y);
+printf('Value 1s are showing the devices are ON. \n')
+printf('Value 0s are showing the devices are switched OFF.');
diff --git a/2522/CH6/EX6.2/exm6_2_output.jpg b/2522/CH6/EX6.2/exm6_2_output.jpg
new file mode 100755
index 000000000..bce1db726
--- /dev/null
+++ b/2522/CH6/EX6.2/exm6_2_output.jpg
Binary files differ
diff --git a/2522/CH6/EX6.3/exm6_3.sce b/2522/CH6/EX6.3/exm6_3.sce
new file mode 100755
index 000000000..b9ac5befb
--- /dev/null
+++ b/2522/CH6/EX6.3/exm6_3.sce
@@ -0,0 +1,21 @@
+//page no 174
+//example 6.3
+//ADDITION OF TWO NUMBERS.
+//93H is stored in accumulator. Converting it into decimal.
+clc;
+A=hex2dec(['93']);
+//B7H is stored in register C. Converting it into decimal.
+C=hex2dec(['B7']);
+X=A+C; // the result comes out to be 330
+Z=X-256;
+//X=330; // this is a decimal value. Converting it into hexadecimal
+Y=dec2hex(Z);
+printf('Sum= ')
+disp(Y);
+if X>255 then
+ printf('CY=1')
+else
+ printf('CY=0')
+end
+
+
diff --git a/2522/CH6/EX6.3/exm6_3_output.jpg b/2522/CH6/EX6.3/exm6_3_output.jpg
new file mode 100755
index 000000000..8d3dddd3a
--- /dev/null
+++ b/2522/CH6/EX6.3/exm6_3_output.jpg
Binary files differ
diff --git a/2522/CH6/EX6.4/exm6_4.sce b/2522/CH6/EX6.4/exm6_4.sce
new file mode 100755
index 000000000..4dbf06ddb
--- /dev/null
+++ b/2522/CH6/EX6.4/exm6_4.sce
@@ -0,0 +1,17 @@
+//page no 175
+//example 6.4
+//CONTINUATION OF PREVIOUS EXAMPLE.
+//the sum of previous example is added to 35H
+clc;
+S=hex2dec(['4A']); //4AH is converted into decimal value.
+A=hex2dec(['35']); //35H is converted into decimal value
+s=A+S; //the result comes out to be 127. it is a decimal value
+Y=dec2hex(s);
+printf('Sum= ')
+disp(Y);
+if s>255 then
+ printf('CY=1')
+else
+ printf('CY=0')
+end
+
diff --git a/2522/CH6/EX6.4/exm6_4_output.jpg b/2522/CH6/EX6.4/exm6_4_output.jpg
new file mode 100755
index 000000000..7730e7c01
--- /dev/null
+++ b/2522/CH6/EX6.4/exm6_4_output.jpg
Binary files differ
diff --git a/2522/CH6/EX6.5/exm6_5.sce b/2522/CH6/EX6.5/exm6_5.sce
new file mode 100755
index 000000000..65e682f77
--- /dev/null
+++ b/2522/CH6/EX6.5/exm6_5.sce
@@ -0,0 +1,29 @@
+//page no 175
+//example no 6.5
+//INCRIMENTING ACCUMULATOR CONTENT.
+//accumulator holds the data FFH
+clc;
+A=hex2dec(['FF']); //converting FFH into decimal value
+//decimal value of 01H is 01. Adding 01 to A
+Y=A+1; //the result comes out to be 256
+Z=Y-256;
+X=dec2hex(Z);
+printf('Sum =')
+disp(X);
+if Y>255 then
+ printf('CY=1 \n')
+else
+ printf('CY=0 \n')
+end
+if Z>127 then
+ printf('S=1 \n')
+else
+ printf('S=0 \n')
+end
+if Z>0 then
+ printf('Z=0 \n')
+else
+ printf('Z=1 \n')
+end
+
+
diff --git a/2522/CH6/EX6.5/exm6_5_output.jpg b/2522/CH6/EX6.5/exm6_5_output.jpg
new file mode 100755
index 000000000..a920b1e5d
--- /dev/null
+++ b/2522/CH6/EX6.5/exm6_5_output.jpg
Binary files differ
diff --git a/2522/CH6/EX6.6/exm6_6.sce b/2522/CH6/EX6.6/exm6_6.sce
new file mode 100755
index 000000000..f206ea94d
--- /dev/null
+++ b/2522/CH6/EX6.6/exm6_6.sce
@@ -0,0 +1,31 @@
+//page no 179
+//example 6.6
+//SUBTRACTION OF TWO NUMBERS.
+//accumulator has 97H. Converting it into decimal value
+clc;
+A=hex2dec(['97']);
+//register B has 65H. Finding 2's compliment of 65H.
+B=hex2dec(['65']);
+X=256-B;
+Y=A+X;
+S=Y-256;
+Z=dec2hex(S);
+printf('Subtraction= ')
+disp(Z);
+if Y>255 then
+ CY=1;
+ printf('The result is positive. \n');
+else
+ CY=0;
+ printf('The result is negative. \n')
+end
+if S>127 then
+ printf('S=1 \n')
+else
+ printf('S=0 \n')
+end
+if S>0 then
+ printf('Z=0 \n')
+else
+ printf('Z=1 \n')
+end
diff --git a/2522/CH6/EX6.6/exm6_6_output.jpg b/2522/CH6/EX6.6/exm6_6_output.jpg
new file mode 100755
index 000000000..7f69f33fa
--- /dev/null
+++ b/2522/CH6/EX6.6/exm6_6_output.jpg
Binary files differ
diff --git a/2522/CH6/EX6.7/exm6_7.sce b/2522/CH6/EX6.7/exm6_7.sce
new file mode 100755
index 000000000..036a7d318
--- /dev/null
+++ b/2522/CH6/EX6.7/exm6_7.sce
@@ -0,0 +1,39 @@
+//page no 185
+//example no 6.7
+//PERFORMING LOGICAL OPERATIONS.
+//register B holds 93H.Binary of 93H is 10010011
+//register A holds 15H. Binary of 15H is 00010101.
+clc;
+B=[1 0 0 1 0 0 1 1]; //taking the value of A in matrix form.
+A=[0 0 0 1 0 1 0 1]; //taking the value of B in matrix form.
+Y= bitor(A,B); // getting OR of A & B
+printf('OR of A & B is')
+disp(Y);
+if Y(1,1)==1 then
+ printf('S=1 \n');
+else
+ printf('S=0 \n');
+end
+if Y==0 then
+ printf('Z=1 \n');
+else
+ printf('Z=0 \n');
+end
+printf('CY=0 \n');
+R=bitxor(A,B); //getting XOR of A & B
+printf('XOR of A & B is')
+disp(R);
+if R(1,1)==1 then
+ printf('S=1 \n');
+else
+ printf('S=0 \n');
+end
+if R==0 then
+ printf('Z=1 \n');
+else
+ printf('Z=0 \n');
+end
+printf('CY=0 \n');
+K=bitcmp(A,1); //getting the compliment of A
+printf('Compliment of A is: \n');
+disp(K);
diff --git a/2522/CH6/EX6.7/exm6_7_output.jpg b/2522/CH6/EX6.7/exm6_7_output.jpg
new file mode 100755
index 000000000..8c2eb3767
--- /dev/null
+++ b/2522/CH6/EX6.7/exm6_7_output.jpg
Binary files differ
diff --git a/2522/CH6/EX6.8/exm6_8.sce b/2522/CH6/EX6.8/exm6_8.sce
new file mode 100755
index 000000000..00e371f86
--- /dev/null
+++ b/2522/CH6/EX6.8/exm6_8.sce
@@ -0,0 +1,11 @@
+//page no 186
+//example no 6.8
+//KEEPING THE RADIO ON.
+//to keep the radio on without affecting the other appliances, the D4 bit should always be 1
+//assuming an input input binary 10101010
+clc;
+A=[1 0 1 0 1 0 1 0];
+B=[0 0 0 1 0 0 0 0];
+Y=bitor(A,B); //ORing input (A) with B to keep the D4 bit always set
+disp(Y);
+printf('D4 bit will always be one without affecting the other bits');
diff --git a/2522/CH6/EX6.8/exm6_8_output.jpg b/2522/CH6/EX6.8/exm6_8_output.jpg
new file mode 100755
index 000000000..f5bb856b8
--- /dev/null
+++ b/2522/CH6/EX6.8/exm6_8_output.jpg
Binary files differ
diff --git a/2522/CH6/EX6.9/exm6_9.sce b/2522/CH6/EX6.9/exm6_9.sce
new file mode 100755
index 000000000..061af9c51
--- /dev/null
+++ b/2522/CH6/EX6.9/exm6_9.sce
@@ -0,0 +1,11 @@
+//page no 187
+//example no 6.9
+//TURN OFF THE AIR CONDITIONER.
+//to turn OFF the air conditioner, reset bit D7
+//Assuming the same input as earlier as it is a continuation of previous example.
+clc;
+A=[1 0 1 0 1 0 1 0];
+B=[0 1 1 1 1 1 1 1];
+Y=bitand(A,B); //ANDing input (A) with B to keep the D4 bit always set
+disp(Y);
+printf('D7 bit will always be zero without affecting the other bits');
diff --git a/2522/CH6/EX6.9/exm6_9_output.jpg b/2522/CH6/EX6.9/exm6_9_output.jpg
new file mode 100755
index 000000000..2a9869bfb
--- /dev/null
+++ b/2522/CH6/EX6.9/exm6_9_output.jpg
Binary files differ