PDA

View Full Version : Mscomm32 (using Netcomm) reading issue with USB to serial comport



earnienew
08-06-2015, 09:59 AM
Hi everyone

It is my first post. So, if anything is unclear, please, kindly notice.
I am using Excel 2007 with VB6.5 programming a small macro to communicate with devices through 2 Com ports.
COM1: PC build-in RS232 serial communication Port
COM2: Prolific USB-to-serial Comm Port
I use NetcommOCX form to build the macro.
It works(read/write) fine with COM1.
But It cannot read from COM2.
The macro can still send data/command to device through COM2, but get Run-time error "8020" when reading feedback data from it.

I also tried to enable/disable RTS and DTR flow control but still cannot receive data from COM2.
All other settings are standard 9600, no parity, 8, 1,

Does any one have the same issue before?
Please, help. Thanks

Regards,
Ernie

earnienew
08-06-2015, 10:23 AM
Here is code of reading sub
Public Function ReadMSG() As String

If UserForm1.UARTComm1.CommEvent = 2 And UserForm1.UARTComm1.InBufferCount <> 0 Then
Range("E1") = UserForm1.UARTComm1.CommEvent
ComPortMsg = UserForm1.UARTComm1.InputData
Range("C4") = ComPortMsg
Else
ComPortMsg = "No Response"
End If

End Function