Blogger Widgets

Friday 4 May 2012

IC 70LS90 DECOUNTER IC

The 74LS90 is a simple counter, i.e. it can count from 0 to 9 cyclically in its natural mode. It counts the input pulses and the output is received as a 4-bit binary number through pins QA, QB, QC and QD. The binary output is reset to 0000 at every tenth pulse and count starts from 0 again. A pulse is also generated (probably at pin 9) as it resets its output to 0000. The chip can count up to other maximum numbers and return to zero by changing the modes of 7490. These modes are set by changing the connection of reset pins R1 - R4. For example, if either R1 & R2 are high or R3 & R4 are ground, then it will reset QA, QB, QC and QD to 0. If resets R3 & R4 are high, then the count on QA, QB, QC and QD goes to 1001.
 
The other high counts can be generated by connecting two or more 7490 ICs. For example, if two 7490 are connected in a manner that input of one becomes the output of other, the second IC will receive a pulse on every tenth count and will reset at every hundredth count. Thus this system can count from 0 to 99 and give corresponding BCD outputs.
 
7490 has an inbuilt divide by two and divide by five counters which can be connected in different fashion by changing the connections. It can be used as a divide by 10 counter by connecting QA with (clock) input2, grounding all the reset pins, and giving pulse at (clock) input1. This enables the cascade connection of the inbuilt counters. It can also be used as a divide by 6 counter by connecting QA with input2, grounding R3 & R4, and giving pulse at input1.
 
By connecting QA with input1, 7490 can be used for BCD counting whereas by connecting QD with input2, it can be used for bi-quinary counting. Bi-quinary is a system for storing decimal digits in a four-bit binary number. The bi-quinary code was used in the abacus.
Pin Diagram: 
Pin Description: 
Pin No
Function
Name
1
Clock input 2
Input2
2
Reset1
R1
3
Reset2
R2
4
Not connected
NC
5
Supply voltage; 5V (4.75V – 5.25V)
Vcc
6
Reset3
R3
7
Reset4
R4
8
Output 3, BCD Output bit 2
 
QC
9
Output 2, BCD Output bit 1
 
QB
10
Ground (0V)
Ground
11
Output 4, BCD Output bit 3
 
QD
12
Output 1, BCD Output bit 0
 
QA
13
Not connected
NC
14
Clock input 1
Input1


Continue Reading »

Thursday 3 May 2012

Employee management system.

//Employee management system.

#include<iostream.h>
#include<string.h>
#include<iomanip.h>
#include<dos.h>
#include<conio.h>
#include<stdio.h>
#define max 20
struct employee
{
char name[20];
long int code;
char designation[20];
int exp;
int age;
};
int num;
employee emp[max],tempemp[max],sortemp[max],sortemp1[max];
void main()
{
clrscr();
void build();
void list();
void insert();
void deletes();
void edit();
void search();
void sort();
char option;
void menu();
menu();
while((option=cin.get())!='q')
{
switch(option)
{
case 'b':
build();
break;
case 'l':
list();
break;
case 'i':
insert();
break;
case 'd':
deletes();
break;
case 'e':
edit();
break;
case 's':
search();
break;
case 'n':
sort();
break;
}
menu();
}
}
void menu()
{
clrscr();
highvideo();
cout<<" ";
cprintf("*****WelCome To Employee Data Centre*****");
normvideo();
cout<<endl;
cout<<" ";
cout<<"Press b---->Built The Employee Table ";
cout<<" ";
cout<<"Press l---->List The Employee Table";
cout<<" ";
cout<<"Press i---->Insert New Entry";
cout<<" ";
cout<<"Press d---->Delete An Entry";
cout<<" ";
cout<<"Press e---->Edit An Entry";
cout<<" ";
cout<<"Press s---->Search Arecord";
cout<<" ";
cout<<"Press n---->Sort The Table";
cout<<" ";
cout<<"Press q---------->QUIT ";
cout<<" ";
cout<<"Option Please ----->";
}

