473,394 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Reading parallel port with constant sample rate

I'm interested to know what ideas are out there for reading a parallel port at a constant sample rate while still allowing the user to interact with the GUI. That is, reading it every 10ms for example without exception. Is this at all possible?

Current tests done show that if the sample rate is 10ms then this is acheived in general, but when another program loads or terminates this 10ms jumps up to 100ms or more. In these tests the code is placed in a Do Loop with Application.DoEvents and when the code is placed in a seperate thread in a Do Loop with Thread.Sleep(10). During this temporary 100ms there will be significant data loss.

Is it possible to acheive this real-time goal on a Windows OS with VB.Net?

Nov 20 '05 #1
6 3256
Its possible under windows but I dont think its a possibility under vb .net
or for that matter in .net altogether. I just dont think the .net runtime is
deterministic enough to allow development of real-time applications
especially now that it has the non-deterministic garbage collector. You
might want to look at developing such applications in C/C++ or some
third-party real-time module for windows depending on how much of a need
this is to you. Here are some links:
http://www.merl.com/reports/docs/TR98-02.pdf
http://sys-con.com/story/?storyid=45500&DE=1
http://www.tenasys.com/intime.html
http://www.engineeringtalk.com/news/nem/nem108.html

hope this helps..

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
I'm interested to know what ideas are out there for reading a parallel port at a constant sample rate while still allowing the user to interact
with the GUI. That is, reading it every 10ms for example without exception.
Is this at all possible?
Current tests done show that if the sample rate is 10ms then this is acheived in general, but when another program loads or terminates this 10ms
jumps up to 100ms or more. In these tests the code is placed in a Do Loop
with Application.DoEvents and when the code is placed in a seperate thread
in a Do Loop with Thread.Sleep(10). During this temporary 100ms there will
be significant data loss.
Is it possible to acheive this real-time goal on a Windows OS with VB.Net?

Nov 20 '05 #2
Thanks for your feedback. Do you think it is possible to write a module (in a real-time 3rd party product) for scanning the parallel port at a specified sample rate and raising an event within a .NET application when a certain condition is met?

"Imran Koradia" wrote:
Its possible under windows but I dont think its a possibility under vb .net
or for that matter in .net altogether. I just dont think the .net runtime is
deterministic enough to allow development of real-time applications
especially now that it has the non-deterministic garbage collector. You
might want to look at developing such applications in C/C++ or some
third-party real-time module for windows depending on how much of a need
this is to you. Here are some links:
http://www.merl.com/reports/docs/TR98-02.pdf
http://sys-con.com/story/?storyid=45500&DE=1
http://www.tenasys.com/intime.html
http://www.engineeringtalk.com/news/nem/nem108.html

hope this helps..

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
I'm interested to know what ideas are out there for reading a parallel

port at a constant sample rate while still allowing the user to interact
with the GUI. That is, reading it every 10ms for example without exception.
Is this at all possible?

Current tests done show that if the sample rate is 10ms then this is

acheived in general, but when another program loads or terminates this 10ms
jumps up to 100ms or more. In these tests the code is placed in a Do Loop
with Application.DoEvents and when the code is placed in a seperate thread
in a Do Loop with Thread.Sleep(10). During this temporary 100ms there will
be significant data loss.

Is it possible to acheive this real-time goal on a Windows OS with VB.Net?


Nov 20 '05 #3
Parallel ports are synchronous, therefore you should not be able to 'loose'
data. For example, when you scan a document in using a paralell port, and
start other applications, do you loose data ? No!

It is a case of writing a driver to interact with the port, not an
insignificant task, but do-able.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
I'm interested to know what ideas are out there for reading a parallel port at a constant sample rate while still allowing the user to interact
with the GUI. That is, reading it every 10ms for example without exception.
Is this at all possible?
Current tests done show that if the sample rate is 10ms then this is acheived in general, but when another program loads or terminates this 10ms
jumps up to 100ms or more. In these tests the code is placed in a Do Loop
with Application.DoEvents and when the code is placed in a seperate thread
in a Do Loop with Thread.Sleep(10). During this temporary 100ms there will
be significant data loss.
Is it possible to acheive this real-time goal on a Windows OS with VB.Net?

