USB to Serial Converter Problem on VB6

R

Thread Starter

Robbie

My program in VB6 makes use of the serial port which is connected to a keypad module wirelessly through zigbee. Anyway, when I open the serial port (Comm port 1), there are no problems. I get to receive and interpret the data correctly. however, when I use a serial to usb converter, it doesn't work (I opened the correct port, it's port 4 when I'm using the converter). I'm sure that the usb to serial converter works properly. because when I simulate data transmission using real term, the data is properly sent and received through the converter. however, I can't make this work when I'm running the program.. Can anyone help me here? >.< I'm desperate.

Here's the code I used to open the port:

'Open and Close port Functions
Public Function PortOpen() As Integer '1 = Successful, 0 = Failure
'Open the port
With MSComm1
.CommPort = cmbPort.ItemData(cmbPort.ListIndex)
.Settings = "9600,N,8,1"
.InputMode = 0
.InputLen = 0
.RThreshold = 1
.SThreshold = 1
.DTREnable = True
.RTSEnable = True
.NullDiscard = False

If .PortOpen = False Then
On Error GoTo OpenPortErrorHandler
.PortOpen = True
PortOpen = 1

OpenPortErrorHandler:
If Err.Number = 8002 Then
MsgBox "You are attempting to open an invalid port. " & vbCrLf & _
"Kindly make sure that the RFID is connected to Port 1, then retry." _
, vbExclamation, Err.description
'Exit Function
PortOpen = 0
End If
Else
'Port is already open!
MsgBox "Port 1 is already open!", vbExclamation, "Port Open Check"
PortOpen = 1
End If
End With
End Function
 
G

Gabriele Corrieri

Hello Robbie,

my point of view is that the USB to serial converter doesn't meet the right electrical levels needed from the other side (zigbee): if you can try I suggest you to plug a serial booster from usb to rs232 converter and zigbee, my opinion is that solve the problem.
If you can't buy a booster you can make your own made by using a couple MAX232 one to convert RS232 to TTL logic level, another to make the inverse conversion from TTL to RS232 levels.

The MAX232 is only a suggestion, there's many type with more converter inside, with or without external capacitor, with or without electrical isolation from one side to other side, but I think that MAX232 are the most commonly used, the most avaiable in every electronic shop, and the most simple to wire, and the ones with more docs on the web.

Kind regards,
Gabriele
 
Top