Parallel Port input state change
Parallel Port input state change
Parallel Port input state change
Parallel Port input state change
Parallel Port input state change
Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change
Parallel Port input state change Parallel Port input state change
Parallel Port input state change
Go Back  Xtreme Visual Basic Talk > > > Parallel Port input state change


Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2011, 02:57 PM
windywindmill windywindmill is offline
Newcomer
 
Join Date: Apr 2011
Posts: 2
Arrow Parallel Port input state change


Hi

Im in need of a bit of help making a bit of code....

What i want it to do is 'listen' to the lpt port, when a sensor is broken then display the time. there are two sensor to measure the time of the first and then the second sensor.
How do i get VB to listen to the sensors which are on two different inputs of the lpt port and time stamp in micro seconds. I can get it to read the state of the input on mouse click but i need it to display the time in micro seconds when the input changes. i will then use the times from the two sensors to work out the time it took between both sensor changing.

this is what im building, i have the hardware built, its just the software side!
http://briggs69.blogspot.com/2008/11...ed-chrono.html

Any help would be great! im using vb 2008
Reply With Quote
  #2  
Old 04-23-2011, 06:04 AM
mkaras's Avatar
mkarasParallel Port input state change mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

windy,
To have any hope of getting the resolution needed to detect things at high speed you will need to commit your program to polling the parallel port signals in a hard loop.

The person that posted at the link you gave said that they used the commonly available .DLL called InpOut32.dll to give their program access to the parallel port. I have used this successfully with VB6 but have not messed around with it in a .NET environment. One thing to note is that the InpOut32 accesses to read parallel port pin status is not the speediest thing in the world. Expect latencies of about 40 to 80 microseconds just due to the access of each call to this DLL.

Note that if trying to detect a velocity of 600 feet per second using a distance of 4 inches (1/3 of a foot) that you will be measuring a time period of about 555 microseconds. Latencies and delays that programs can experience under Windows could add a whole lot of uncertainty to the measurements that you would try to make. So as you set out to implement this do be aware of this and do not fool yourself that microsecond level resolution from some processor performance counter gives you all that much accuracy. Another way of saying this is that the latencies of access to the polling of the parallel port bits under Windows could put a lot of variance in the results of measuring the same event over and over again. I would not be surprised if you experience errors of up to 10% of the actual event timing.

Michael Karas
Reply With Quote
  #3  
Old 04-24-2011, 03:56 AM
windywindmill windywindmill is offline
Newcomer
 
Join Date: Apr 2011
Posts: 2
Default

Thanks for your advice Michael, from what your saying at the time period i need to measure any latencies will put a spanner in the works. Evan using the audio version i have found the results to be a bit hit and miss. As fun as it was trying to figure this one, its going on the shelf!
Again thanks for your advice.
Reply With Quote
  #4  
Old 04-24-2011, 05:45 AM
mkaras's Avatar
mkarasParallel Port input state change mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

If measuring the time event accurately is something you would still like to achieve let me recommend that the appropriate solution is likely to be using a microcontroller (aka MCU). When dedicated to that one function the programming of such device would be able to detect very well. One could envision two types of design, one where the MCU made measurements and presented those to a PC through a serial port or USB connection. The other approach could have the MCU connected to a simple little LCD display that shows the readings. In this latter case a couple of push buttons could control the device to arm it for a measurement and turn the device on and off.

Michael Karas
Reply With Quote
  #5  
Old 06-15-2012, 09:01 AM
alan_bolinelli alan_bolinelli is offline
Newcomer
 
Join Date: Jun 2012
Posts: 2
Default

Hi, i am trying to read from parallel port, but it keeps returning the 453 error.
when i send the information to the port doing out &h378, 2, it works, but to read from it, doing a = inp(&H379), give me this error

any help?
Reply With Quote
  #6  
Old 06-15-2012, 09:03 AM
alan_bolinelli alan_bolinelli is offline
Newcomer
 
Join Date: Jun 2012
Posts: 2
Question inpout32.dll returns 453 error

Quote:
Originally Posted by alan_bolinelli View Post

Hi, i am trying to read from parallel port, but it keeps returning the 453 error.
when i send the information to the port doing out &h378, 2, it works, but to read from it, doing a = inp(&H379), give me this error

any help?
Reply With Quote
Reply

Tags
chrono, input, parallel


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Parallel Port input state change
Parallel Port input state change
Parallel Port input state change Parallel Port input state change
Parallel Port input state change
Parallel Port input state change
Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change Parallel Port input state change
Parallel Port input state change
Parallel Port input state change
 
Parallel Port input state change
Parallel Port input state change
 
-->