Private Sub acquisition_Timer() 'timer pour l'acquisition des données Dim i As Integer With IO .BitReset PAR1, PL .BitSet PAR1, PL End With For i = 32 To 1 Step -1 'acquisition des 32 bits de données bit 32 à Bit 1 With IO lbI(i).Caption IIf((.Inp(PAR1 + 1) And BUSY) 0, 1, 0) .BitSet PAR1, CK .BitReset PAR1, CK End With If lbI(i).Caption "1" Then ' Si données 1 affichage en rouge ...... Else lbI(i).ForeColor vbBlack ' Si données 0 affichage en noir ...... End If SequenceTmp = SequenceTmp & CStr(lbI(i)) Next i If SequenceTmp <> Sequence Then If Starttest True Then ' Si Starttest Valide Ensuite 'sauvegarde si un bit est modifié Dim Chaine As String For i = 32 To 1 Step -1 Chaine = Chaine & vbTab & Mid(SequenceTmp, i, 1) If CStr(lbI(i)) <> Mid(Sequence, i, 1) Then Cpt_C(i) = Cpt_C(i) + 1 ' ajoute 1 au compteur du label Next Sequence = SequenceTmp Print #1, Format(Date, "dd/mm/yyyy") & vbTab & Format(Time, "hh:mm:ss") & vbTab & vbTab & vbTab & vbTab & vbTab & Chaine End If End If End Sub
If lbI(i).Caption "1" Then ' Si données 1 affichage en rouge ...... ElselbI(i).ForeColor vbBlack ' Si données 0 affichage en noir ...... End If
lbI(i).ForeColor = &HFF And ( val(lbI(i).Caption) * &HFF)
If CStr(lbI(i)) <> Mid(Sequence, i, 1) Then Cpt_C(i) = Cpt_C(i) + 1
If CStr(lbI(i).Caption) <> Mid(Sequence, i, 1) Then Cpt_C(i).Caption = Cstr(Val(Cpt_C(i).Caption) + 1)
lbI(i).ForeColor = Val(lbI(i).Caption) * 255
If lbI(i).Caption "1" Then ' Si données 1 affichage en rouge ...... ElselbI(i).ForeColor vbBlack ' Si données 0 affichage en noir ...... End If
If CStr(lbI(i).Caption) <> Mid(Sequence, i, 1) Then Cpt_C(i).Caption = Cstr(Val(Cpt_C(i).Caption) + 1
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionlbI(i).Caption IIf((.Inp(PAR1 + 1) And BUSY) 0, 1, 0)
lbI(i).Caption = Cstr(Abs(CInt(Not (.Inp(PAR1 + 1) And BUSY ))))
lbI(i).Caption IIf((.Inp(PAR1 + 1) And BUSY) 0, 1, 0)
lbI(i).Caption = Cstr(Abs(CInt(Not (.Inp(PAR1 + 1) And BUSY ))))
Option Explicit Private ValueTmp As Integer Private CompteurTmp As Integer Private HasChangedTmp As Boolean Public Property Let Value(ByVal Valeur As Integer) If ValueTmp <> Valeur Then CompteurTmp = CompteurTmp + 1 HasChangedTmp = True Else HasChangedTmp = False End If ValueTmp = Valeur End Property Public Property Get Value() As Integer Valeur = ValueTmp End Property Public Property Get Compteur() As Integer Compteur = CompteurTmp End Property Public Property Get HasChanged() As Boolean HasChanged = HasChangedTmp End Property
Private TabBit(1 To 32) As New AcqCls
Dim Modif as Boolean Dim Chaine As String For i = 32 To 1 Step -1 'acquisition des 32 bits de données bit 32 à Bit 1 With IOTabBit(i).Value IIf((.Inp(PAR1 + 1) And BUSY) 0, 1, 0) lbI(i).Caption = Cstr(TabBit(i).Value) Cpt_C(i).Caption = Cstr(TabBit(i).Compteur)If TabBit(i).Value 1 Then ' Si données 1 affichage en rouge ...... ElselbI(i).ForeColor vbBlack ' Si données 0 affichage en noir ...... End If Modif = TabBit(i).HasChanged Or Modif Chaine = Chaine & vbTab & TabBit(i).Value .BitSet PAR1, CK .BitReset PAR1, CK End With If Modif = True Then Print #1, Format(Date, "dd/mm/yyyy") & vbTab & Format(Time, "hh:mm:ss") & vbTab & vbTab & vbTab & vbTab & vbTab & Chaine End If
IO.Inp(PAR1 + 1) et BUSY stp
With IO .BitReset PAR1, PL .BitSet PAR1, PL End With
Option Explicit Private ValueTmp As Integer Private CompteurTmp As Integer Private HasChangedTmp As Boolean Dim Valeur As String Public Property Let Value(ByVal Valeur As Integer) If ValueTmp <> Valeur Then CompteurTmp = CompteurTmp + 1 HasChangedTmp = True Else HasChangedTmp = False End If ValueTmp = Valeur End Property Public Property Get Value() As Integer Valeur = ValueTmp End Property Public Property Get Compteur() As Integer Compteur = CompteurTmp End Property Public Property Get HasChanged() As Boolean HasChanged = HasChangedTmp End Property
Option Explicit '----------------------> Déclaration module de classe AcqCls Private TabBit(1 To 32) As New AcqCls Private Sub acqui_Timer() 'timer pour l'acquisition des données acquisition ' lance le prog acquisition End Sub Private Sub acquisition() On Error Resume Next Dim Modif As Boolean Dim Chaine As String Dim i As Integer Dim SequenceTmp As String With IO .BitReset PAR1, PL .BitSet PAR1, PL End With For i = 32 To 1 Step -1 'acquisition des 32 bits de données bit 32 à Bit 1 With IO TabBit(i).Value IIf((.Inp(PAR1 + 1) And BUSY) 0, 1, 0) lbI(i).Caption = CStr(TabBit(i).Value) Cpt_C(i).Caption = CStr(TabBit(i).Compteur) If TabBit(i).Value 1 Then ' Si données 1 affichage en rouge lbI(i).ForeColor = vbRed LineV(i).Visible = True LineD1(i).Visible = False LineD2(i).Visible = False Else lbI(i).ForeColor vbBlack ' Si données 0 affichage en noir LineV(i).Visible = True LineD1(i).Visible = True LineD2(i).Visible = True End If Modif = TabBit(i).HasChanged Or Modif Chaine = Chaine & vbTab & TabBit(i).Value .BitSet PAR1, CK .BitReset PAR1, CK End With Next i If Modif = True Then Print #1, Format(Date, "dd/mm/yyyy") & vbTab & Format(Time, "hh:mm:ss") & vbTab & vbTab & vbTab & vbTab & vbTab & Chaine End If End Sub
Option Explicit Private ValueTmp As Integer Private CompteurTmp As Integer Private HasChangedTmp As Boolean Public Property Let Value(ByVal Valeur As Integer) If ValueTmp <> Valeur Then CompteurTmp = CompteurTmp + 1 HasChangedTmp = True Else HasChangedTmp = False End If ValueTmp = Valeur End Property Public Property Get Value() As Integer Value = ValueTmp End Property Public Property Get Compteur() As Integer Compteur = CompteurTmp End Property Public Property Get HasChanged() As Boolean HasChanged = HasChangedTmp End Property
Option Explicit Private ValueTmp As Integer Private CompteurTmp As Integer Private HasChangedTmp As Boolean Public Property Let Value(ByVal Valeur As Integer) static TestPassage as boolean If (ValueTmp <> Valeur) And (TestPassage = True) Then CompteurTmp = CompteurTmp + 1 HasChangedTmp = True Else HasChangedTmp = False End If TestPassage = True ValueTmp = Valeur End Property Public Property Get Value() As Integer Value = ValueTmp End Property Public Property Get Compteur() As Integer Compteur = CompteurTmp End Property Public Property Get HasChanged() As Boolean HasChanged = HasChangedTmp End Property
For i = 32 To 1 Step -1
If (ValueTmp <> Valeur) And (TestPassage = True) Then
If (ValueTmp <> Valeur) And (TestPassage = True) And (Valeur=0) Then
Chaine = Chaine & vbTab & TabBit(i).Value
Chaine = Chaine & vbTab & TabBit(32 - i +1).Value
If TabBit(i).Value 1 Then ' Si données 1 affichage en rouge lbI(i).ForeColor = vbRed LineV(i).Visible = True LineD1(i).Visible = False LineD2(i).Visible = False ElselbI(i).ForeColor vbBlack ' Si données 0 affichage en noir LineV(i).Visible = True LineD1(i).Visible = True LineD2(i).Visible = True End If
lbI(i).ForeColor = 255 * TabBit(i).Value LineV(i).Visible = True LineD1(i).Visible = Not CBool(TabBit(i).Value) LineD2(i).Visible = Not CBool(TabBit(i).Value)
LineV(i).Visible = CBool(TabBit(i).Value)
If (Modif True And (Starttest1 Or Starttest2 True)) Then Print #1, Format(Date, "dd/mm/yyyy") & vbTab & Format(Time, "hh:mm:ss") & vbTab & vbTab & vbTab & vbTab & vbTab & Chaine End If
Cpt_C(i).Caption = CStr(TabBit(i).Compteur)
If Starttest1 = True For Cpt_C(i) 1 to 16 Cpt_C(i).Caption = CStr(TabBit(i).Compteur) next end if If Starttest2 = True For Cpt_C(i) 17 to 32 Cpt_C(i).Caption = CStr(TabBit(i).Compteur) next end if
For i = 32 To 1 Step -1 'acquisition des 32 bits de données bit 32 à Bit 1 With IO TabBit(i).Value IIf((.Inp(PAR1 + 1) And BUSY) 0, 1, 0) lbI(i).Caption = CStr(TabBit(i).Value) If Starttest1 = True Then For Cpt_C(i) = 1 To 16 Cpt_C(i).Caption = CStr(TabBit(i).Compteur) Next End If If Starttest2 = True Then For Cpt_C(i) = 17 To 32 Cpt_C(i).Caption = CStr(TabBit(i).Compteur) Next End If ..................... End With Next i
For Cpt_C(i) = 1 To 16
If Starttest1 = True And i <= 16 Then Cpt_C(i).Caption = CStr(TabBit(i).Compteur) If Starttest2 True And i> 17 Then Cpt_C(i).Caption = CStr(TabBit(i).Compteur)
If Starttest1 = True And i <= 16 Then Cpt_C(i).Caption = CStr(TabBit(i).Compteur) Else If Starttest1 = False Then Cpt_C(i) = "0"