You are on page 1of 9

HOME APPLIANCE CONTROL USING COMPUTER PARALLEL PORT

Introduction: - PC parallel port can be very useful I/O channel for connecting our own circuits to PC. The
PC's parallel port can be used to perform some very amusing hardware interfacing experiments. The port is
very easy to use when we first understand some basic tricks.
NOTE:1. Before connecting hardware isolate our hardware and parallel port by isolate example optocoupler.
2. Install software for input and output interfacing example port95.exe.
CIRCUIT DIAGRAM:-

PROGRAMING C :1. #include<stdio.h>


2. #include<conio.h>
3. #include<dos.h>
4. #include<graphics.h>
5. #include<stdlib.h>
6. void disp();
7. void main()
8. {
9. int gd=DETECT,gm;
10. clrscr();
11. outportb(0x378,0x00);
12. delay(50);
13. initgraph(&gd,&gm,"c:\\tc\\bgi");
14. setcolor(8);
15. rectangle(30,40,600,450);
16. setcolor(10);
17. settextstyle(1,0,7);
18. outtextxy(150,50,"B. K. BIET");
19. setcolor(5);
20. settextstyle(1,0,5);
21. outtextxy(40,150,"HOME APPLANSIS CONTROL");
22. setcolor(1);
23. settextstyle(1,0,1);
24. outtextxy(40,300,"GUID NAME:-");
25. outtextxy(40,350,"DINESH SONI");
26. outtextxy(350,300,"SUBMIT BY:-");
27. outtextxy(350,350,"1.LOKESH KUMAR PANWAR");
28. outtextxy(350,400,"2.RAJESH MALI");
29. delay(5000);
30. a:
31. clrscr();
32. cleardevice();
33. int i=0;
34. setcolor(11);
35. settextstyle(1,0,1);
36. outtextxy(200,100,"ENTER PASWARD");
37. printf("\n\n\n\n\n\n\n\n\t\t\t ");
38. scanf("%d",&i);
39. if(i==007)
40. {
41. disp();
42. }
43. else
44. {
45. goto a;
46. }
47. }

48. void disp()


49. {
50. int l=0,k=0,j=0,h=0,g=0,f=0,d=0,s=0;
51. char u,t;
52. b:
53. clrscr();
54. cleardevice();
55. setcolor(6);
56. settextstyle(1,0,1);
57. outtextxy(200,100,"x.ON/OFF EQUPMENT");
58. outtextxy(200,200,"y.HELP");
59. outtextxy(200,300,"z.EXIT");
60. t=getch();
61. switch(t)
62. {
63. case 'x':
64. p:
65. int inp=0;
66. clrscr();
67. cleardevice();
68. inp=inportb(0x378);
69. setcolor(YELLOW);
70. if(1==l%2)
71. {
72. outtextxy(150,50,"ON");
73. }
74. else
75. {
76. outtextxy(150,50,"OFF");
77. }
78. if(1==k%2)
79. {
80. outtextxy(150,100,"ON");
81. }
82. else
83. {
84. outtextxy(150,100,"OFF");
85. }
86. if(1==j%2)
87. {
88. outtextxy(150,150,"ON");
89. }
90. else
91. {
92. outtextxy(150,150,"OFF");
93. }
94. if(1==h%2)
95. {

96. outtextxy(150,200,"ON");
97. }
98. else
99. {
100.
outtextxy(150,200,"OFF");
101.
}
102.
if(1==g%2)
103.
{
104.
outtextxy(150,250,"ON");
105.
}
106.
else
107.
{
108.
outtextxy(150,250,"OFF");
109.
}
110.
if(1==f%2)
111.
{
112.
outtextxy(150,300,"ON");
113.
}
114.
else
115.
{
116.
outtextxy(150,300,"OFF");
117.
}
118.
if(1==d%2)
119.
{
120.
outtextxy(150,350,"ON");
121.
}
122.
else
123.
{
124.
outtextxy(150,350,"OFF");
125.
}
126.
if(1==s%2)
127.
{
128.
outtextxy(150,400,"ON");
129.
}
130.
else
131.
{
132.
outtextxy(150,400,"OFF");
133.
}
134.
setcolor(9);
135.
outtextxy(50,450,"ENTER 'b' FOR BACK WINDOW");
136.
outtextxy(50,50,"PRES q");
137.
outtextxy(50,100,"PRES w");
138.
outtextxy(50,150,"PRES e");
139.
outtextxy(50,200,"PRES r");
140.
outtextxy(50,250,"PRES t");
141.
outtextxy(50,300,"PRES y");
142.
outtextxy(50,350,"PRES u");
143.
outtextxy(50,400,"PRES i");

144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.

u=getche();
switch(u)
{
case 'q':
if(0==l%2)
{
int o1=0;
o1=inp+1;
outportb(0x378,o1);
}
else
{
int o1=0;
o1=inp-1;
outportb(0x378,o1);
}
l++;
break;
case 'w':
if(0==k%2)
{
int o1=0;
o1=inp+2;
outportb(0x378,o1);
}
else
{
int o1=0;
o1=inp-2;
outportb(0x378,o1);
}
k++;
break;
case 'e':
if(0==j%2)
{
int o1=0;
o1=inp+4;
outportb(0x378,o1);
}
else
{
int o1=0;
o1=inp-4;
outportb(0x378,o1);
}
j++;
break;

192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.

case 'r':
if(0==h%2)
{
int o1=0;
o1=inp+8;
outportb(0x378,o1);
}
else
{
int o1=0;
o1=inp-8;
outportb(0x378,o1);
}
h++;
break;
case 't':
if(0==g%2)
{
int o1=0;
o1=inp+16;
outportb(0x378,o1);
}
else
{
int o1=0;
o1=inp-16;
outportb(0x378,o1);
}
g++;
break;
case 'y':
if(0==f%2)
{
int o1=0;
o1=inp+32;
outportb(0x378,o1);
}
else
{
int o1=0;
o1=inp-32;
outportb(0x378,o1);
}
f++;
break;
case 'u':
if(0==d%2)
{

240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.

int o1=0;
o1=inp+64;
outportb(0x378,o1);
}
else
{
int o1=0;
o1=inp-64;
outportb(0x378,o1);
}
d++;
break;
case 'i':
if(0==s%2)
{
int o1=0;
o1=inp+128;
outportb(0x378,o1);
}
else
{
int o1=0;
o1=inp-128;
outportb(0x378,o1);
}
s++;
break;
case 'b':
goto b;
break;
}
goto p;
break;
case 'y':
m:
cleardevice();
outtextxy(50,250,"ENTER 'b' FOR BACK WINDOW");
u=getche();
if(u=='b')
{
goto b;
}
else
{
goto m;
}
break;
case 'z':

288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.

cleardevice();
setcolor(1);
settextstyle(7,0,5);
outportb(0x378,0x00);
outtextxy(200,200,"THANK YOU");
delay(1000);
closegraph();
exit(0);
break;
default:
goto b;
}
}

FINDING PORT ADDRES:STAP1:

SATP2:

STEP3:

STEP4:

You might also like