parallel port+graphic function in c langauge

Status
Not open for further replies.

pic16f84

Member level 4
Joined
Mar 11, 2006
Messages
78
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
libya
Activity points
2,054
visual c++ 6.0 outportb

hi
i needs the function to use the graphic function in the c language when interfacing pc
with parallel port
 

c++ how to program chm

unfortunately, graphics and port interfacing subjects in C language can be found rarely. i shearched many times before. but i did not find something worth.

there is a general C knowledge document here. i know you dont need it anyway.
but diversity is fine. you can examine.

And NOTE: if you managed to find about interfacing & graphic dont forget to share it here.

good luck
 

400180 r02

there is link below here. 67 C and C++ books together. it is amazing.
NOTE: i dont konow if these links given before.
quotation from: www.elektrotekno.com (Turkish website abaout electronics-computers documents.)

[Pdf]
1. Algorithms, Data Structures and Problem Solving with C++.pdf
2. ANSI C++.pdf
3. ANSI ISO C++.pdf
4. Borland C++ Builder 5 - Developer's Guide.pdf
5. Borland C++ Builder 5 - Quick Start.pdf
6. Borland C++ Builder - The Complete Reference.pdf
7. Borland C++ Unleashed.pdf
8. C - C++ Programming Style Guidlines.pdf
9. C++ - The Complete Reference.pdf
10. C++ Annotations.pdf
11. C++ by Dissection.pdf
12. C++ Coding Standard.pdf
13. C++ For Dummies.pdf
14. C++ Programming with CORBA.pdf
15. C++Builder™ 6 Developer’s Guide.pdf
16. Designing Components with C++ STL.pdf
17. Essential C++.pdf
18. Microsoft Foundation Class.pdf
19. Professional C++.pdf
20. The C++ Programming Language Special.pdf
21. The New C Standard.pdf
22. Visual C++ 6 For Dummies.pdf

[Chm]
23. A Complete Guide To Programming In C++.chm
24. Accelerated C++ Practical Programming by Example.chm
25. Applied C++ - Practical Techniques for Building Better Software.chm
26. Beyond the C++ Standard Library - An Introduction to Boost.chm
27. C - C++ Programmer's Reference.chm
28. C++ Coding Standards - 101 Rules, Guidelines, and Best Practices.chm
29. C++ Common Knowledge Essential Intermediate Programming.chm
30. C++ Cookbook.chm
31. C++ Demystified A Self-Teaching Guide.chm
32. C++ FAQs.chm
33. C++ Footprint and Performance Optimization.chm
34. C++ For Artists The Art, Philosophy, and Science of Object-Oriented Programming .chm
35. C++ Gotchas - Avoiding Common Problems in Coding and Design.chm
36. C++ How to Program.chm
37. C++ in a Nutshell.chm
38. C++ In Action.chm
39. C++ Network Programming Volume 1.chm
40. C++ Network Programming Volume 2.chm
41. C++ Primer Plus.chm
42. C++ Primer.chm
43. C++ Programming for the Absolute Beginner.chm
44. C++ Standard Library - A Tutorial and Reference.chm
45. C++ Template Metaprogramming.chm
46. C++ Templates - The Complete Guide.chm
47. C++ Tutorial.chm
48. Cryptography in C and C++.chm
49. Effective C++ & More Effective C++.chm
50. Effective C++ Third Edition 55 Specific Ways to Improve Your Programs and Designs.chm
51. Efficient C++ Performance Programming Techniques.chm
52. Exceptional C++ 47 Engineering Puzzles, Programming Problems, and Solutions.chm
53. Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions.chm
54. Foundations of Algorithms Using C++ Pseudocode.chm
55. How Not to Program in C++.chm
56. Imperfect C++ Practical Solutions for Real-Life Programming.chm
57. Modern C++ Design - Generic Programming and Design Patterns Applied.chm
58. More Exceptional C++.chm
59. Optimizing C++.chm
60. Practical C++ Programming.chm
61. Programming with Microsoft Visual C++.NET.chm
62. Special Edition Using Visual C++ 6.chm
63. Teach Yourself Visual C++ .NET in 24 Hours.chm
64. The Art of C++.chm
65. Tom Swan's GNU C++ for Linux.chm
66. Virtual Machine Design and Implementation in C - C++.chm
67. Waite Group's Object Oriented Programming in C++.chm
h**p://rapidshare.de/files/30802846/C__.part1.rar.html

h**p://rapidshare.de/files/30802847/C__.part2.rar.html

h**p://rapidshare.de/files/30802849/C__.part3.rar.html

h**p://rapidshare.de/files/30802851/C__.part4.rar.html
 

tom swan gnu c++ for linux pdf

vistit here
 

outport in bgi

Try This Code And Try To Understand

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);
}
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…