DannyMan he estado esperimentando un poco con el manejo de torniquetes o molinetes yo manejo Vb pero no domino lo referente a pic. Te envío algunas lineas de codigo pruebalas en tu aplicativo, debes tener en la forma un control mscom y un timer. Analiza un poco el codigo y ubicalo.
espero te sirva.
Trate de enviar un adjunto, pero da error
________________________Controla el puerto y la DataY LA DATA
Dim Good_Tx As Long
Dim Bad_Tx As Long
Dim Str_Index As Long
Dim Data_Val(10) As Integer
Dim Data_Str(10) As String
"_______________________________Son variables Modulares________________________________
Private Sub Tmr_Get_Data_Timer()
Dim Counter As Byte
Dim Temp_Data As String
Dim i As Integer
Dim e As Long
Const Data_Pts As Integer = 3
Dim BOF_Found As Boolean
Dim Good_Data As Boolean
Dim Bytes As String
Dim Data_Size_Bar_Val As Integer
Dim Err_Pct As Single
If MSComm_RS232.InBufferCount > 0 Then
Bytes = MSComm_RS232.Input
Out Puerto, 253
For e = 1 To 10000000
Next
Out Puerto, 255
Data_Size_Bar_Val = Len(Bytes)
BOF_Found = False
Good_Data = False
Str_Index = 0
Do
Temp_Data = GetDelimitedText(Bytes, ":", ":", Str_Index)
If Temp_Data = "BOF" Then
BOF_Found = True
Counter = 0
Do
Data_Str(Counter) = GetDelimitedText(Bytes, ":", ":", Str_Index)
Counter = Counter + 1
Loop Until Counter > Data_Pts Or Str_Index = 0
If Data_Str(Counter - 1) <> "EOF" Then
"Label_tx_status.Caption = "Failed, no EOF"
Bad_Tx = Bad_Tx + 1
"List_Diagnostics_EOF.AddItem Bytes
Else
"Label_tx_status.Caption = "Good "
Good_Tx = Good_Tx + 1
For i = 0 To Data_Pts - 1
"Data_Val(i) = Val(Data_Str(i))
"Data(i).Caption = Data_Str(i)
Next i
Good_Data = True
End If
End If
Loop Until Str_Index = 0 Or Good_Data = True
If BOF_Found = False Then
"Label_tx_status.Caption = "Failed, no BOF"
Bad_Tx = Bad_Tx + 1
"List_Diagnostics_BOF.AddItem Bytes
End If
If Good_Tx > 2147483600 Or Bad_Tx > 2147483600 Then " long = 2,147,483,648
Good_Tx = Int(Good_Tx / 2)
Bad_Tx = Int(Bad_Tx / 2)
End If
If Bad_Tx + Good_Tx > 0 Then
Err_Pct = Good_Tx / (Bad_Tx + Good_Tx) * 100
"Label_good_Tx_percent.Caption = Val(Format$(Err_Pct, "###"
![Giño Giño]()
) & " %"
Else
"Label_good_Tx_percent.Caption = "---%"
End If
"Label_good_tx.Caption = Val(Good_Tx)
"Label_bad_Tx.Caption = Val(Bad_Tx)
End If
End Sub
Private Sub trm_Data_Interval_chg()
Tmr_Get_Data.Interval = Val(420)
Bad_Tx = 0
Good_Tx = 0
End Sub
Function GetDelimitedText(Text As String, OpenDelimiter As String, _
CloseDelimiter As String, Str_Index As Long) As String
" get the text enclosed between two Delimiters
"
" it advances Index after the close delimiter
" Returns "" and Index = 0 if not found
" search is case insensitive
Dim i As Long, j As Long
If Str_Index = 0 Then Str_Index = 1
" search the opening mark
i = InStr(Str_Index, Text, OpenDelimiter, vbTextCompare)
If i = 0 Then
Str_Index = 0
Exit Function
End If
i = i + Len(OpenDelimiter)
" search the closing mark
j = InStr(i + 1, Text, CloseDelimiter, vbTextCompare)
If j = 0 Then
Str_Index = 0
Exit Function
End If
" get the text between the two Delimiters
GetDelimitedText = Mid$(Text, i, j - i)
" advanced the index after the closing Delimiter
Str_Index = j + Len(CloseDelimiter) - 1
End Function
"_____________esto va en un modulo Module1...
Declare Sub Out Lib "inpout32.Dll" Alias "Out32" (ByVal PortAddress As Integer, ByVal Value As Integer)