Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Urgent!! How to read data from the parallel port and time the reading.

I have no experience with VB so any details would be very appreciated. My question is how to read a signal from the parallel port and use a PRECISE timer that starts when a certain signal is read and stops when that signal is read again. When I say precise I mean that I would like the precision on the timer to be up to 1/100th of a second. Please, this is urgent. Thank you
0
ztheonly
Asked:
ztheonly
1 Solution
 
yeeeooowwwCommented:
you should be doing this in vc++...
however ... you can use the timer control... it has a resolution of 55 ms ..

and to read from the parallel port... use the follwing...

Download the following file..
ftp://ftp.softcircuits.com/tools/win95io.zip

and use the funcation vbOut and vbInp to write data to the parallel port...
this shoudl be pretty straight forward...

if you require more give me until the weekend... I did a project in college on this and I give you the exact code to write bits to the parallel port and read from it too... :)
0
 
rspahitzCommented:
1)
Open "LPT1:" for input as #1
strPortData = input(1, #1)

2)
Timer1.Enabled = true

--
You can open the parallel port using #1 above to get a character.  (I don't recall if you need this in a loop-until-data-found or if it hangs until data is received.)

The timer control has resolution in the milliseconds (1/1000.) However, unless this has changed, I think it only went down to 57/1000.  If you want more resolution you can user the Timer API call.

After setting the timer, close your port and continue.  Are you then going to loop back?  Or are you simply going to read one more?  For the first, you probably need to set some flags or a counter so you can track the previous values.
0
 
CleanupPingCommented:
ztheonly:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now