Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parallel port IO

Status
Not open for further replies.

riggie

IS-IT--Management
Nov 11, 2004
2
0
0
US
Has anyone used the TDLPortIO: DriverLINX Port IO Driver wrapper
component... This component is used for parallel port IO.. I am trying
to setup an application that will constantly read the parallel port and
depending on the out come perform some task.

Basically I have setup a button and when pressed got it to read the
parallel port. It works for the one-off-press of the button but how do I
get it to constantly read in the parallel port?

I suppose what I need to do is set it up in its own thread, and have this thread continuously
reading the parallel port but how can I do this? This area is the bit I find confusing..
 
I know what you mean, i'm a programmer without education in programming and i have finally understood the threads.
I take it you know how to make a thread and in that new thread there will be something like "// place thread code here", at that point ou do something like this:

bla bla::Execute(something bla bla)
{
int X;
while(true)
{
X = ReadPort(); // read the parallell port
// Read pattern and do whatever needed
if(BigRedButtonBit) SetEvent(TheBigRedButtonIsHit); // Tell the "Form1" that the shit did hit the fan
if(TheGreen_Go_Button) SetEvent(A_OK); // And so on...
Sleep(10); // Go down for 10 mSec (or any period of time)
}
}

Best of luck.
 
Is this a freeware component ?
if Yes and if it works under NT can you give me the references ?


If you want to read the parallel port continuously, first look into the component if there is not an event that is triggered when there is new information on the parallel port, the same as when the button is triggered manually.

The next possibility is to set a timer on your form that gives a trigger every x msec and then read out the parallel port in your timer.

Wim Vanherp
Wim.Vanherp@belgacom.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top