In my application I am trying to receive serial data and place it in a variable. I have tried the EnableOncom event, but it never fires. I tried the serial terminal example and the event fires there. I am using the serial2.dll. Here is the code:
Sub receivedata
Serial.BitRate = 9600 'baud rate
Serial.CommPort = 1
Serial.Timeout = 500
Serial.MaxInputLen = 40
Serial.PortOpen = True
Serial.EnableOnComm = True
Do Until Serial.InBufferCount <> 0 ' I did the loop to wait for data to be sent
Loop
Serial.PortOpen = False
reader.Close
Msgbox(dexesign)
End Sub
Sub Serial_OnCom 'Fires whenever the EnableOnComm is true and there is communication
dexesign = dexesign & Serial.InputString
Msgbox(dexesign)
End Sub
dexesign is a global variable
Can someone suggest a better way to accomplish capturing the data.
Sub receivedata
Serial.BitRate = 9600 'baud rate
Serial.CommPort = 1
Serial.Timeout = 500
Serial.MaxInputLen = 40
Serial.PortOpen = True
Serial.EnableOnComm = True
Do Until Serial.InBufferCount <> 0 ' I did the loop to wait for data to be sent
Loop
Serial.PortOpen = False
reader.Close
Msgbox(dexesign)
End Sub
Sub Serial_OnCom 'Fires whenever the EnableOnComm is true and there is communication
dexesign = dexesign & Serial.InputString
Msgbox(dexesign)
End Sub
dexesign is a global variable
Can someone suggest a better way to accomplish capturing the data.