<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>electrofriends.com &#187; Computer Programming</title>
	<atom:link href="http://electrofriends.com/category/projects/computer-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://electrofriends.com</link>
	<description>...bringing innovative minds together</description>
	<lastBuildDate>Fri, 30 Apr 2010 05:54:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Sudoku Solver using C++</title>
		<link>http://electrofriends.com/projects/computer-programming/sudoku-solver-using-c/</link>
		<comments>http://electrofriends.com/projects/computer-programming/sudoku-solver-using-c/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 10:01:11 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[C codes]]></category>
		<category><![CDATA[c graphics]]></category>
		<category><![CDATA[download codes]]></category>
		<category><![CDATA[Sudoku Solver]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=249</guid>
		<description><![CDATA[You have seen it in the news papers, you have seen it in the magazines or in the web sites, you might have sat hours &#8216;n hours to solve it. Yes, it is the king of all number puzzles, it is &#8220;SUDOKU&#8221;.
We bring to you the ultimate solution for all your struggles, The SUDOKU Solver.
As [...]]]></description>
			<content:encoded><![CDATA[<p>You have seen it in the news papers, you have seen it in the magazines or in the web sites, you might have sat hours &#8216;n hours to solve it. Yes, it is the king of all number puzzles, it is &#8220;SUDOKU&#8221;.</p>
<p>We bring to you the ultimate solution for all your struggles, The SUDOKU Solver.</p>
<p>As you know, now a days mathematical puzzle-SUDOKU is in boom all over the world. Sudoku is a 9X9 matrix with nine 3&#215;3 sub-matrices, that we need to fill by entering the numbers from 1 through 9, without the repetition of the a number in the rows, columns or in the sub matrices.</p>
<div id="attachment_250" class="wp-caption aligncenter" style="width: 285px"><img class="size-full wp-image-250" title="Figure: 1- Sudoku Problem" src="http://electrofriends.com/wp-content/uploads/2008/11/sudoku.gif" alt="Figure: 1- Sudoku Problem" width="275" height="218" /><p class="wp-caption-text">Figure: 1- Sudoku Problem</p></div>
<p>We can get the Sudoku puzzle in ease by different means, as discussed. You might have struggled a lot to solve the same. To be true, even me too. Here I developed a fast and robust package, that solves the puzzles, that are not easy to solve by hands. It will solve the Sudoku entered in fraction of a milli-second and will display the solved result.</p>
<div id="attachment_251" class="wp-caption aligncenter" style="width: 292px"><img class="size-full wp-image-251" title="Figure: 2 - Sudoku Result " src="http://electrofriends.com/wp-content/uploads/2008/11/sudoku_ans.gif" alt="Figure: 2 - Sudoku Result " width="282" height="225" /><p class="wp-caption-text">Figure: 2 - Sudoku Result </p></div>
<p style="text-align: center;"><a href="http://electrofriends.com/wp-content/uploads/2008/11/sudoku.zip">Click here to download the executable files</a></p>
<p><a href="http://electrofriends.com/wp-content/uploads/2008/11/sudoku.zip"></a> When the code executes, a blank Sudoku will be displayed with 9&#215;9 red boxes. The user is needed to enter the numbers corresponding to the source puzzle (Figure 1). To enter this, user should use the arrow keys to cruse to the required box. The selected box will be highlighted with a blue boundary. You have to enter the number through the keyboard. Once you have done entering all the numbers in the puzzle just hit the &#8216;Enter&#8217; key on the keyboard till you get the solved result (Figure 2). If the Sudoku cannot be solved by this program a message will be displayed telling that the given puzzle cannot be solved.</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/projects/computer-programming/sudoku-solver-using-c/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>Shuffle game using C++</title>
		<link>http://electrofriends.com/projects/computer-programming/shuffle-game-using-c/</link>
		<comments>http://electrofriends.com/projects/computer-programming/shuffle-game-using-c/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 09:51:40 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[c graphics]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[game programming]]></category>
		<category><![CDATA[Mouce programming]]></category>
		<category><![CDATA[Shuffle game]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=245</guid>
		<description><![CDATA[If you think playing a game as this is a child&#8217;s play, try a hand on this and think again. Its all about how you plan on making your next move. All the best, have fun.
Here is a simple game developed in C graphics which is called &#8216;The Shuffle Game&#8217;. We believe u have already [...]]]></description>
			<content:encoded><![CDATA[<p>If you think playing a game as this is a child&#8217;s play, try a hand on this and think again. Its all about how you plan on making your next move. All the best, have fun.</p>
<p>Here is a simple game developed in C graphics which is called &#8216;The Shuffle Game&#8217;. We believe u have already played many of such games where in you need to arrange scrambled pieces of a picture, alphabets or numbers. In the present program you have been given a matrix of 16 squares of which 15 are assigned with 15 different numbers and 1 is left out blank (empty space for movement of the remaining boxes) which are all shuffled. All you have to do is arrange these numbers in order as shown in the picture given below. The number of moves and the number that have been arranged by you in the proper position will be continuously displayed on the screen.  The controls  are as given below.</p>
<p><strong> Controls:</strong></p>
<p>You can move the boxes by using the arrow keys on your keyboard or by simply clicking on the box which you want to move into the empty space. While using the arrow keys, if you want to move the box left to the empty space just hit the left arrow button. Similarly you can move the boxes on the top, bottom or right of the empty box by hitting the up, down or right arrows respectively. In case you want to restart the game all over again just click the &#8216;RESTART&#8217; button or if you want to quit the game, all you have to do is to click the &#8216;EXIT&#8217; button on the screen.</p>
<div id="attachment_246" class="wp-caption aligncenter" style="width: 373px"><img class="size-full wp-image-246" title="Shuffle game using C++" src="http://electrofriends.com/wp-content/uploads/2008/11/shuffle.jpg" alt="Shuffle game using C++" width="363" height="285" /><p class="wp-caption-text">Shuffle game using C++</p></div>
<p><strong>Source code:</strong></p>
<p>#include&lt;stdio.h&gt;<br />
#include&lt;stdlib.h&gt;<br />
#include&lt;conio.h&gt;<br />
#include&lt;graphics.h&gt;<br />
#include&lt;dos.h&gt;<br />
#include&lt;alloc.h&gt;<br />
#include&lt;process.h&gt;<br />
union REGS in,out;<br />
void *buf;<br />
int size,count=0,px,py,rnd[4][4],correct=0;</p>
<p>float octave [7]={130.81,146.83,164.81,174.61,196,220,246.94};</p>
<p>int callmouse()<br />
{    in.x.ax=1;<br />
int86(51,&amp;in,&amp;out);<br />
return 1;</p>
<p>}<br />
void mouseposi(int &amp;xpos,int &amp;ypos,int &amp;click)<br />
{   in.x.ax=3;<br />
int86(51,&amp;in,&amp;out);<br />
click=out.x.bx;<br />
xpos=out.x.cx;<br />
ypos=out.x.dx;<br />
return ;<br />
}<br />
int  mousehide()<br />
{<br />
in.x.ax=2;<br />
int86(51,&amp;in,&amp;out);<br />
return 1;<br />
}<br />
void done(void)<br />
{<br />
int i,j;<br />
mousehide();<br />
j=0;<br />
int n;<br />
for(i=1;i&lt;=15;i++)<br />
{<br />
n=random(7);<br />
sound(octave[n]*4);<br />
delay(300);<br />
setfillstyle(1,2);<br />
bar(42+j,425,68+j,455);<br />
setfillstyle(1,0);<br />
bar(68+j,425,72+j,455);<br />
j=j+29;<br />
}<br />
nosound();<br />
delay(1000);<br />
for(j=0;j&lt;382;j+=2)<br />
{<br />
for(i=0;i&lt;575;i+=2)<br />
{<br />
putpixel(26+i,25+j,4);<br />
putpixel(26+i,460-j,4);<br />
putpixel(25+j*3/4,28+i*3/4,2);<br />
putpixel(595-j*3/4,458-i*3/4,2);<br />
delay(0);<br />
}<br />
}<br />
delay(1000);<br />
settextstyle(1,0,5);<br />
setcolor(14);</p>
<p>outtextxy(320,300,&#8221;http://electrofriends.com&#8221;);<br />
outtextxy(321,300,&#8221;http://electrofriends.com&#8221;);<br />
delay(500);<br />
getch();<br />
exit(0);<br />
}<br />
checknum(int mat[4][4])<br />
{<br />
int k=0,i,j;<br />
correct=0;<br />
for(i=0;i&lt;=3;i++)<br />
{<br />
for(j=0;j&lt;=3;j++)<br />
{<br />
k++;<br />
if(k==mat[i][j])<br />
correct++;<br />
}<br />
}<br />
gotoxy(10,11);<br />
printf(&#8220;NUMBERS ARE IN CORRECT POSITION IS ..: %d  &#8220;,correct);<br />
if(correct==15)<br />
{<br />
bar(130,40,480,80);<br />
settextstyle(1,0,4);<br />
outtextxy(300,60,&#8221;CONGRAGULATIONS !&#8221;);<br />
done();<br />
}<br />
else<br />
{<br />
bar(20,415,480,463);<br />
j=0;<br />
for(i=1;i&lt;=correct;i++)<br />
{<br />
setfillstyle(1,1);<br />
bar(42+j,425,68+j,455);<br />
setfillstyle(1,0);<br />
bar(68+j,425,72+j,455);<br />
j=j+29;<br />
}<br />
}<br />
return 0;<br />
}</p>
<p>void  move(int &amp;a,int &amp;b,int &amp;c,int &amp;d,int &amp;w,int &amp;x,int &amp;y,int &amp;z,int &amp;num)<br />
{<br />
if(a&gt;192 &amp;&amp; b&gt;190 &amp;&amp; c&lt;403 &amp;&amp; d&lt;404)<br />
{<br />
sound(600);<br />
count++;<br />
gotoxy(10,9);<br />
printf(&#8220;NUMBER OF MOVES..: %d   &#8220;,count);<br />
mousehide();<br />
size=imagesize(a,b,c,d);<br />
free(buf);<br />
buf=malloc(size);<br />
getimage(a,b,c,d,buf);<br />
bar(a,b,c,d);<br />
putimage(w,x,buf,COPY_PUT);<br />
w=a;<br />
x=b;<br />
y=c;<br />
z=d;<br />
if(num==1)<br />
{<br />
rnd[px][py]=rnd[px+1][py];<br />
rnd[px+1][py]=0;<br />
px++;<br />
}<br />
else if(num==2)<br />
{<br />
rnd[px][py]=rnd[px-1][py];<br />
rnd[px-1][py]=0;<br />
px&#8211;;<br />
}<br />
else if(num==3)<br />
{<br />
rnd[px][py]=rnd[px][py+1];<br />
rnd[px][py+1]=0;<br />
py++;<br />
}<br />
else if(num==4)<br />
{<br />
rnd[px][py]=rnd[px][py-1];<br />
rnd[px][py-1]=0;<br />
py&#8211;;<br />
}<br />
checknum(rnd);<br />
callmouse();<br />
delay(40);<br />
nosound();<br />
}<br />
return ;<br />
}</p>
<p>main()<br />
{<br />
int a1,b1,cl,a,b,c,d,w,x,y,z,key,p=0,q=0;<br />
int g=DETECT,m,ext=0,rst=0,rx,ry,num,i,j;<br />
initgraph(&amp;g,&amp;m,&#8221;c:\\TC\\bgi&#8221;);<br />
randomize();<br />
gotoxy(50,9);<br />
printf(&#8220;http://electrofriends.com&#8221;);</p>
<p>do<br />
{<br />
correct=0;<br />
count=0;<br />
gotoxy(10,9);<br />
printf(&#8220;NUMBER OF MOVES..: %d   &#8220;,count);</p>
<p>gotoxy(10,11);<br />
printf(&#8220;NUMBERS ARE IN CORRECT POSITION IS ..: %d  &#8220;,correct);<br />
setfillstyle(SOLID_FILL,4);<br />
setcolor(15);<br />
for(j=200;j&lt;360;j+=50)<br />
{<br />
for(i=200;i&lt;365;i+=50)<br />
{<br />
rectangle(j-1,i-1,j+46,i+46);<br />
bar(j,i,j+45,i+45);<br />
}<br />
}<br />
rectangle(192,190,403,404);<br />
settextstyle(1,0,3);<br />
for(i=0;i&lt;=3;i++)<br />
{<br />
for(j=0;j&lt;=3;j++)<br />
{<br />
rnd[i][j]=0;<br />
}<br />
}<br />
for(i=0;i&lt;=15;i++)<br />
{<br />
do<br />
{<br />
rx=random(4);<br />
ry=random(4);<br />
}  while(rnd[rx][ry]);<br />
rnd[rx][ry]=i;<br />
}<br />
char ab[10];<br />
settextjustify(CENTER_TEXT,CENTER_TEXT);<br />
q=p=0;<br />
for(i=0;i&lt;=3;i++)<br />
{<br />
for(j=0;j&lt;=3;j++)<br />
{<br />
if(rnd[i][j]!=0)<br />
{<br />
sprintf(ab,&#8221;%d&#8221;,rnd[i][j]);<br />
outtextxy(225+p,217+q,ab);<br />
}<br />
else<br />
{<br />
setfillstyle(1,0);<br />
px=i;py=j;<br />
bar(199+p,199+q,247+p,247+q);<br />
w=199+p;<br />
x=199+q;<br />
y=247+p;<br />
z=247+q;<br />
}<br />
p+=50 ;<br />
}<br />
p=0;<br />
q+=50 ;<br />
}<br />
bar(130,40,480,80);<br />
bar(10,425,480,455);<br />
setfillstyle(SOLID_FILL,4);<br />
rectangle(534,374,591,411);<br />
bar(535,375,590,410);<br />
outtextxy(561,390,&#8221;EXIT&#8221;);<br />
rectangle(484,419,591,456);<br />
bar(485,420,590,455);<br />
outtextxy(538,433,&#8221;RESTART&#8221;);<br />
setcolor(4);<br />
rectangle(10,10,610,470);<br />
rectangle(15,15,605,465);<br />
setcolor(14);<br />
rectangle(12,12,607,467);<br />
settextstyle(1,0,4);<br />
outtextxy(300,60,&#8221;SHUFFLE GAME&#8221;);<br />
line(150,85,450,85);</p>
<p>j=0;<br />
delay(1500);<br />
int n;<br />
for(i=1;i&lt;=15;i++)<br />
{<br />
n=random(7);<br />
sound(octave[n]*4);<br />
delay(300);<br />
setfillstyle(1,2);<br />
bar(42+j,425,68+j,455);<br />
setfillstyle(1,0);<br />
bar(68+j,425,72+j,455);<br />
j=j+29;<br />
}<br />
nosound();<br />
setfillstyle(SOLID_FILL,0);<br />
bar(30,425,480,455);<br />
settextstyle(2,0,5);<br />
outtextxy(250,425,&#8221;YOU CAN USE ARROW BUTTONS OR MOUSE TO MOVE BLOCKS.&#8221;);<br />
outtextxy(250,450,&#8221;      PRESS ANY KEY TO START&#8230;&#8230;..&#8221; );</p>
<p>getch();<br />
bar(20,415,480,463);<br />
callmouse();<br />
do<br />
{<br />
gotoxy(10,20);<br />
mouseposi(a1,b1,cl);<br />
if(a1&gt;w &amp;&amp; a1&lt;y &amp;&amp; b1&gt;x+50 &amp;&amp; b1&lt;z+50 &amp;&amp; cl==1)<br />
{<br />
num=1;<br />
move(w,x+50,y,z+50,w,x,y,z,num);                   //up<br />
}<br />
if(a1&gt;w &amp;&amp; a1&lt;y &amp;&amp; b1&gt;x-50 &amp;&amp; b1&lt;z-50 &amp;&amp; cl==1)<br />
{<br />
num=2;<br />
move(w,x-50,y,z-50,w,x,y,z,num);              //down<br />
}<br />
if(a1&gt;w+50 &amp;&amp; a1&lt;y+50 &amp;&amp; b1&gt;x &amp;&amp; b1&lt;z &amp;&amp; cl==1)<br />
{<br />
num=3;<br />
move(w+50,x,y+50,z,w,x,y,z,num);                   //left<br />
}<br />
if(a1&gt;w-50 &amp;&amp; a1&lt;y-50 &amp;&amp; b1&gt;x &amp;&amp; b1&lt;z &amp;&amp; cl==1)<br />
{<br />
num=4;<br />
move(w-50,x,y-50,z,w,x,y,z,num);                   //right<br />
}<br />
if(kbhit())<br />
{<br />
key=getch();<br />
switch(key)<br />
{<br />
case 72: num=1;<br />
move(w,x+50,y,z+50,w,x,y,z,num);           //up<br />
break;<br />
case 80: num=2;<br />
move(w,x-50,y,z-50,w,x,y,z,num);           //down<br />
break;<br />
case 75: num=3;<br />
move(w+50,x,y+50,z,w,x,y,z,num);          //left<br />
break;<br />
case 77: num=4;<br />
move(w-50,x,y-50,z,w,x,y,z,num);          //right<br />
break;<br />
}<br />
}</p>
<p>if((a1&gt;535 &amp;&amp; a1&lt;590 &amp;&amp; b1&gt;375 &amp;&amp; b1&lt;410 &amp;&amp; cl==1) || key==27)<br />
done();<br />
rst=0;<br />
if(a1&gt;485 &amp;&amp; a1&lt;590 &amp;&amp; b1&gt;420 &amp;&amp; b1&lt;455 &amp;&amp; cl==1 )<br />
rst=1;<br />
} while(rst==0);<br />
} while(rst!=0);<br />
closegraph();<br />
}</p>
<p>If you find difficult to compile the code, <a href="http://electrofriends.com/wp-content/uploads/2008/11/shuffle.zip">Download source code, executable file and supporting files here.</a></p>
<p>You have seen it, you have played it, you have seen the source code. Now its your turn to show us how creative your thinking is!! We hope you have got all the ideas that you need to build such a game with C graphic. If you are successful do send us a copy of the game. We will see through that your name comes on this site.</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/projects/computer-programming/shuffle-game-using-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Device Switching Using PC’s  Parallel Port</title>
		<link>http://electrofriends.com/projects/computer-programming/device-switching-using-pc%e2%80%99s-parallel-port/</link>
		<comments>http://electrofriends.com/projects/computer-programming/device-switching-using-pc%e2%80%99s-parallel-port/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 09:30:15 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[16-line Decoder/De-Multiplexer]]></category>
		<category><![CDATA[C++ prpgram]]></category>
		<category><![CDATA[Device Switching]]></category>
		<category><![CDATA[DM74LS154]]></category>
		<category><![CDATA[Interfacing Parallel Port]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=227</guid>
		<description><![CDATA[Imagine the convenience, if we could control different devices at home/industry by using a single PC. Our project aims at the same and could be used to control the printer power, loads &#38; other household electrical appliances. The circuit comprises decoder, inverter, latch &#38; relay driver sections. To control these equipments we are using PC’s [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine the convenience, if we could control different devices at home/industry by using a single PC. Our project aims at the same and could be used to control the printer power, loads &amp; other household electrical appliances. The circuit comprises decoder, inverter, latch &amp; relay driver sections. To control these equipments we are using PC’s Parallel port. The program of controlling  is  written in C language. It is compiled using Turbo C compiler.</p>
<p>The project though a bit expensive, is very efficient in control of real world peripherals.</p>
<p><strong>Contents:</strong></p>
<ol>
<li>INTRODUCTION</li>
<li>PARTS LIST</li>
<li>BLOCK DIAGRAM</li>
<li>COMPONENT DESCRIPTION
<ul>
<li>Parallel Port</li>
<li>IC 74LS154</li>
<li>IC 74LS74</li>
<li>1C 74 LS05</li>
<li>1C ULN 2803</li>
<li>Relay</li>
</ul>
</li>
<li>CIRCUIT DESCRIPTION AND WORKING</li>
<li>SOFTWARE PROGRAM</li>
<li>CONCLUSION</li>
</ol>
<p><strong>INTRODUCTION:</strong></p>
<p>The PC parallel port is an expensive yet a powerful platform for implementing projects dealing with the control of real-world peripherals. This port can be used to control the printer as also household and other electrical appliances. The computer program through the interface circuit controls the relays, which, in turn, switch the appliances on or off.</p>
<p>The parallel port has 12 outputs including 8 data lines and 4 control lines. The circuit described here can be used to control up to 255 electrical appliances using only eight data lines from the parallel port. Besides, the software program allows the users to know the current status of the loads.<br />
<strong><br />
PARTS LIST:<br />
</strong><br />
Semiconductors:<br />
ICl, IC2, IC3               &#8211; 74LS154 l-of-16 decoder<br />
IC4, IC5, IC6              &#8211; 74LSO5 inverter<br />
IC7-ICI4                     &#8211; 74LS74 D-type flip/flop<br />
ICI5, IC16                   &#8211; ULN2803 octal Darlington array driver<br />
Misc.<br />
Power supply               &#8211; 5V regulated DC, 12VregulatedDC<br />
Relay                           &#8211; 12V,200-ohm, lC/O SPDT</p>
<p><strong>BLOCK DIAGRAM:</strong></p>
<p>The block diagram in Fig. 1 depicts the main components of the switching system for 255 electrical loads using PC. The control command to switch on/off the appliances is given through the keyboard. The software program scans the input and as per the input command, the data is available at the parallel port.</p>
<div id="attachment_228" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-228" title=" FIg 1. Block Diagram" src="http://electrofriends.com/wp-content/uploads/2008/11/block2.jpg" alt=" FIg 1. Block Diagram" width="500" height="213" /><p class="wp-caption-text"> FIg 1. Block Diagram</p></div>
<p>Out of eight bits, first four bits (D0 through D3) are data signal bits and the remaining four bits (D4 through D7) are used as control signals. Control signals are given to decoder 1. The output of decoder 1 is given to Enable pins of decoders 2 and 3. Data signals are given to both decoders 2 and 3. The outputs of decoders 2 and 3 are inverted and fed to a D-type flip/flop that is used to latch the data. The latched data output is given to relay driver ICs ULN2803. The relay drivers drive the relays for switching the appliances.</p>
<p><strong> COMPONENT DESCRIPTION:</strong></p>
<p><strong> 1. THE PARALLEL PORT:</strong></p>
<p>The parallel port or line printer terminal (LPT) port is a 25-pin D-type female connector available at the back of your PC. A basic IBM PC usually comes with one or two LPT ports. The original parallel port, called standard parallel port (SPP), is a bundle of three ports (or registers), namely, data port, status port, and control port. Pins 2 through 9 form the 8-bit data port. This port is purely a write-only port. This means it can be used only to output some data through it. Pins I, 14, 16, and 17 form the control port, which is capable of reading/writing. Pins 10 through 13 and pin 15 together form the status port. The status port is a read-only port. The details of 25-pin parallel port are given in Table 1.</p>
<div id="attachment_229" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-229" title=" TABLE 1: Parallel Port Pin Details" src="http://electrofriends.com/wp-content/uploads/2008/11/pindetails.jpg" alt=" TABLE 1: Parallel Port Pin Details" width="500" height="399" /><p class="wp-caption-text"> TABLE 1: Parallel Port Pin Details</p></div>
<p>The base address of the first parallel port (LPT1) is 0378 in hexadecimal (hex) notation (or 888 in decimal notation). The base address of the second parallel port (LPT2) is 0278 in hex. In this project, we&#8217;ve used only LPT1.</p>
<p><strong> 2. DM74LS154 : 4-LINE TO 16-LINE DECODER / DE-MULTIPLEXER:</strong></p>
<p>Each of these 4-line-to-16-line decoders utilizes TTL circuitry to decode four binary-coded inputs into one of six-teen mutually exclusive outputs when both the strobe inputs, GI and G2, are LOW. The de-multiplexing function is performed by using the 4 input lines to address the out-put line, passing data from one of the strobe inputs with the other strobe input LOW. When either strobe input is HIGH, all outputs are HIGH. These de-multiplexers are ideally suited for implementing high-performance memory decoders.<br />
All inputs are buffered and input clamping diodes are provided to minimize transmission line effects and thereby simplify system design.</p>
<p><strong>3. 74LS74 : DUAL D-TYPE POSITIVE-EDGE-TRIGGERED FLIP-FLOPS:</strong></p>
<p>These devices contain two independent D-type positive-edge triggered flip-flops. A low level at the preset or clear inputs sets or resets the outputs regardless of the levels of the other inputs. When preset and clear are inactive (high), data at the D input meeting the setup time requirements are transferred to the outputs on the positive-going edge of the clock pulse. Clock triggering occurs at a voltage level and is not directly related to the rise time of the clock pulse. Following the hold time interval, data at the D input may be changed without affecting the levels at the outputs.</p>
<p><strong>4. HEX INVERTER:</strong></p>
<p>It is used for inversion of input signal. Since outputs from the de-multiplexers are active low, we invert them. This IC has 6 not-gates and hence called a hex-inverter.</p>
<p><strong>5. ULN-2803 : OCTAL PERIPHERAL DRIVER ARRAYS:</strong></p>
<p>The eight NPN Darlington connected transistors in this family of arrays are ideally suited for interfacing between low logic level digital circuitry (such as TTL, CMOS or PMOS/NMOS) and the higher current/voltage requirements of lamps, relays, printer hammers or other similar loads for a broad range of computer, industrial, and consumer applications. All devices feature open-collector outputs and freewheeling clamp diodes for transient suppression. The ULN2803 is designed to be compatible with standard TTL families while the ULN2804 is optimized for 6 to 15volt high-level CMOS or PMOS.</p>
<p><strong>6. RELAYS:</strong></p>
<p>The relay is a device by means of which an electrical circuit can be controlled (opened or closed) by sensing a change in the circuit in which it is connected. The relays can be either electromagnetic or electronic. In this circuit the electromagnetic relay is used to connect or disconnect the supply to the appliance to be controlled. It works on the principle of electromagnetic attraction and electromagnetic induction. These relays can be actuated by AC or DC quantities. In these relays there are one or more coils, movable elements, contact systems etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/projects/computer-programming/device-switching-using-pc%e2%80%99s-parallel-port/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Lexical Analyzer</title>
		<link>http://electrofriends.com/projects/computer-programming/lexical-analyzer/</link>
		<comments>http://electrofriends.com/projects/computer-programming/lexical-analyzer/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 07:37:32 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[C codes]]></category>
		<category><![CDATA[characters to tokens]]></category>
		<category><![CDATA[Lexical Analyzer]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=223</guid>
		<description><![CDATA[Lexical analyzer converts stream of input characters into a stream of tokens. The different tokens that our lexical analyzer identifies are as follows:
KEYWORDS: int, char, float, double, if, for, while, else, switch, struct, printf, scanf, case, break, return, typedef, void
IDENTIFIERS: main, fopen, getch etc
NUMBERS: positive and negative integers, positive and negative floating point numbers.
OPERATORS: +, [...]]]></description>
			<content:encoded><![CDATA[<p>Lexical analyzer converts stream of input characters into a stream of tokens. The different tokens that our lexical analyzer identifies are as follows:</p>
<p>KEYWORDS: int, char, float, double, if, for, while, else, switch, struct, printf, scanf, case, break, return, typedef, void</p>
<p>IDENTIFIERS: main, fopen, getch etc</p>
<p>NUMBERS: positive and negative integers, positive and negative floating point numbers.</p>
<p>OPERATORS: +, ++, -, &#8211;, ||, *, ?, /, &gt;, &gt;=, &lt;, &lt;=, =, ==, &amp;, &amp;&amp;.</p>
<p>BRACKETS: [ ], { }, ( ).</p>
<p>STRINGS : Set of characters enclosed within the quotes</p>
<p>COMMENT LINES: Ignores single  line, multi line comments</p>
<p>For tokenizing into identifiers and keywords we incorporate a symbol table which initially consists of predefined keywords. The tokens are read from an input file. If the encountered token is an identifier or a keyword the lexical analyzer will look up in the symbol table to check  the existence  of the respective token. If an entry does exist then we proceed to the next  token. If not then that particular  token along with the token value is written into the symbol table. The rest of the tokens are directly displayed by writing into an output file.</p>
<p>The output file will consist of all the tokens present in our input file along with their respective token values.</p>
<p><strong>INTRODUCTION:</strong></p>
<p>Lexical analysis involves scanning the program to be compiled and recognizing the tokens that make up the source statements Scanners or lexical analyzers are usually designed to recognize keywords , operators , and identifiers , as well as integers, floating point numbers , character strings , and other  similar items that are written as part of the source program . The exact set of  tokens to be recognized of course, depends upon the programming language being used to describe it.</p>
<p>A sequence of input characters that comprises a single token is called a lexeme. A lexical analyzer can insulate a parser from the lexeme representation of tokens. Following are the list of functions that lexical analyzers perform.</p>
<p><strong>Removal of white space and  comment :</strong></p>
<p>Many languages allow “white space” to appear between tokens. Comments can likewise be ignored by the parser and translator , so they may also be treated as white space. If white space is eliminated by the lexical analyzer, the parser will never have to consider it.</p>
<p><strong>Constants :</strong></p>
<p>An integer constant is a sequence of digits, integer constants can be allowed by adding productions to the grammar for expressions, or by creating a token for such constants . The job of collecting digits into integers is generally given to a lexical analyzer because numbers can be treated as single units during translation. The lexical analyzer passes both the token and attribute to the parser.<br />
<strong><br />
Recognizing identifiers and keywords :</strong></p>
<p>Languages use identifiers as names of variables, arrays and functions. A grammar for a language often treats an identifier as a token. Many languages use fixed character strings such as begin, end , if, and so on, as punctuation marks or to identify certain constructs. These character strings, called keywords, generally satisfy the rules for forming identifiers.</p>
<p><strong>SYSTEM ANALYSIS:</strong></p>
<p>The operating  system used is MS-DOS.</p>
<p><strong>MS-DOS : </strong>The MS-DOS is a single user, single process, single processor operating system. Due to the confinement of the device dependent code into one layer, the porting of MS-DOS has theoretically been reduced to writing  of the BIOS code for the new hardware. At the command level it provides a hierarchical file system, input output redirection, pipes and filters. User written commands can be invoked in the same way as the standard system commands, giving the appearance as if the basic system functionality has been extended.</p>
<p>Being a single user system, it provides only file protection and access control. The disk space is allocated in terms of a cluster of consecutive sectors. The command language of MS-DOS has been designed to allow the user to interact directly with the operating system using a CRT terminal. The principal use of the command language is to initiate the execution of commands and programs. A user program can be executed under MS-DOS by simply typing the name of the executable file of the user program at the DOS command prompt.</p>
<p>The programming language used here is C programming</p>
<p><strong>SYSTEM DESIGN:</strong></p>
<p><strong>Process:</strong></p>
<p>The lexical analyzer is the first phase of  a compiler. Its main task is to read the input characters and produce as output a sequence of tokens that the parser uses for syntax analysis. This interaction, summarized schematically in fig. a.</p>
<div id="attachment_224" class="wp-caption aligncenter" style="width: 496px"><img class="size-full wp-image-224" title="fig a. Process of lexical analyzer " src="http://electrofriends.com/wp-content/uploads/2008/11/block_1.gif" alt="fig a. Process of lexical analyzer " width="486" height="179" /><p class="wp-caption-text">fig a. Process of lexical analyzer </p></div>
<p>Upon receiving a “get next token “command from the parser, the lexical analyzer reads the input characters until it can identify next token.</p>
<p>Sometimes , lexical analyzers are divided into a cascade of two phases, the first called “scanning”, and the second “lexical analysis”.</p>
<p>The scanner is responsible for doing simple tasks, while the lexical analyzer proper does the more complex operations.</p>
<p>The lexical analyzer which we have designed takes the input  from a input file. It reads one character at a time from the input file, and continues to read until end of the file is reached. It recognizes the valid identifiers, keywords and specifies the token values of the keywords.</p>
<p>It also identifies the header files, #define statements, numbers, special characters, various relational and logical operators, ignores the white spaces and comments. It prints the output in a separate file specifying the line number .</p>
<p><strong>BLOCK DIAGRAM:</strong></p>
<div id="attachment_225" class="wp-caption aligncenter" style="width: 460px"><img class="size-full wp-image-225" title="fig b. Block diagram of the project" src="http://electrofriends.com/wp-content/uploads/2008/11/block_2.gif" alt="fig b. Block diagram of the project" width="450" height="198" /><p class="wp-caption-text">fig b. Block diagram of the project</p></div>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/projects/computer-programming/lexical-analyzer/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Doctor&#8217;s Diary using JSP Technology</title>
		<link>http://electrofriends.com/projects/computer-programming/doctors-diary-using-jsp-technology/</link>
		<comments>http://electrofriends.com/projects/computer-programming/doctors-diary-using-jsp-technology/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 07:08:41 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[Doctor's Diary]]></category>
		<category><![CDATA[J2EE(JSP)]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSP Technology]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=209</guid>
		<description><![CDATA[This is the model software from electrofriends.com. We successfully implemented the need and necessary concepts of a doctor, for his stand alone clinic. We hope this software package will definitely help the students, to get an idea about their academic projects.
For a doctor, it is absolutely difficult to keep all the details of his patients [...]]]></description>
			<content:encoded><![CDATA[<p>This is the model software from electrofriends.com. We successfully implemented the need and necessary concepts of a doctor, for his stand alone clinic. We hope this software package will definitely help the students, to get an idea about their academic projects.</p>
<p>For a doctor, it is absolutely difficult to keep all the details of his patients in such a manner that is easily retrievable in hardware domain, i.e. by keeping a booklet or file folder. So, it is the time to switch for a doctor from classic hardware book-keeping to the software domain, by storing all the details in Computer memories, databases, which are easy accessible at any time, every time. Before that, it should be implemented as the Academic projects in educational institutions. By that way, we are trying to help the students, by making the things easier. The most emerging technology, J2EE(JSP), SQL, JavaScript are the backbone of this project. This is the outcome of software professionals, from the knowledge city- Bengalooru. A student can get these codes and can find how the real time practical needs are made in such a sophisticated form and such a short size. The GUI developed is user- friendly and minimum computer knowledge is sufficient to handle the software, we can expect that now from doctor’s side on these days.</p>
<p>You can find the inner feature of the Doctor’s Diary, with static images of the Dynamic pages.</p>
<p>This software has mainly 3 modules.</p>
<ol>
<li>Entering the New patient to the clinic.</li>
<li>Manipulating with Old patient details.</li>
<li>Setting the personal details of Doctor.</li>
</ol>
<div id="attachment_210" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-210" title="Figure 1: Main page of Doctor's Diary." src="http://electrofriends.com/wp-content/uploads/2008/11/mainpage.gif" alt="Figure 1: Main page of Doctor's Diary." width="500" height="371" /><p class="wp-caption-text">Figure 1: Main page of Doctor</p></div>
<p>Here are the brief descriptions of each field. In the left side of the home page we have an array of features of the software, in the black background.</p>
<p><strong>1. New Patient:</strong></p>
<p>The very first option in the features’ list is the New Patient. Clicking the option will lead to the corresponding page in the main page of the software which will input the new patient details to the database (Shown in figure 2). An auto incrementing number display named Patient Id, will be the unique identification number for the patient. The Doctor can enter the Patient Name, address and other details. He also can enter the Symptoms and the Medicine Prescribed for the patient. These details are getting stored in the database under today’s date.</p>
<div id="attachment_211" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-211" title="Figure 2: New patient page of Doctor's Diary." src="http://electrofriends.com/wp-content/uploads/2008/11/new_patient.gif" alt="Figure 2: New patient page of Doctor's Diary." width="500" height="641" /><p class="wp-caption-text">Figure 2: New patient page of Doctor</p></div>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/projects/computer-programming/doctors-diary-using-jsp-technology/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Induction furnace control system</title>
		<link>http://electrofriends.com/projects/computer-programming/induction-furnace-control-system/</link>
		<comments>http://electrofriends.com/projects/computer-programming/induction-furnace-control-system/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 05:53:37 +0000</pubDate>
		<dc:creator>Ranjith</dc:creator>
				<category><![CDATA[Computer Programming]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[furnace control system]]></category>
		<category><![CDATA[Interfacing Parallel Port]]></category>
		<category><![CDATA[LM 335Z]]></category>
		<category><![CDATA[Opto isolator]]></category>
		<category><![CDATA[Precision temperature sensor]]></category>

		<guid isPermaLink="false">http://electrofriends.com/?p=201</guid>
		<description><![CDATA[This project is an attempted step towards resolving the manual problems in controlling Induction Furnace and provides control for it, using Artificial Intelligence at a very small scale. The project deals with a simple aspect of giving information about the Induction Furnace and their control. Initially it provided a system release manual power as much [...]]]></description>
			<content:encoded><![CDATA[<p>This project is an attempted step towards resolving the manual problems in controlling Induction Furnace and provides control for it, using Artificial Intelligence at a very small scale. The project deals with a simple aspect of giving information about the Induction Furnace and their control. Initially it provided a system release manual power as much as possible from control of Induction Furnace and can be handled with merely one person, if needed. Etymologically, idea of this project is to provide security to whole system of controlling in case of any emergency.</p>
<p>In project we will develop a system, which can control Induction furnace without any help of human side. The system will be capable of delivering message of over heating of blast furnace and can take decisions accordingly.</p>
<p>The project is prepared in order to control the “INDUCTION FURNACE” in the best and easiest possible way. This system can emerge as the pioneer step in implementation of “ARTIFICIAL   INTELLIGENCE” in control of induction furnace</p>
<p><strong>Induction furnace :</strong></p>
<p>The induction furnace plays an important role in steel plants producing high quality and stainless steels. In the field of iron casting and foundries the induction furnace is known as a standard.</p>
<p>Induction furnaces offer certain advantages over other furnace systems. They include:</p>
<p><strong>Higher Yield</strong>: The absence of combustion sources reduces oxidation losses that can be significant in production economics. This can amount to 2 to 7 percent yield savings in aluminum melting.</p>
<p><strong>Faster Start up</strong>: Full power from the power supply is available, instantaneously, thus reducing the time to reach working temperature. Cold charge-to-tap times of one to two hours are common.</p>
<p><strong>Automatic Operation</strong>: Precise automatic control of power reduces furnace manpower to that required only for charging, tapping, and metallurgical measurements.</p>
<p><strong>parallel port</strong></p>
<p><strong>How to connect circuits to parallel port ?</strong></p>
<p>PC parallel port is 25-pin D-shaped female connector in the back of the computer. It is normally used for connecting computer to printer, but many other types of hardware for that port is available today. Not all 25 are needed always. Usually you can easily do with only 8 output pins (data lines) and signal ground. I have presented those pins in the table below. Those output pins are adequate for many purposes.</p>
<p>pin           :    2       3        4         5        6        7        8          9<br />
function   :   D0    D1      D2      D3      D4      D5      D6        D7</p>
<p>Pins 18, 19, 20, 21, 22, 23, 24 and 25 are all ground pins.</p>
<p>Those data pins are TTL level output pins. This means that they put out ideally 0V when they are in low logic level (0) and +5V when they are in high logic level (1). In real world the voltages can be something different from ideal when the circuit is loaded. The output current capacity of the parallel port is limited to only few mill amperes.</p>
<p><strong>Reading the input pins in parallel port :</strong></p>
<p>PC parallel port has 5 input pins. The input pins can be read from the I/O address LPT port base address + 1.<br />
The meaning of the buts in byte you read from that I/O port:</p>
<p>D0: state not specified<br />
D1: state not specified<br />
D2: state not specified<br />
D3: state of pin 15 (ERROR) inverted<br />
D4: state of pin 13 (SELECTED)<br />
D5: state of pin 12 (PAPER OUT)<br />
D6: state of pin 10 (ACK)<br />
D7: state of pin 11 (BUSY) inverted</p>
<p>in = inportb(0&#215;379);  or in = inp(0&#215;379);</p>
<p>Where N is the data you want to output. The actual I/O port controlling command varies from compiler to compiler because it is not part of standardized C libraries.</p>
<p><strong>Interrupts :</strong></p>
<p>Most parallel ports are capable of detecting interrupt signals from a peripheral. The peripheral may use an interrupt to announce that it’s ready to receive a byte, or that it has a byte to send. To use interrupts, a parallel port must have an assigned interrupt-request level (IRQ). Conventionally, LPT1 uses IRQ7 and LPT2 uses IRQ5. But many sound cards use IRQ5, and because free IRQ levels can be scarce on a system, even IRQ7 may be reserved by another device. Some ports allow choosing other IRQ levels besides these two.</p>
<p>Many printer drivers and many other applications and drivers that access the parallel port don’t require parallel-port interrupts. If you select no IRQ level for a port, the port will still work in most cases, though sometimes not as efficiently, and you can use the IRQ level for something else.</p>
<p style="text-align: right;">By<br />
Prabhat kumar thakur, Ramayan patel, Tarun kumar das, Vijay dashore, Shikha khare<br />
Chhattrapati Shivaji Institute of Technology, Shivaji nagar,  Durg, (C.G.)</p>
<p style="text-align: left;">Circuit diagrams and source codes are given in the next page.</p>
]]></content:encoded>
			<wfw:commentRss>http://electrofriends.com/projects/computer-programming/induction-furnace-control-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
