I am pushing a set of bytes from an external device to a COM port. The resultant input needs to be put in a cell in Excel, and converted to hex. I have tried various sets of tools, but none show me any results in Excel.
I have tried some VBA extensions, but they were all paid for, have tried some terminal tools as well. Current VBA tool code is shown below. I cannot get it to show anything in an excel cell either. Results just show in immediate logger.
Private Sub StrokeReader1_CommEvent(ByVal Evt As StrokeReaderLib.Event, ByVal data As Variant)
Select Case Evt
Case EVT_DISCONNECT
Debug.Print "Disconnected"
Case EVT_CONNECT
Debug.Print "Connected"
Case EVT_DATA
buf = (StrokeReader1.Read(Text)) 'Use BINARY to receive a byte array
Debug.Print buf
End Select
End Sub
'Use this to connect and set the port properties from the code
Sub connect()
StrokeReader1.Port = 3
StrokeReader1.BaudRate = 19200
StrokeReader1.PARITY = NOPARITY
StrokeReader1.STOPBITS = ONESTOPBIT
StrokeReader1.DsrFlow = False
StrokeReader1.CtsFlow = False
StrokeReader1.DTR = False
StrokeReader1.RTS = False
StrokeReader1.Connected = True
If StrokeReader1.Error Then
Debug.Print StrokeReader1.ErrorDescription
End If
End Sub
'Use this to send data to the remote device
Sub send()
StrokeReader1.send "ABCD" 'A text string
Dim x(3) As Byte 'A byte array
x(1) = 1
x(2) = 2
x(3) = 3
StrokeReader1.send x
End Sub
Expected results: AA 00 00 22 00 03 00 00 03 2B 01 E1 35
Actual result: ª " Ö $$