void build()
{

clrscr();
highvideo();
cprintf("Build The Table ");
cout<<endl;
normvideo();
cout<<"maximum number of entries ----- > 20"<<endl;
cout<<"how many do you want ----->";
cin>>num;
cout<<"Enter The Following Items";
for(int i=0;i<=num-1;i++)
{
cout<<" Name ";
cin>>emp[i].name;
cout<<"Code ";
cin>>emp[i].code;
cout<<"Designation ";
cin>>emp[i].designation;
cout<<"Years of Experience ";
cin>>emp[i].exp;
cout<<"Age ";
cin>>emp[i].age;
}
cout<<"going to main menu";
delay(500);
}

void list()
{
clrscr();
highvideo();
cprintf(" ********List The Table********");
cout<<endl;
normvideo();
cout<<" Name Code Designation Years(EXP) Age";
cout<<" ------------------------------------------------------";
for(int i=0;i<=num-1;i++)
{
cout<<setw(13)<<emp[i].name;
cout<<setw(6)<<emp[i].code;
cout<<setw(15)<<emp[i].designation;
cout<<setw(10)<<emp[i].exp;
cout<<setw(15)<<emp[i].age;
cout<<endl;
}
cout<<"going to main menu";
getch();
}
void insert()
{
clrscr();
int i=num;
num+=1;
highvideo();
cprintf("Insert New Record");
cout<<endl;
normvideo();
cout<<"Enter The Following Items";
cout<<"Name ";
cin>>emp[i].name;
cout<<"Code ";
cin>>emp[i].code;
cout<<"Designation ";
cin>>emp[i].designation;
cout<<"Years of Experience ";
cin>>emp[i].exp;
cout<<"Age ";
cin>>emp[i].age;
cout<<endl<<endl;
cout<<"going to main menu";
delay(500);

}


void deletes()
{
clrscr();
highvideo();
int code;
int check;
cprintf("Delete An Entry");
normvideo();
cout<<endl;
cout<<"Enter An JobCode To Delete That Entry ";
cin>>code;
int i;
for(i=0;i<=num-1;i++)
{
if(emp[i].code==code)
{
check=i;
}
}
for(i=0;i<=num-1;i++)
{
if(i==check)
{
continue;
}
else
{
if(i>check)
{
tempemp[i-1]=emp[i];
}
else
{
tempemp[i]=emp[i];
}
}
}
num--;

for(i=0;i<=num-1;i++)
{
emp[i]=tempemp[i];
}
}

void edit()
{
clrscr();
int jobcode;
highvideo();
cprintf(" Edit An Entry ");
cout<<endl;
cout<<endl;
int i;
void editmenu();
void editname(int);
void editcode(int);
void editdes(int);
void editexp(int);
void editage(int);
char option;
normvideo();
cout<<"Enter An jobcode To Edit An Entry---- ";
cin>>jobcode;
editmenu();
for(i=0;i<=num-1;i++)
{
if(emp[i].code==jobcode)
{

while((option=cin.get())!='q')
{
switch(option)
{
case 'n':
editname(i);
break;
case 'c':
editcode(i);
break;
case 'd':
editdes(i);
break;
case 'e':
editexp(i);
break;
case 'a':
editage(i);
break;
}
editmenu();
}
}
}
}
void editmenu()
{
clrscr();
cout<<" What Do You Want To edit";
cout<<" n--------->Name";
cout<<" c--------->Code";
cout<<" d--------->Designation";
cout<<" e--------->Experience";
cout<<" a--------->Age";
cout<<" q----->QUIT";
cout<<" Options Please ---->>> ";
}
void editname(int i)
{
cout<<"Enter New Name-----> ";
cin>>emp[i].name;
}
void editcode(int i)
{
cout<<"Enter New Job Code-----> ";
cin>>emp[i].code;
}
void editdes(int i)
{
cout<<"enter new designation-----> ";
cin>>emp[i].designation;
}
void editexp(int i)
{
cout<<"Enter new Years of Experience";
cin>>emp[i].exp;
}
void editage(int i)
{
cout<<"Enter new Age";
cin>>emp[i].age;
}

