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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tacho prog

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Can anyone help.

I'm looking for a piece of code that will count pulses per second like that to a rev counter i'm using the parallel port with a 555 timer set at 10 pulses per second (10Hz)

I'm using VB4 PRO if thats of any help.

Thanks to anyone who can help

Ray.
 
With this code ?

Make A Timer

Make a timer that will display the time (hours, minutes, seconds and tenth seconds) that passed since you start it.

Preparations
Add 1 Timer Control,1 Label and 2 Command Buttons to your form.
Set the Timer Interval property to 10.
Set the Timer Enabled property to False.
Press the first button to start the timer, and the second button to pause/resume it.

Form Code
Dim TotalTenthSeconds, TotalSeconds, TenthSeconds, Seconds, _
Minutes, Hours As Integer

Private Sub Command1_Click()
' initilize the Total tenth seconds
TotalTenthSeconds = -1
' start the timer
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
' start or stop the timer
Timer1.Enabled = Not Timer1.Enabled
End Sub

Private Sub Timer1_Timer()
' increase the total amount of Tenth Seconds.
' we set the timer interval to 10, so every tenth second
' this sub will be executed
TotalTenthSeconds = TotalTenthSeconds + 1
' if the TotalTenthSeconds is equal to 10, set it to 0.
TenthSeconds = TotalTenthSeconds Mod 10
' 10 tenth seconds are equal to 1 second
' int - will give us the integer part of the number:
' int(0.9) = 0
TotalSeconds = Int(TotalTenthSeconds / 10)
' if the Seconds is equal to 60, set it to 0
Seconds = TotalSeconds Mod 60
Minutes = Int(TotalSeconds / 60) Mod 60
Hours = Int(TotalSeconds / 3600)
' update the label
Label1 = Hours & ":" & Minutes & ":" & Seconds & ":" & TenthSeconds
End Sub

Eric De Decker
vbg.be@vbgroup.nl

Licence And Copy Protection AxtiveX
Source CodeBook for the programmer
 
Eric,

How does this count the pulses coming in on the parallel port??
Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top