1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| Private Sub courbe()
Dim i, ml As Integer
Dim tableau111(1000), tableau222(1000) As Integer
ml = 1
With cmsg1
.l_id = 616
.by_len = 1
.by_extended = 0
.by_remote = 0
.by_data_0 = 10
.by_data_1 = 0
.by_data_2 = 0
.by_data_3 = 0
.by_data_4 = 0
.by_data_5 = 0
.by_data_6 = 0
.by_data_7 = 0
End With
With cmsg2
.l_id = 607
.by_len = 1
.by_extended = 0
.by_remote = 0
.by_data_0 = 50
.by_data_1 = 0
.by_data_2 = 0
.by_data_3 = 0
.by_data_4 = 0
.by_data_5 = 0
.by_data_6 = 0
End With
fncanConformedTransmit(canHandle, cmsg1, 1)
fncanConformedTransmit(canHandle, cmsg2, 1)
Dim Hour As Integer = Microsoft.VisualBasic.DateAndTime.Hour(Now)
Dim Minutes As Integer = Microsoft.VisualBasic.DateAndTime.Minute(Now)
Dim Second As Integer = Microsoft.VisualBasic.DateAndTime.Minute(Now)
While i < 1000
fncanRead(canHandle, cmsg_Message, 1)
If cmsg_Message.l_id = "614" And verificationbool Then
Hour = Microsoft.VisualBasic.DateAndTime.Hour(Now)
Minutes = Microsoft.VisualBasic.DateAndTime.Minute(Now)
Second = Microsoft.VisualBasic.DateAndTime.Second(Now)
tableau111(i) = cmsg_Message.by_data_2 + cmsg_Message.by_data_3 * 256
tableau222(i) = cmsg_Message.by_data_4 + 256 * cmsg_Message.by_data_5
tableautempss(i) = Hour & ":" & Minutes & ":" & Second
TextBox1.Text = "PWM: " & tableau111(i) & vbNewLine & "Vitesse à pompe: " & tableau222(i) & vbNewLine & "Acquisition: " & ml
ml += 1
i += 1
End If
If i = 10 And verificationbool Then
Try
For k As Integer = 0 To 9
inttableau(k) = tableau222(k)
inttabheure(k) = tableautempss(k)
Next
tempsobject = inttabheure
VitPompLiants = inttableau
mutex1.Set()
verificationbool = False
i = 0
Catch ex As Exception
MsgBox("Erreur")
End Try
End If
End While
End Sub
Private Sub dessiner()
While 1
mutex1.WaitOne()
verificationbool = False
verificationlecture = False
Tracer(1, VitPompLiants, 1, tempsobject)
lm += 1
TextBox2.Text = "Courbe numéro: " & lm
mutex1.Reset()
verificationbool = True
verificationlecture = True
End While
End Sub |
Partager