void search()
{
clrscr();
highvideo();
cprintf("Welcome To Search Of Employee Database");
normvideo();
cout<<endl;
cout<<endl;
int jobcode;
cout<<"You Can Search Only By Jobcode Of An Employee";
cout<<"Enter Code Of An Employee";
cin>>jobcode;
for(int i=0;i<=num-1;i++)
{
if(emp[i].code==jobcode)
{

cout<<" Name Code Designation Years(EXP) Age";
cout<<" ------------------------------------------------------";
cout<<setw(13)<<emp[i].name;
cout<<setw(6)<<emp[i].code;
cout<<setw(15)<<emp[i].designation;
cout<<setw(10)<<emp[i].exp;
cout<<setw(15)<<emp[i].age;
cout<<endl;
}

}
cout<<"going to main menu";
getch();


}

void sort()
{
clrscr();
highvideo();
cprintf("Sort The Databse By JobCode");
normvideo();
void sortmenu();
void sortname();
void sortcode();
void sortdes();
void sortexp();
char option;
void sortage();

cout<<endl;
cout<<endl;
sortmenu();
while((option=cin.get())!='q')
{
switch(option)
{
case 'n':
sortname();
break;
case 'c':
sortcode();
break;
case 'd':
sortdes();
break;
case 'e':
sortexp();
break;
case 'a':
sortage();
break;
}
sortmenu();
}
}


void sortmenu()
{
clrscr();
cout<<" What Do You Want To edit";
cout<<" n--------->Name";
cout<<" c--------->Code";
cout<<" d--------->Designation";
cout<<" e--------->Experience";
cout<<" a--------->Age";
cout<<" q----->QUIT";
cout<<" Options Please ---->>> ";
}



void sortname()
{
clrscr();
int i,j;
struct employee temp[max];
for(i=0;i<=num-1;i++)
{
sortemp1[i]=emp[i];
}
for(i=0;i<=num-1;i++)
{
for(j=0;j<=num-1;j++)
{
if(strcmp(sortemp1[i].name,sortemp1[j].name)<=0)
{
temp[i]=sortemp1[i];
sortemp1[i]=sortemp1[j];
sortemp1[j]=temp[i];
}
}
}

for( i=0;i<=num-1;i++)
{

cout<<" Name Code Designation Years(EXP) Age";
cout<<" ------------------------------------------------------";
for( i=0;i<=num-1;i++)
{
cout<<setw(13)<<sortemp1[i].name;
cout<<setw(6)<<sortemp1[i].code;
cout<<setw(15)<<sortemp1[i].designation;
cout<<setw(10)<<sortemp1[i].exp;
cout<<setw(15)<<sortemp1[i].age;
cout<<endl;
}
cout<<"Press Any Key To Go Back";
getch();

} }

void sortcode()
{
clrscr();
int i,j;
struct employee temp[max];
for(i=0;i<=num-1;i++)
{
sortemp1[i]=emp[i];
}
for(i=0;i<=num-1;i++)
{
for(j=0;j<=num-1;j++)
{
if(sortemp1[i].code<sortemp1[j].code)
{
temp[i]=sortemp1[i];
sortemp1[i]=sortemp1[j];
sortemp1[j]=temp[i];
}
}
}

for( i=0;i<=num-1;i++)
{

cout<<" Name Code Designation Years(EXP) Age";
cout<<" ------------------------------------------------------";
for( i=0;i<=num-1;i++)
{
cout<<setw(13)<<sortemp1[i].name;
cout<<setw(6)<<sortemp1[i].code;
cout<<setw(15)<<sortemp1[i].designation;
cout<<setw(10)<<sortemp1[i].exp;
cout<<setw(15)<<sortemp1[i].age;
cout<<endl;
}
cout<<"Press Any Key To Go Back";
getch();

} }


