electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Good Site to learn Interfacing with C


Post new topic  Reply to topic    EDAboard.com Forum Index -> PC Programming and Interfacing -> Good Site to learn Interfacing with C
Author Message
electrojit



Joined: 16 Dec 2005
Posts: 46


Post30 Oct 2006 5:12   

Good Site to learn Interfacing with C


http://www.learn-c.com/

download the whole site with "Offline Explorer" and enjoy the contents offline at your convinence
Back to top
Google
AdSense
Google Adsense




Post30 Oct 2006 5:12   

Ads




Back to top
yogi



Joined: 08 Jan 2005
Posts: 345
Helped: 17


Post01 Nov 2006 12:37   

Good Site to learn Interfacing with C


read my experience in parallel port interfacing from yahoo group-booksbybibin
http://tech.groups.yahoo.com/group/booksbybibin/

Bibin John
www.bibinjohn.tk
Back to top
shabab



Joined: 03 Apr 2007
Posts: 64
Helped: 3


Post11 Apr 2007 8:54   

Re: Good Site to learn Interfacing with C


try this program
Code:
#include"stdio.h"
#include"conio.h"
#include"graphics.h"
#include"dos.h"
#include"stdlib.h"
#define esc 27
#define outport 0x378
#define ledon 0xff
#define ledoff 0x00
int static no[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
int c,f=0;
void button (int,int,int,int,char[]);
void blink (int,int,int,int);
void display (void);
void main (void)
{
int dr=DETECT,m,a,b;
initgraph(&dr,&m,"c:\\tc\\bgi");
char ch,name[10];
main:
cleardevice();
display();
button(80,75,130,100," A");
button(80,125,130,150," B");
button(80,175,130,200," C");
button(80,225,130,250," D");
button(80,275,130,300," E");
button(80,325,130,350," F");
button(80,375,130,400,"EXIT");
setcolor(1);
settextstyle(11,0,3);
outtextxy(140,390,"PRESS ESC TO EXIT");
outtextxy(140,90,"GLOW LED OF YOUR CHOICE");
outtextxy(140,140,"LED BLINKING");
outtextxy(140,190,"ROTATE LEFT");
outtextxy(140,240,"ROTATE RIGHT");
outtextxy(140,290,"ROTATE LEFT + RIGHT");
outtextxy(140,340,"ONE ON ONE OFF");
ch=getch();
if(ch==27)     //for exit
{
closegraph();
exit(0);
}
else
if(ch=='a' || ch=='A')   //Enter Led No       A
{
rep:
cleardevice();
display();
setcolor(1);
setfillstyle(1,0);
rectangle(100,100,550,300);     //black
floodfill(120,120,1);
setcolor(1);
rectangle(315,140,330,160);//small blue
setcolor(4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
setcolor(1);
settextstyle(10,0,1);
outtextxy(180,100,"ENTER LED NO 0 - 7");
gotoxy(41,10);
gets(name);
if(name[0]==48)      //led 0 glow
{
outportb(outport,no[0]);
setcolor(4);
setfillstyle(1,4);
floodfill(261,181,4);
}
if(name[0]==49)      //led 1 glow
{
outportb(outport,no[1]);
setcolor(4);
setfillstyle(1,4);
floodfill(281,181,4);
}
if(name[0]==50)      //led 2 glow
{
outportb(outport,no[2]);
setcolor(4);
setfillstyle(1,4);
floodfill(301,181,4);
}
if(name[0]==51)      //led 3 glow
{
outportb(outport,no[3]);
setcolor(4);
setfillstyle(1,4);
floodfill(321,181,4);
}
if(name[0]==52)      //led 4 glow
{
outportb(outport,no[4]);
setcolor(4);
setfillstyle(1,4);
floodfill(341,181,4);
}
if(name[0]==53)      //led 5 glow
{
outportb(outport,no[5]);
setcolor(4);
setfillstyle(1,4);
floodfill(361,181,4);
}
if(name[0]==54)      //led 6 glow
{
outportb(outport,no[6]);
setcolor(4);
setfillstyle(1,4);
floodfill(381,181,4);
}
if(name[0]==55)      //led 7 glow
{
outportb(outport,no[7]);
setcolor(4);
setfillstyle(1,4);
floodfill(401,181,4);
}
setcolor(1);
settextstyle(11,0,10);
outtextxy(210,350,"PRESS R TO RETURN TO MAIN");
outtextxy(240,370,"PRESS ESC TO EXIT");
ch=getch();
if(ch=='r' || ch=='R')
goto main;
else
if(ch==27)     //for exit
{
closegraph();
exit(0);
}
else
goto rep;
}                                // A END
              ////////// LED NO B
if(ch=='b' || ch=='B')
{

cleardevice();
display();
setcolor(1);
setfillstyle(1,0);
rectangle(100,100,550,300);     //black
floodfill(120,120,1);
setcolor(4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0


setcolor(14);
settextstyle(10,0,1);
outtextxy(145,100,"PRESS ANY KEY TO STOP");
setcolor(1);
settextstyle(11,0,10);
outtextxy(210,350,"PRESS R TO RETURN TO MAIN");
outtextxy(240,370,"PRESS ESC TO EXIT");
int a=4;
while(!kbhit())
{
//harware interface
outportb(outport,ledon);
setcolor(11);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
setfillstyle(1,a);
floodfill(261,181,11);
floodfill(281,181,11);
floodfill(301,181,11);
floodfill(321,181,11);
floodfill(341,181,11);
floodfill(361,181,11);
floodfill(381,181,11);
floodfill(401,181,11);
delay(800);
outportb(outport,ledoff);
a=0;
setcolor(11);
setfillstyle(1,a);
floodfill(261,181,11);
floodfill(281,181,11);
floodfill(301,181,11);
floodfill(321,181,11);
floodfill(341,181,11);
floodfill(361,181,11);
floodfill(381,181,11);
floodfill(401,181,11);
a=4;
delay(800);
}


ch=getch();
if(ch=='r' || ch=='R')
goto main;
else
if(ch==27)     //for exit
{
closegraph();
exit(0);
}
}                             ///////// B END
              //led no C
if(ch=='c' || ch=='C')
{
cleardevice();
display();
setcolor(1);
setfillstyle(1,0);
rectangle(100,100,550,300);     //black
floodfill(120,120,1);
setcolor(4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
setcolor(14);
settextstyle(10,0,1);
outtextxy(145,100,"PRESS ANY KEY TO STOP");
setcolor(1);
settextstyle(11,0,10);
outtextxy(210,350,"PRESS R TO RETURN TO MAIN");
outtextxy(240,370,"PRESS ESC TO EXIT");
c=401;
while(!kbhit())
{
setcolor(11);
setfillstyle(1,4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
floodfill(c,181,11);
delay(200);
setfillstyle(1,0);
floodfill(c,181,11);
delay(200);
c-=20;
if(c==241)
c=401;

// hardware
for(a=0;a<=7;a++)
{
outportb(outport,no[a]);
delay(800);
}
}
ch=getch();
if(ch=='r' || ch=='R')
goto main;
else
if(ch==27)     //for exit
{
closegraph();
exit(0);
}//////////////    c end
}
 //////////////////////   d
if(ch=='d' || ch=='D')
{
cleardevice();
display();
setcolor(1);
setfillstyle(1,0);
rectangle(100,100,550,300);     //black
floodfill(120,120,1);
setcolor(4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
setcolor(14);
settextstyle(10,0,1);
outtextxy(145,100,"PRESS ANY KEY TO STOP");
setcolor(1);
settextstyle(11,0,10);
outtextxy(210,350,"PRESS R TO RETURN TO MAIN");
outtextxy(240,370,"PRESS ESC TO EXIT");
c=261;
while(!kbhit())
{
setcolor(11);
setfillstyle(1,4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
floodfill(c,181,11);
delay(500);
setfillstyle(1,0);
floodfill(c,181,11);
delay(500);
c+=20;
if(c==421)
c=261;
// hard ware
for(a=7;a>=0;a--)
{
outportb(outport,no[a]);
delay(800);
}
}
ch=getch();
if(ch=='r' || ch=='R')
goto main;
else
if(ch==27)     //for exit
{
closegraph();
exit(0);
}///////////
}                   ////////// d end
 //////////////////////   e
if(ch=='e' || ch=='E')
{
cleardevice();
display();
setcolor(1);
setfillstyle(1,0);
rectangle(100,100,550,300);     //black
floodfill(120,120,1);
setcolor(4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
setcolor(14);
settextstyle(10,0,1);
outtextxy(145,100,"PRESS ANY KEY TO STOP");
setcolor(1);
settextstyle(11,0,10);
outtextxy(210,350,"PRESS R TO RETURN TO MAIN");
outtextxy(240,370,"PRESS ESC TO EXIT");
c=401;
while(!kbhit())
{
setcolor(11);
setfillstyle(1,4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
if(f==0)
{
floodfill(c,181,11);
delay(100);
setfillstyle(1,0);
floodfill(c,181,11);
delay(100);
c-=20;
if(c==241)
{
f=1;
c=261;
}
}
if(f==1)
{
floodfill(c,181,11);
delay(5);
setfillstyle(1,0);
floodfill(c,181,11);
delay(5);
c+=20;
if(c==421)
{
f=0;
c=401;
}
}
// hard ware
for(a=7;a>=0;a--)
{
outportb(outport,no[a]);
delay(800);
}
for(a=0;a<=7;a++)
{
outportb(outport,no[a]);
delay(800);
}
}
ch=getch();
if(ch=='r' || ch=='R')
goto main;
else
if(ch==27)     //for exit
{
closegraph();
exit(0);
}///////////
}                   ////////// e end
 //////////////////////   f
if(ch=='f' || ch=='F')
{
cleardevice();
display();
setcolor(1);
setfillstyle(1,0);
rectangle(100,100,550,300);     //black
floodfill(120,120,1);
setcolor(4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
setcolor(14);
settextstyle(10,0,1);
outtextxy(145,100,"PRESS ANY KEY TO STOP");
setcolor(1);
settextstyle(11,0,10);
outtextxy(210,350,"PRESS R TO RETURN TO MAIN");
outtextxy(240,370,"PRESS ESC TO EXIT");
while(!kbhit())
{
setcolor(11);
setfillstyle(1,4);
circle(400,180,5);//led 7
circle(380,180,5);//led 6
circle(360,180,5);//led 5
circle(340,180,5);//led 4
circle(320,180,5);//led 3
circle(300,180,5);//led 2
circle(280,180,5);//led 1
circle(260,180,5);//led 0
floodfill(401,181,11);
floodfill(361,181,11);
floodfill(321,181,11);
floodfill(281,181,11);
delay(500);
setfillstyle(1,0);
floodfill(401,181,11);
floodfill(361,181,11);
floodfill(321,181,11);
floodfill(281,181,11);
delay(500);
setfillstyle(1,4);
floodfill(381,181,11);
floodfill(341,181,11);
floodfill(301,181,11);
floodfill(261,181,11);
delay(500);
setfillstyle(1,0);
floodfill(381,181,11);
floodfill(341,181,11);
floodfill(301,181,11);
floodfill(261,181,11);
delay(500);

// hard ware

outportb(outport,no[0xaa]) ;
delay(800);
outportb(outport,no[0x55]) ;

}
ch=getch();
if(ch=='r' || ch=='R')
goto main;
else
if(ch==27)     //for exit
{
closegraph();
exit(0);
}///////////
}                   ////////// f end


getch();
closegraph();
}                  // main end

void display (void)
{
int i,f[10]={7,7,100,30,320,60,520,30,629,7};
setcolor(13);
setfillstyle(1,3);
rectangle(1,1,638,478);
floodfill(5,5,13);
setcolor(11);
setfillstyle(7,9);    /* Text Background  */
fillpoly(5,f);        /* Text Fillpoly  */
setcolor(14);
settextstyle(7,0,3);
outtextxy(170,6,"L E D - D I S P L A Y");
setcolor(1);
settextstyle(11,0,3);
outtextxy(150,445,"Copyright Hasan & Atif PRODUCTIONS 2006");
outtextxy(220,457,"  All Rights Reserved");
}

void button (int c1,int r1,int c2,int r2,char ch[])
{
setcolor(0);
rectangle(c1+1,r1+1,c2+2,r2+2);
setcolor(8);
rectangle(c1+2,r1+2,c2+1,r2+1);
setcolor(15);
rectangle(c1-1,r1-1,c2,r2);
setcolor(7);
setfillstyle(1,7);
rectangle(c1,r1,c2,r2);
floodfill(c1+5,r1+5,7);
setcolor(0);
outtextxy(c1+11,r1+7,ch);
}
void blink (int c1,int r1,int c2,int r2)
{
setcolor(8);
rectangle(c1-1,r1-1,c2-2,r2-2);
setcolor(0);
rectangle(c1-2,r1-2,c2-1,r2-1);
setcolor(15);
rectangle(c1,r1,c2+1,r2+1);
setcolor(7);
setfillstyle(1,7);
rectangle(c1,r1,c2,r2);
floodfill(c1+5,r1+5,7);
}
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PC Programming and Interfacing -> Good Site to learn Interfacing with C
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Site with my projects, translation of site into English (5)
A good DSP site! (4)
A good site to share (1)
good material to learn semiconductor basics (18)
some good rf and mw site (1)
good site for uP Electronics (2)
A Good Site For RF Design (6)
Good Electronics learning site (16)
good rf simulation software to learn working of rf circuits (29)
good web site for rf documents (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS