Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Parallel port programming

Status
Not open for further replies.

jwatson

New Member
Hey guys i am doing a electronic project which require parallel port programming. i am currently learning C+ programming(newb) so i dont wanna learn new languages.

Basically i need a simple parallel port Program that control 4 LED light ON/OFF. The program should be able to activate 2 or more LED ON and OFF/ON individually.
Also i need my program to be able to web interface. Please help me in any ways you can.

BIG thanks
 
hai i dont no somuch about but for parallel programming like pics we use one driver called nt95.exe by linux projects for window platform in that u can send data to parallel port with address it my helppul because u may get full source of that code also so search by google with nt95.exe port driver key work
 
Well for VisualBasic the Inpout32.dll works great.Its a dll they used in win 95/98 .You copy it in the windows folder it will still work on XP and simalar systems.

In VB it then takes a single command to change the state of the pins on the LPT.

I never used C so i dont know if this dll is usable in it
 
If you are doing this under win32, you can do something like this:

Code:
HANDLE ProgPort;
DWORD  lpNumberOfBytesWritten;
unsigned char Buffer[16];

ProgPort = CreateFile( "LPT1", GENERIC_WRITE | GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL );
	if( ProgPort == NULL ) { printf ( "Unable to access LPT1\n" ); return 1;}
Then you can just write bytes to the port like this:
Code:
Buffer[0] = 0x55; //Data byte to write
WriteFile( ProgPort, Buffer, 1, &lpNumberOfBytesWritten, NULL );

On the printer port you need to tie pins 11(Busy) and 12 (Paper Error) to ground or the driver will wait for the "printer/your circuit" to be ready. For more info see this page:
https://www.epanorama.net/circuits/parallel_output.html#windowsprogramming
 
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#define PORT a 0x378
void main ()
{
int x;
int dmc[15] = { 0x01,0x02,0x04,0x00,0x10,0x20,0x40,0x80,0x00,0xff };
while (!kbhit())
{
for (a=0;a<=10;a++)
{
delay(1);
outportb( PORT a , dmc[a] );
}
}
}

this type of code you may reqed.
you just study the outportb commmand in c
from index you will get all information regarding ok.
this code is a part of my one of the prog.
Be carefull with Parallel port it is not protected from sc.
 
you cannot interface b/w web and h/w directly .to do either you'll have to write your own server to accept such request or you have to write suitable plugins for server , or use indirect method (write a flag to some file, another prg reading the file and acting according to it) . mind that dos calls like inportb won't work in windows environment .
i think python have a h/w access module , so that u can use that for scripting as well as h/w access
 
i am running on WindowXP. is there anywhere i can get information or anyone here know python for web interfacing that akg described?...
 
hey..man.. even i was in dought about a web scripting languages ability, but i just searched Google , python + hardware and got a page describing an add on .
normaly no one would need this kind of direct interface . well searching for advance python programming will help u more.
i have one more idea if u know vb/vc++ , build and activex and call it from asp.
 
akg said:
hey..man.. even i was in dought about a web scripting languages ability, but i just searched Google , python + hardware and got a page describing an add on .
normaly no one would need this kind of direct interface . well searching for advance python programming will help u more.
i have one more idea if u know vb/vc++ , build and activex and call it from asp.

i would be glad if you can explain and gives me more detail on that idea. PM me with related links if you can. Thanks alot.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top