//Computerised electrical equpiment control system.
#include<stdio.h>
#include<conio.h>
void main()
{
void tone(void);
int p=0x0378;
char ex[50]="Created by User.";
int k;
char ex1[50]= "Programming language used is : C";
int m,j,l;
char ex2[50]="ALL SYSTEMS SHUT DOWN SUCCESSFULLY." ;
char ex3[50]="THANK YOU FOR USING THIS SOFTWARE.";
int u[10];
int i;
static a,b,c,d,e,f,g,h;
char no;
clrscr();
textcolor(15);gotoxy(20,6);
cprintf("COMPUTERISED ELECTRICAL EQUPIMENT CONTROL");
textcolor(11);
gotoxy(20,7);
cprintf("-----------------------------------------");
textcolor(9); gotoxy(10,10);
cprintf("EQUIPMENT NO. 1 2 3 4 5 6 7 8");
textcolor(9); gotoxy(10,12);
cprintf("STATUS %d %d %d %d %d %d %d %d",a,b,c,d,e,f,g,h);
textcolor(10); gotoxy(14,16);
cprintf("FOR 'ON'AND 'OFF' PRESS CORESSPONDING EQUIPMENT NUMBER.");
textcolor(13);gotoxy(25,18);
cprintf("STATUS 0 = OFF STATUS 1 = ON");
textcolor(12); gotoxy(32,22);
cprintf("FOR EXIT PRESS 'E'");
no=getch();
switch(no)
{
case '1':
a=!a;
tone();
outportb(p,1);
delay(500);
outportb(p,0);
break;
case '2':
b=!b;
tone();
outport(p,2);
delay(500);
outportb(p,0);
break;
case '3':
c=!c;
tone();
outport(p,4);
delay(500);
outportb(p,0);
break;
case '4':
d=!d;
tone();
outport(p,8);
delay(500);
outportb(p,0);
break;
case '5':
e=!e;
tone();
outport(p,16);
delay(500);
outportb(p,0);
break;
case '6':
f=!f;
tone();
outport(p,32);
delay(500);
outportb(p,0);
break;
case '7':
g=!g;
tone();
outport(p,64);
delay(500);
outportb(p,0);
break;
case '8':
h=!h;
tone();
outport(p,128);
delay(500);
outportb(p,0);
break;
case 'e':
if((a||b||c||d||e||f||g||h)==1)
{
clrscr();
textcolor(13); gotoxy(20,12);
cprintf("WARNING:PLEASE SHUT DOWN ALL THE EQUIPMENTS!");
sound(200);
delay(8500);
nosound();
break;
}
else
{
clrscr();
for(j=0;j<35;j++)
{
textcolor(13); gotoxy(20+j,12);
cprintf("%c",ex[j]);
sound(3000+j);
delay(30);
nosound();
}
for(m=0;m<40;m++)
{
textcolor(10); gotoxy(20+m,13);
cprintf("%c",ex3[m]);
sound(1800+m);
delay(30);
nosound();
}
for(k=0;k<34;k++)
{
textcolor(4); gotoxy(20+k,14);
cprintf("%c",ex1[k]);
sound(2000+k);
delay(30);
nosound();
}
for(l=0;l<40;l++)
{
textcolor(3); gotoxy(20+l,15);
cprintf("%c",ex2[l]);
sound(2500+l);
delay(30);
nosound();
}
window(10, 10, 80, 25);
printf("PRESS ANY KEY.");
getch();
outportb(p,0);
exit(0);
}
case 'E':
if((a||b||c||d||e||f||g||h)==1)
{
clrscr();
textcolor(10); gotoxy(20,12);
cprintf("PLEASE SHUT DOWN ALL THE EQUIPMENTS.");
sound(200);
delay(500);
nosound();
delay(3000);
break;
}
else
{
clrscr();
for(j=0;j<23;j++)
{
textcolor(5); gotoxy(20+j,12);
cprintf("%c",ex[j]);
sound(3000+j);
delay(30);
nosound();
}
for(m=0;m<23;m++)
{
textcolor(3); gotoxy(20+m,13);
cprintf("%c",ex3[m]);
sound(1800+m);
delay(30);
nosound();
}
for(k=0;k<34;k++)
{
textcolor(11); gotoxy(20+k,14);
cprintf("%c",ex1[k]);
sound(2000+k);
delay(30);
nosound();
}
for(l=0;l<40;l++)
{
textcolor(12); gotoxy(20+l,15);
cprintf("%c",ex2[l]);
sound(2500+l);
delay(30);
nosound();
}
textcolor(12+BLINK);
gotoxy(40,40);
cprintf("PRESS ANY KEY.");
getch();
outportb(p,0);
exit(0);
}
default:
clrscr();
sound(500);
delay(100);
nosound();
textcolor(9); gotoxy(30,12);
cprintf("INVALID KEY PRESSED.");
textcolor(11); gotoxy(33,14);
cprintf("WAIT FOR 2 SECONDS.");
delay(3000);
break;
}
main();
}
void tone(void)
{
sound(1000);
delay(100);
nosound();
}
#include<stdio.h>
#include<conio.h>
void main()
{
void tone(void);
int p=0x0378;
char ex[50]="Created by User.";
int k;
char ex1[50]= "Programming language used is : C";
int m,j,l;
char ex2[50]="ALL SYSTEMS SHUT DOWN SUCCESSFULLY." ;
char ex3[50]="THANK YOU FOR USING THIS SOFTWARE.";
int u[10];
int i;
static a,b,c,d,e,f,g,h;
char no;
clrscr();
textcolor(15);gotoxy(20,6);
cprintf("COMPUTERISED ELECTRICAL EQUPIMENT CONTROL");
textcolor(11);
gotoxy(20,7);
cprintf("-----------------------------------------");
textcolor(9); gotoxy(10,10);
cprintf("EQUIPMENT NO. 1 2 3 4 5 6 7 8");
textcolor(9); gotoxy(10,12);
cprintf("STATUS %d %d %d %d %d %d %d %d",a,b,c,d,e,f,g,h);
textcolor(10); gotoxy(14,16);
cprintf("FOR 'ON'AND 'OFF' PRESS CORESSPONDING EQUIPMENT NUMBER.");
textcolor(13);gotoxy(25,18);
cprintf("STATUS 0 = OFF STATUS 1 = ON");
textcolor(12); gotoxy(32,22);
cprintf("FOR EXIT PRESS 'E'");
no=getch();
switch(no)
{
case '1':
a=!a;
tone();
outportb(p,1);
delay(500);
outportb(p,0);
break;
case '2':
b=!b;
tone();
outport(p,2);
delay(500);
outportb(p,0);
break;
case '3':
c=!c;
tone();
outport(p,4);
delay(500);
outportb(p,0);
break;
case '4':
d=!d;
tone();
outport(p,8);
delay(500);
outportb(p,0);
break;
case '5':
e=!e;
tone();
outport(p,16);
delay(500);
outportb(p,0);
break;
case '6':
f=!f;
tone();
outport(p,32);
delay(500);
outportb(p,0);
break;
case '7':
g=!g;
tone();
outport(p,64);
delay(500);
outportb(p,0);
break;
case '8':
h=!h;
tone();
outport(p,128);
delay(500);
outportb(p,0);
break;
case 'e':
if((a||b||c||d||e||f||g||h)==1)
{
clrscr();
textcolor(13); gotoxy(20,12);
cprintf("WARNING:PLEASE SHUT DOWN ALL THE EQUIPMENTS!");
sound(200);
delay(8500);
nosound();
break;
}
else
{
clrscr();
for(j=0;j<35;j++)
{
textcolor(13); gotoxy(20+j,12);
cprintf("%c",ex[j]);
sound(3000+j);
delay(30);
nosound();
}
for(m=0;m<40;m++)
{
textcolor(10); gotoxy(20+m,13);
cprintf("%c",ex3[m]);
sound(1800+m);
delay(30);
nosound();
}
for(k=0;k<34;k++)
{
textcolor(4); gotoxy(20+k,14);
cprintf("%c",ex1[k]);
sound(2000+k);
delay(30);
nosound();
}
for(l=0;l<40;l++)
{
textcolor(3); gotoxy(20+l,15);
cprintf("%c",ex2[l]);
sound(2500+l);
delay(30);
nosound();
}
window(10, 10, 80, 25);
printf("PRESS ANY KEY.");
getch();
outportb(p,0);
exit(0);
}
case 'E':
if((a||b||c||d||e||f||g||h)==1)
{
clrscr();
textcolor(10); gotoxy(20,12);
cprintf("PLEASE SHUT DOWN ALL THE EQUIPMENTS.");
sound(200);
delay(500);
nosound();
delay(3000);
break;
}
else
{
clrscr();
for(j=0;j<23;j++)
{
textcolor(5); gotoxy(20+j,12);
cprintf("%c",ex[j]);
sound(3000+j);
delay(30);
nosound();
}
for(m=0;m<23;m++)
{
textcolor(3); gotoxy(20+m,13);
cprintf("%c",ex3[m]);
sound(1800+m);
delay(30);
nosound();
}
for(k=0;k<34;k++)
{
textcolor(11); gotoxy(20+k,14);
cprintf("%c",ex1[k]);
sound(2000+k);
delay(30);
nosound();
}
for(l=0;l<40;l++)
{
textcolor(12); gotoxy(20+l,15);
cprintf("%c",ex2[l]);
sound(2500+l);
delay(30);
nosound();
}
textcolor(12+BLINK);
gotoxy(40,40);
cprintf("PRESS ANY KEY.");
getch();
outportb(p,0);
exit(0);
}
default:
clrscr();
sound(500);
delay(100);
nosound();
textcolor(9); gotoxy(30,12);
cprintf("INVALID KEY PRESSED.");
textcolor(11); gotoxy(33,14);
cprintf("WAIT FOR 2 SECONDS.");
delay(3000);
break;
}
main();
}
void tone(void)
{
sound(1000);
delay(100);
nosound();
}
0 comments:
Post a Comment