CSO Practical File
CSO Practical File
CSO Practical File
● WHAT IS PERIPHERALS ?
A peripheral is a “device that is used to put information into or get information out of
the computer.
Output Devices:
⮚ Speaker
⮚ Monitor
⮚ Printer
⮚ Headphone
⮚ Projector
Storage Devices:
⮚ Pen Drive
⮚ Hard Drive
⮚ USB
⮚ DVD
⮚ Floppy Disk
⮚ Solid State Drive
Input Devices:
In computing, an input device is a piece of equipment used to provide data and control
signals to an information processing system, such as a computer or information
appliance. Examples of input devices include keyboards, mouse, scanners, cameras,
joysticks, and microphones.
Pointing Devices:
A pointing device is any human interface device that allows a user to input
spatial data to a computer. In the case of mice and touchpads, this is usually achieved
by detecting movement across a physical surface. Analog devices, such as 3D mice,
joysticks, or pointing sticks, function by reporting their angle of deflection.
Movements of the pointing device are echoed on the screen by movements of the
pointer, creating a simple, intuitive way to navigate a computer’s graphical user
interface (GUI).
Composite Devices :
Input devices, such as buttons and joysticks, can be combined on a single
physical device that could be thought of as a composite device. Many gaming
devices have controllers like this. Technically mice are composite devices, as they
both track movement and provide buttons for clicking, but composite devices are
generally considered to have more than two different forms of input.
⮚ Game controller
⮚ Gamepad (or joypad)
⮚ Paddle (game controller)
⮚ Jog dial/shuttle (or knob)
Video input devices are used to digitize images or video from the outside
world into the computer. The information can be stored in a multitude of formats
depending on the user’s requirement.
⮚ Digital camera
⮚ Digital camcorder
⮚ Portable media player
⮚ Webcam
⮚ Microsoft Kinect Sensor
⮚ Image scanner
⮚ Fingerprint scanner
⮚ Barcode reader
⮚ 3D scanner
⮚ Laser rangefinder
⮚ Eye gaze tracker
Medical Imaging :
⮚ Computed tomography
⮚ Magnetic resonance imaging
⮚ Positron emission tomography
⮚ Medical ultrasonography
Audio input devices are used to capture sound. In some cases, an audio
output device can be used as an input device, in order to capture produced sound.
⮚ Microphones
⮚ MIDI keyboard or other digital musical instrument
Output Devices:
An output device is any piece of computer hardware equipment used to
communicate the results of data processing carried out by an information processing
system (such as a computer) which converts the electronically generated information
into human-readable form.
Display Devices:
Inputs are the signals or data received by the system, and outputs are the signals or
data sent from it.
There are many input and output devices such as multifunction printers and
computer-based navigation systems that are used for specialised or unique
applications. In computing, input/output refers to the communication between an
information processing system (such as a computer), and the outside world. Inputs
are the signals or data received by the system, and outputs are the signals or data sent
from it.
Examples:
These examples of output devices also include input/output devices.
Printers and visual displays are the most common type of output device for
interfacing to people, but voice is becoming increasingly available.[9]
⮚ Speakers
⮚ Headphones
⮚ Screen (Monitor)
⮚ Printer
⮚ Automotive navigation system
⮚ Projector
⮚ Television
Computer Memory :
In computing, memory refers to the devices used to store information for
use in a computer. The term primary memory is used for storage systems which
function at high-speed (i.e. RAM), as a distinction from secondary memory, which
provides program and data storage that is slow to access but offer higher memory
capacity. If needed, primary memory can be stored in secondary memory, through a
memory management technique called “virtual memory.” An archaic synonym for
memory is store.
Volatile Memory
DDR-SD-RAM, SD-RAM and two older forms of RAM.
Non-Volatile Memory:
Non-volatile memory is computer memory that can retain the stored information even
when not powered. Examples of non-volatile memory include read-only
memory (see ROM), flash memory, most types of magnetic computer storage
devices (e.g. hard disks, floppy discs and magnetic tape), optical discs, and early
computer storage methods such as paper tape and punched cards. Forthcoming non-
volatile memory technologies include FeRAM, CBRAM,PRAM, SONOS, RRAM,
Racetrack memory, NRAM and Millipede.
Experiment 2:
Objective: Write a C program for sum of
two Binary numbers.
Code:
#include <stdio.h>
int main()
{
long binary1, binary2;
int i = 0, remainder = 0, sum[20];
printf("Enter the first binary number: ");
scanf("%ld", &binary1);
printf("Enter the second binary number: ");
scanf("%ld", &binary2);
while (binary1 != 0 || binary2 != 0)
{
sum[i++] =(binary1 % 10 + binary2 % 10 + remainder) % 2;
remainder =(binary1 % 10 + binary2 % 10 + remainder) / 2;
binary1 = binary1 / 10;
binary2 = binary2 / 10;
}
if (remainder != 0)
sum[i++] = remainder;
--i;
printf("Sum of two binary numbers: ");
while (i >= 0)
printf("%d", sum[i--]);
return 0;
}
Output:
Experiment 3:
Objective: Write a C program for
multiplication of two Binary numbers.
Code:
#include <stdio.h>
int binaryproduct(int, int);
int main()
{
long binary1, binary2, multiply = 0;
int digit, factor = 1;
Experiment 4:
Objective: Write a C program to implement
Booth’s Algorithm Multiplication.
Code:
#include <stdio.h>
#include <math.h>
void binary(){
a1 = fabs(a);
b1 = fabs(b);
int r, r2, i, temp;
for (i = 0; i < 5; i++){
r = a1 % 2;
a1 = a1 / 2;
r2 = b1 % 2;
b1 = b1 / 2;
anum[i] = r;
anumcp[i] = r;
bnum[i] = r2;
if(r2 == 0){
bcomp[i] = 1;
}
if(r == 0){
acomp[i] =1;
}
}
//part for two's complementing
c = 0;
for ( i = 0; i < 5; i++){
res[i] = com[i]+ bcomp[i] + c;
if(res[i] >= 2){
c = 1;
}
else
c = 0;
res[i] = res[i] % 2;
}
for (i = 4; i >= 0; i--){
bcomp[i] = res[i];
}
//in case of negative inputs
if (a < 0){
c = 0;
for (i = 4; i >= 0; i--){
res[i] = 0;
}
for ( i = 0; i < 5; i++){
res[i] = com[i] + acomp[i] + c;
if (res[i] >= 2){
c = 1;
}
else
c = 0;
res[i] = res[i]%2;
}
for (i = 4; i >= 0; i--){
anum[i] = res[i];
anumcp[i] = res[i];
}
}
if(b < 0){
for (i = 0; i < 5; i++){
temp = bnum[i];
bnum[i] = bcomp[i];
bcomp[i] = temp;
}
}
}
void add(int num[]){
int i;
c = 0;
for ( i = 0; i < 5; i++){
res[i] = pro[i] + num[i] + c;
if (res[i] >= 2){
c = 1;
}
else{
c = 0;
}
res[i] = res[i]%2;
}
for (i = 4; i >= 0; i--){
pro[i] = res[i];
printf("%d",pro[i]);
}
printf(":");
for (i = 4; i >= 0; i--){
printf("%d", anumcp[i]);
}
}
void arshift(){//for arithmetic shift right
int temp = pro[4], temp2 = pro[0], i;
for (i = 1; i < 5 ; i++){//shift the MSB of product
pro[i-1] = pro[i];
}
pro[4] = temp;
for (i = 1; i < 5 ; i++){//shift the LSB of product
anumcp[i-1] = anumcp[i];
}
anumcp[4] = temp2;
printf("\nAR-SHIFT: ");//display together
for (i = 4; i >= 0; i--){
printf("%d",pro[i]);
}
printf(":");
for(i = 4; i >= 0; i--){
printf("%d", anumcp[i]);
}
}
void main(){
int i, q = 0;
printf("\t\tBOOTH'S MULTIPLICATION ALGORITHM");
printf("\nEnter two numbers to multiply: ");
printf("\nBoth must be less than 16");
//simulating for two numbers each below 16
do{
printf("\nEnter A: ");
scanf("%d",&a);
printf("Enter B: ");
scanf("%d", &b);
}while(a >=16 || b >=16);
printf("\nProduct is = ");
for (i = 4; i >= 0; i--){
printf("%d", pro[i]);
}
for (i = 4; i >= 0; i--){
printf("%d", anumcp[i]);
}
}
Output:
Experiment 5:
Objective: Write the working of 8085
simulator GNUsim8085 and basic
architecture of 8085 along with small
introduction.
● Sign (S)
● Zero (Z)
● Auxiliary Carry (AC)
● Parity (P)
● Carry (C)
Its bit position is shown in the following table −
D7 D6 D5 D4 D3 D2
S Z AC P
Instruction sets are instruction codes to perform some task. It is classified into five
categories.
Control Instructions
1
Following is the table showing the list of Control instructions with their
meanings.
Logical Instructions
2 Following is the table showing the list of Logical instructions with their
meanings.
Branching Instructions
3 Following is the table showing the list of Branching instructions with
their meanings.
Arithmetic Instructions
4 Following is the table showing the list of Arithmetic instructions with
their meanings.
int n=i;
int bc[50];
printf("\n");
for(i=0;i<n;i++)
{
if(b[i]==0)
{
bc[i]=1;
}
else
{
bc[i]=0;
}
}
bc[n]=1;
for(i=0;i<=n;i++)
{
if(bc[i]==0)
{
bc[i]=1;
i=n+2;
}
else
{
bc[i]=0;
}
}
int l;
b[n]=0;
int k=n;
int n1=n+n-1;
int j,mi=n-1;
for(i=n;i!=0;i--)
{
for(j=n;j>0;j--)
{
acum[j]=acum[j-1];
}
acum[0]=q[n-1];
for(j=n-1;j>0;j--)
{
q[j]=q[j-1];
}
add(acum,bc,n+1);
if(acum[n]==1)
{
q[0]=0;
add(acum,b,n+1);
}
else
{
q[0]=1;
}
}
printf("\nQuoient : ");
for( l=n-1;l>=0;l--)
{
printf("%d",q[l]);
}
printf("\nRemainder : ");
for( l=n;l>=0;l--)
{
printf("%d",acum[l]);
}
return 0;
}
void add(int acum[],int bo[],int n)
{
int i=0,temp=0,sum=0;
for(i=0;i<n;i++)
{
sum=0;
sum=acum[i]+bo[i]+temp;
if(sum==0)
{
acum[i]=0;
temp=0;
}
else if (sum==2)
{
acum[i]=0;
temp=1;
}
else if(sum==1)
{
acum[i]=1;
temp=0;
}
else if(sum==3)
{
acum[i]=1;
temp=1;
}
}
}
Output:-
Experiment 8:-
Objective: Write an assembly language code
in GNU8085 to implement data transfer
instruction.
Code:
LDA 0000
MOV B , A
LDA 0001
HLT
Output:-
Experiment 9:-
Objective : Write an assembly language code
in GNU8085 to store number in reverse
order.
Code:-
LDA 0002
RLC
RLC
RLC
RLC
STA 0003
HLT
Output:-
Experiment 10:-
Objective: Write an assembly language code
in GNU8085 to add two 8 bit numbers stored
in memory and also storing the carry.
Code:-
LDA 0000
MOV B,A
LDA 0001
ADD B
STA 0002
HLT
Output:-