void sortdes()
{
clrscr();
int i,j;
struct employee temp[max];
for(i=0;i<=num-1;i++)
{
sortemp1[i]=emp[i];
}
for(i=0;i<=num-1;i++)
{
for(j=0;j<=num-1;j++)
{
if(strcmp(sortemp1[i].designation,sortemp1[j].designation)<=0)
{
temp[i]=sortemp1[i];
sortemp1[i]=sortemp1[j];
sortemp1[j]=temp[i];
}
}
}

for( i=0;i<=num-1;i++)
{

cout<<" Name Code Designation Years(EXP) Age";
cout<<" ------------------------------------------------------";
for( i=0;i<=num-1;i++)
{
cout<<setw(13)<<sortemp1[i].name;
cout<<setw(6)<<sortemp1[i].code;
cout<<setw(15)<<sortemp1[i].designation;
cout<<setw(10)<<sortemp1[i].exp;
cout<<setw(15)<<sortemp1[i].age;
cout<<endl;
}
cout<<"Press Any Key To Go Back";
getch();

} }

void sortage()
{
clrscr();
int i,j;
struct employee temp[max];
for(i=0;i<=num-1;i++)
{
sortemp1[i]=emp[i];
}
for(i=0;i<=num-1;i++)
{
for(j=0;j<=num-1;j++)
{
if(sortemp1[i].age<sortemp1[j].age)
{
temp[i]=sortemp1[i];
sortemp1[i]=sortemp1[j];
sortemp1[j]=temp[i];
}
}
}

for( i=0;i<=num-1;i++)
{

cout<<" Name Code Designation Years(EXP) Age";
cout<<" ------------------------------------------------------";
for( i=0;i<=num-1;i++)
{
cout<<setw(13)<<sortemp1[i].name;
cout<<setw(6)<<sortemp1[i].code;
cout<<setw(15)<<sortemp1[i].designation;
cout<<setw(10)<<sortemp1[i].exp;
cout<<setw(15)<<sortemp1[i].age;
cout<<endl;
}
cout<<"Press Any Key To Go Back";
getch();

} }


void sortexp()
{
clrscr();
int i,j;
struct employee temp[max];
for(i=0;i<=num-1;i++)
{
sortemp1[i]=emp[i];
}
for(i=0;i<=num-1;i++)
{
for(j=0;j<=num-1;j++)
{
if(sortemp1[i].exp<sortemp1[j].exp)
{
temp[i]=sortemp1[i];
sortemp1[i]=sortemp1[j];
sortemp1[j]=temp[i];
}
}
}

for( i=0;i<=num-1;i++)
{

cout<<" Name Code Designation Years(EXP) Age";
cout<<" ------------------------------------------------------";
for( i=0;i<=num-1;i++)
{
cout<<setw(13)<<sortemp1[i].name;
cout<<setw(6)<<sortemp1[i].code;
cout<<setw(15)<<sortemp1[i].designation;
cout<<setw(10)<<sortemp1[i].exp;
cout<<setw(15)<<sortemp1[i].age;
cout<<endl;
}
cout<<"Press Any Key To Go Back";
getch();

} }
Continue Reading »

Monday 30 April 2012

Circular Convolution of two Sequences

MATLAB CODE:-
clc
close all
clear all
x=input('Enter the sequence x:');
h=input('Enter the sequence h:');
subplot(3,1,1);
stem(x);
xlabel('--->n');
ylabel('Amp');
legend('Input Sequence');


subplot(3,1,2);
stem(h);
xlabel('--->');
ylabel('Amp');
legend('Impulse Responce');

lx=length(x);
lh=length(h);
l=max(lx,lh);
x=[x,zeros(1,l-lx)];
h=[h,zeros(1,l-lh)];
H=zeros(l,l);
H(1:lh,1)=h;
for j=1:l-1
    for i=1:l-1
        H(i+1,j+1)=H(i,j);
    end
        H(1,j+1)=H(l,j);
end
y=H*x';
subplot(3,1,3);
stem(y);
title('Circular Convulation');

INPUT & OUTPUT:-
Enter the sequence x:[1 -1 2 3]
Enter the sequence h:[1 -2 3 1]
>> y

y =

     0
     8
    10
    -3

FIGURE:-


Continue Reading »