|
-
Oct 17th, 2015, 06:11 AM
#1
Thread Starter
New Member
Problem with MSComm port
hi, im new with MSComm. I try to connect the com port with VB6.0. the problem i got is the vb say Invalid port number(8002). i already check the port number at Device manager any try connect any port available but still same. anybody know how to overcome my problem??
thank you

code that im using >>>
Private Sub Form_Load()
MSComm1.RThreshold = 1
MSComm1.InputLen = 1
MSComm1.Settings = "9600,n,8,1"
MSComm1.CommPort = 40
MSComm1.InBufferSize = 16
MSComm1.InputLen = 10
MSComm1.DTREnable = False
MSComm1.PortOpen = True
End Sub
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
Private Sub MSComm1_OnComm()
End Sub
Last edited by kandaiiskandar; Oct 17th, 2015 at 11:40 AM.
-
Oct 17th, 2015, 08:20 AM
#2
Re: Problem with MSComm port
CommPort is usually something like COM1, COM14, etc...
Its a bit blurry, but it looks like your Arduino may be COM40, so I assume you should try that.
-
Oct 24th, 2015, 09:01 PM
#3
Re: Problem with MSComm port
The MSComm32.ocx has a validity check on the CommPort property that limits it to values between 1 and 16.
It is possible to perform a binary hack on the OCX to change the upper limit to as high as at least 99, but this isn't supported. I've done it in the past and it worked fine for my application.
The stock OCX should have a sequence of bytes 3D 10 00 that is unique in most versions. The 10 is of course 16, and this byte can be altered to a larger value to permit the use of COM17: and up. I'm not sure stuffing FF in there would be successful up to COM255: but you can certainly put in 63 to get a range from COM1: through COM99: if you need to.
-
Oct 25th, 2015, 03:08 PM
#4
Re: Problem with MSComm port
I didn't remember the MSComm32.ocx limit of 16 ports, but then I don't usually let the port numbers get that high.
If I plug in a USB to serial device and I see the com ports assigned higher com ports than I want, then there are two options.
One is in Win7 you can usually change the port number the ports are mapped to by selecting the properties of the comport and selecting a lower unused port number.
But you also may want to unallocate some port numbers that have been reserved from prior insertions of the serial devices in different USB ports.
You can follow a procedure like the one describe here, https://learn.adafruit.com/how-to-fi...ports/overview to show the hidden ports, and remove them.
Then when you reconnect your device you should get assignments in a much lower range. Try to always use the same USB port for a given Serial device so it will reuse the same port numbers, and not assign it new port numbers because you plugged it into a different USB port.
-
Oct 27th, 2015, 02:44 AM
#5
Re: Problem with MSComm port
I agree that for such applications that would be a far better solution.
People seem to have no clue that jamming devices into random USB ports over and over creates so much crud as Plug and Play struggles to keep up with the insanity. USB ports are not wall sockets but expansion ports just like ISA, PCI, and other bus slots.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|