Nov 20 '05 #4
What if the parallel port was being written to (by an external device) every couple of milliseconds? Not sampling the data at a constant rate will miss data.

Any suggestions?

"One Handed Man ( OHM - Terry Burns )" wrote:
Parallel ports are synchronous, therefore you should not be able to 'loose'
data. For example, when you scan a document in using a paralell port, and
start other applications, do you loose data ? No!

It is a case of writing a driver to interact with the port, not an
insignificant task, but do-able.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
I'm interested to know what ideas are out there for reading a parallel

port at a constant sample rate while still allowing the user to interact
with the GUI. That is, reading it every 10ms for example without exception.
Is this at all possible?

Current tests done show that if the sample rate is 10ms then this is

acheived in general, but when another program loads or terminates this 10ms
jumps up to 100ms or more. In these tests the code is placed in a Do Loop
with Application.DoEvents and when the code is placed in a seperate thread
in a Do Loop with Thread.Sleep(10). During this temporary 100ms there will
be significant data loss.

Is it possible to acheive this real-time goal on a Windows OS with VB.Net?


Nov 20 '05 #5
Hi,

Is it possible to acheive this real-time goal on a Windows OS with VB.Net?
<<

In general, no. Windows is not a real-time OS, and .NET is far from a
real-time programming environment, even if Windows were RT.

However, depending on what your "real" goals are, it often is possible it
approach RT in an application. Certainly, 10 mS for accessing a parallel
port is reasonable. However, at the boundaries of operation you may see
results that lie outside this "window." For more information you may want
to look a the PC Data Acquisition link on my homepage. It has some
discussion of RT issues.

BTW, thread.sleep put your thread to sleep for AT LEAST 10 mS, not for
EXACTLY 10 mS. A more reasonable approach (IMO) would be to use a threading
timer, and to provide some sort of internal correction mechanism that checks
on elapsed time.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
Nov 20 '05 #6
If you absolutely cannot afford to miss ANY data, then you cannot use
Windows or .NET. You must use a RT OS and compatible language.

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Isaac T Alston | last post by:
Basically, I'm thinking about building a robot which can be controlled by programs which I write, I'm going to interface to the robot through the parallel port (like in this tutorial here:...
12
by: david.brown.0 | last post by:
I'm trying to make a Java program access a parallel port. Java's comm API does not provide me with the control I need. I need to be able to write to the data and control pins and read the status...
11
by: lovecreatesbeauty | last post by:
For example, line L1 and line L2 are two lines in two-dimensional space, the start-points and end-points can be described with following the `point_t' type. The start-points and end-points are:...
4
by: ganesah | last post by:
hi, Im working on a project where i need to send binary format data to serial port and output the exact data through parallel port? could anyone explain me how to do, what language should i use ? If...
4
by: ganesah | last post by:
hi, Im working on a project where i need to send binary format data to serial port and output the exact data through parallel port? could anyone explain me how to do it, can i use the C++ language?...
7
by: ianenis.tiryaki | last post by:
well i got this assignment which i dont even have a clue what i am supposed to do. it is about reading me data from the file and load them into a parallel array here is the question: Step (1) ...
8
by: Ringo | last post by:
I have a micro controller that sends a stream of 102 bytes to the pc. The values range from 0 to 255. I set up my serialport like this sp.BaudRate = 115200; sp.PortName = "COM53"; sp.DataBits =...
4
by: Soren | last post by:
Hi, I want to control some motors using the parallel port.. however, my laptop does not have any parallel ports (very few do). What I do have is a USB->Parallel converter... I thought about...
1
by: ssndk123 | last post by:
Hi, Using the UserPort program that changes permissions in XP so that I am able to write directly to the parallel port using assembler.. I'm trying to send out square wave pulses for x number...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.