pepin
September 20th, 2001, 09:00 AM
Hi!
Is it possible to run 2 subs at the same time? One of them displays the position in a label from an extern display unit and the second sub looks at the position and put data in an Excel sheet when the reading is stable.
when I start the sub doing the data acquisition, the label stops being updated.
'*------------------
Private Sub Timer1_Timer()
If MSComm1.PortOpen = True Then
MSComm1.Output = Chr$(stx)
Me.txtPosActuelle.Text = MSComm1.Input
Else
MSComm1.PortOpen = True
MSComm1.Output = Chr$(stx)
Me.txtPosActuelle.Text = MSComm1.Input
End If
End Sub 'interval=100
'*--------------------
Private Function SaisieDonneesForward(position)
Do While Not (Lecture1 < (position + frmParametres.attente) _
And Lecture1 > (position - frmParametres.attente))
MSComm1.InBufferCount = 0
MSComm1.Output = Chr$(stx)
Sleep 150
temp = MSComm1.Input
Lecture1 = FiltreLecture(temp)
Loop
MSComm1.InBufferCount = 0 'première lecture
MSComm1.Output = Chr$(stx)
Sleep Delai
temp = MSComm1.Input
Lecture1 = FiltreLecture(temp)
Sleep (500)
MSComm1.InBufferCount = 0 'deuxième lecture
MSComm1.Output = Chr$(stx)
Sleep Delai
temp = MSComm1.Input
lecture2 = FiltreLecture(temp)
End If
If (lecture2 <> Lecture1) Then 'ça veut dire que ça tourne encore
lecture2 = Rotation()
Worksheets("sheet1").Cells((j + 1), 1).Value = lecture2
Else
Worksheets("sheet1").Cells((j + 1), 1).Value = lecture2
End If
end sub
Thanks!
Valérie Pepin
Is it possible to run 2 subs at the same time? One of them displays the position in a label from an extern display unit and the second sub looks at the position and put data in an Excel sheet when the reading is stable.
when I start the sub doing the data acquisition, the label stops being updated.
'*------------------
Private Sub Timer1_Timer()
If MSComm1.PortOpen = True Then
MSComm1.Output = Chr$(stx)
Me.txtPosActuelle.Text = MSComm1.Input
Else
MSComm1.PortOpen = True
MSComm1.Output = Chr$(stx)
Me.txtPosActuelle.Text = MSComm1.Input
End If
End Sub 'interval=100
'*--------------------
Private Function SaisieDonneesForward(position)
Do While Not (Lecture1 < (position + frmParametres.attente) _
And Lecture1 > (position - frmParametres.attente))
MSComm1.InBufferCount = 0
MSComm1.Output = Chr$(stx)
Sleep 150
temp = MSComm1.Input
Lecture1 = FiltreLecture(temp)
Loop
MSComm1.InBufferCount = 0 'première lecture
MSComm1.Output = Chr$(stx)
Sleep Delai
temp = MSComm1.Input
Lecture1 = FiltreLecture(temp)
Sleep (500)
MSComm1.InBufferCount = 0 'deuxième lecture
MSComm1.Output = Chr$(stx)
Sleep Delai
temp = MSComm1.Input
lecture2 = FiltreLecture(temp)
End If
If (lecture2 <> Lecture1) Then 'ça veut dire que ça tourne encore
lecture2 = Rotation()
Worksheets("sheet1").Cells((j + 1), 1).Value = lecture2
Else
Worksheets("sheet1").Cells((j + 1), 1).Value = lecture2
End If
end sub
Thanks!
Valérie Pepin