Opening Serial Ports With The MSComm Control.
Opening serial ports using the MSComm control takes around .5 seconds. Closing the port also takes around the same time.
I have a program that needs to open 2 ports, print something, and then close both port before starting the program.
So far I have just disabled the main form and had a timer take care of it, and reenabling the main form, but I don't feel this is a good solution.
Is there a better way to handle serial communications? Is there an API designed for just this task?
Thanks.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
VB6, MSComm, Serial Ports?
Has anybody used COM ports, MSComm1, and detecting serial ports????
Does anybody know how to find out what COM ports are available on a computer using VB6. I found out that the WIN.INI file on my computer lists COM ports 1 throu 4 but that doesn't mean that they are available does it. For example when I look under Control Panel/System/DeviceManager/Ports all that is listed is COM1 and LPT1.
I have also tried openeing them with MSComm1 and catching the error if it is already oppened. My end result was 1, and 2 are not used and 3 and 4 are being used. The unusual thing is when I send 2 bytes to port 2 I get two bytes back in my input buffer.I only have COM1 in device manager though. COM1 works fine.
Basically I am trying to find an INI file or someway to find out what COM ports are availlable on a computer. Any ideas?
MSComm And Bluetooth Serial Ports
Hi,
I'm working on a VB6 app. that uses the MSComm contro to connect to a Bluetooth serial port. Hower, when I attempt to open the port using COM 17 or 18 (the automatically assigned port number from the BT hardware), the control returns an error of "Invalid Port Number".
I assume this is a limitation of the control, but I'm not sure. Has anyone run into this or know of a solution/work-around? I would be willing to utilize another .OCX/.DLL if needed.
TIA!
MSComm Control Multiple Ports
Hi All,
Can anyone tell me if it is possible to have 2 comm ports open using the MSComm control?
Am I able to poll both ports sequentially (using the OnComm event), or do I need to close port 1 before I poll port 2?
Thanks in advance,
Max
Access Control & Serial Ports
I do hope this type of request has not been posted in the past but if so, I apologize.
I have developed a security access control keypad. The keypad memory will store the last 100 transactions through the keypad. A small hand held printer (Seiko) can be connected to my keypad's controller to enable the printing of these transactions (Audit Trail). As the software for the keypad was written by my pc board manufacturer, I am told the ASCII characters in the keypad memory could instead be uploaded to a pc hard drive and printed to a txt file. My keypad's controller connects to the hand held printer via a 9 pin serial cable.
I have recently had a request to connect directly to a pc to store via text file, instead of the printed thermol paper. The current configuration allows that once the printer has been connected, the internal print command commences immediately and repeats every 3 minutes as long as the printer is connected to the controller. If any of you wonderful programmers know of code that would enable me to resolve this issue, I would greatly appreciate any assistance.
Regards and happy coding
Paul
Serial Port Commucation. Can I Use MSComm Control?
Hello Everybody,
I connected a serial cable between two systems. In one of the system it said in the back of my cpu, the port is "SERIAL A". Then I included "MSComm Control" in my project and checked from ports 1 to 16. I didn't get any data from the other machine. Actually in the first machine I could run my program only in port 1 & 3 where port 3 is modem. For all the other port numbers it says "invalid port number". So I opened port 1 and repetedly posted a string in loop. In my second machine, only port numbers 1 & 2 were available. I didn't get any input from my other machine.
Please can any one help me......
Serial Port Commucation. Can I Use MSComm Control?
Hello Everybody,
I connected a serial cable between two systems. In one of the system it said in the back of my cpu, the port is "SERIAL A". Then I included "MSComm Control" in my project and checked from ports 1 to 16. I didn't get any data from the other machine. Actually in the first machine I could run my program only in port 1 & 3 where port 3 is modem. For all the other port numbers it says "invalid port number". So I opened port 1 and repetedly posted a string in loop. In my second machine, only port numbers 1 & 2 were available. I didn't get any input from my other machine.
Please can any one help me......
MScomm Control Serial Data Problem
I have been working on this very simple app to log an ascii data stream to a text file. This data stream is coming from a Fujitsu 9600 pbx. I have tried many things for some reason it just does not want to write the file how it is. It will print it to the text box fine but the file is all messed up. The file that I have included has the vb source, the logfile how it is now logfilewrong.txt, The old logfile that I had setup using straight redirection from a serial port on a linux box( which did not work correctly because it would timeout sometimes and cause the switch to close the port, the logfile was perfect though) I did not know enough c programming or other unix type languages to tackle the problem in that environment so I thought it would be really easy to do it in vb... Well it does not seem to be. Some people suggested using byte data types and put but that will not work this is an ascii stream with non numeric characters. I don't see this as being so hard all I want is an app that when it starts does this... Opens the port at 9600,7,E,1, Then logs all data to a text file opened for append, This logging is constant and there should not be a large buffer, At around midnight I have another app that I wrote that parses this file and loads the data into a database that is why I need it opened for append, I will move the file at that time and it will automatically make a new one that way I don't have dupe data in the database. Then It should close the file and port when terminated, which should be never I have been playing with the code moving the open and close statements but they should be in with the print statement to achieve the desired results of making the new file when moved... Any ideas???
Mscomm Control - Sending /receiving Data To/from Serial Port (com1)
I'm a newbie using Mscomm control..
I'm not able to send /receive data to/from the Serial port i.e. com1 using mscomm control....
Correct me if i'm wrong...the code is as follows
VB Code:
Option Explicit Private dummy As String Private Sub MDIForm_Load() ' handle the error if the comm port doesn't exsist On Error GoTo err_handler ' open both the send and recv form frmSend.Show frmRecv.Show ' test to see if the comm port is already open If MSComm1.PortOpen = False Then MSComm1.PortOpen = True Exit Sub err_handler: 'in case the comm port does not exsist If Err.Number = 8002 Then MsgBox Err.Number & " : " & Err.Description, vbOKOnly, App.Title frmSend.cmdSend.Enabled = False End Sub Private Sub MDIForm_Unload(Cancel As Integer) ' close the comm port if it is open If MSComm1.PortOpen = True Then MSComm1.PortOpen = False End Sub Private Sub MSComm1_OnComm() Dim pos As Integer ' test to see if we recv'd data If MSComm1.CommEvent = comEvReceive Then ' move the data from the input buffer into a variable ' keep adding the data as it comes in to the variable dummy = dummy & MSComm1.Input ' test to see if we have gottn everything pos = InStr(dummy, vbCrLf) If pos > 0 Then ' add the data to the list box frmRecv.lstData.AddItem Left(dummy, pos - 1) ' clear out the variable dummy = "" End If End If End Sub Private Sub cmdSend_Click() ' test to make sure something was entered into the textbox If Len(txtMessage.Text) = 0 Then Exit Sub ' send the message out the comm port mdiMain.MSComm1.Output = txtMessage.Text & vbCrLf ' clear the sent message from the text box txtMessage.Text = "" End Sub
Serial Communication On Serial Ports
I am currently trying to let the computer's serial port to communicate with a device with a serial port too. But this device uses a line feed function. Does anyone knows how to send a string with the line feed function?
For example, i want to send the string "DIAP<connect>E01D" How do i send this along with the line feed function?
Serial Ports
Hi all,
Is there a way to get a list of the available open serial ports ( without using the mscomm control). Specifically I am trying to determine which ports have a bluetooth device associated with it. Any help would be greatly appreaciated.
Thanks!
Serial Ports
I know it can be done I just dont know how!!
How do you read and write to/from the serial ports Comm 1,2 3 etc using VB????
I have searched (maybe not in the right places) and I cant find out how!!
Anyone?????
Serial Ports
heya gang...
I have been trying to access certain ports on my pc...com1 and ltp1 is there even a way to this in vb?? If so, how do i send and recieve data to these things?
Thx eh
Elon
Available Serial Ports
How can I determine the available serial ports? How to retrieve the
defined serial ports which appear in windows configuration/system ? Which
API function is suited for this purpose ?
Thanks
Serial Ports
I am trying to write a program that will open a serial port. Then the user can type a message and push send and the program will serve as a network protocol, sending the information to another computer that the serial port is connected to.
Any information you can give me would be greatly appreciated. I'm sure this isn't very hard, but I'm not aware of how to do it.
Need Help With Serial Ports
I'm new to programming and I am wondering the best way to use the serial port to recieve inputs from 3 simple circuits. All I have to do is to know which circuits have been completed and in what order they where completed in. This is for a knowledge bowl type of situation with three teams. Also can we recieve the inputs through the different pins of the serial port or do I have to make some hardware that gives each strip a different binary number. Any help would be much appreciated. thank you in advance.
Serial Ports And +5v
howdy,, i'm workin on a little project readin some serial data from an IR device,, what i need to know is a good way to get +5v outta a pin on the serial port,, anyhelp you got is great! (i relize this isn't much of a vb question, but i am using vb for the coding =) ) thanks for any help,,
Mscomm In More Than 16 Comm Ports
I am using VB to communicate with a embedded bluetooth device. The device act as a virtual commport.
The problem is that the device may connect in any available commport from 1 to 255. Using vb's Mscomm we can acces only 1 - 16 commports. The program works without any problem if the virtual comm port is < 16.....
I was able to use readfile api instead of mscomm control and able to acces all commport....... but i was unable to get the path name of the virtual serial port.
some one may help to tackle this problem.
R.V.Raghav
Mscomm (comm Ports)
I am writing an application that uses the MSComm Control. Will my application have access to the drivers/ports on a windows NT 4.0 Server that is not logged in? No, we do not have a server to test it on until we distribute it.
MSCOMM With Additional 232 Ports
My application requires the logging of 232 serial data from two sources. Since most computers only have a single 232 port, I bought an adapter (MOSCHIP 7720) which provides two additional 232 ports from a USB connection. The device works Ok and it creates two additional com ports (which my system calls Com2 and com3). Using HYPERLINK these ports work, but MSCOMM hangs up whan asked to recognise and interface with them.
Has anyone encountered such a problem or a suggestion as to how to overcome please?
camoore
MSComm And Disappearing COM Ports
Hi all,
Have an odd question/problem with MSComm control that I've not been able to find any details on.
I am communicating with a mobile phone, either via USB cable or Bluetooth (which both create virtual COM ports).
Now, everything is OK, until the phone is either disconnected from the USB cable, or is taken out of range of the Bluetooth connection.
With the USB connection, the COM port basically is disconnected from the system - it disappears from Device Manager. With Bluetooth the COM port stays active, but just disconnects itself from the phone.
In either of these situations, the MSComm control crashes the VB application, and it has to be closed from Task Manager.
Does anyone know of a way around this happening? This is going to be integrated into my main application (a CarPC media/entertainment/GPS/phone control/everything-from-one-place application), and as such I can't have it crashing!
Any help/ideas/tips/advice will be GREATLY appreciated!
Thanks in advance
Garry
Controlling USB Serial Ports
Hello,
I've created an application in which I've utilized the MSComm contorl
to allow access to the serial ports. Unfortunately my customer would like
to use USB Serial ports. I've found in Microsofts stuff that MSComm does not support USB Serial Ports.
Does anyone know how to control USB serial ports in VB 6.0.
Thanks in advance for any assistance.
Virtual Serial Ports
Suppose your PC has 2 serial ports: COM1, COM2. Suppose you need to let your program user see a COM3 which you want to redirect (e.g. you want to send the output strings of this virtual COM3 through the Ethernet card and to to read in the COM3 receive buffer what is coming from the Ethernet card). Does anyone know how to provide such an "illusion" (COM3 does not physically exist but a serial communication program can use it)???
Thanks in advance!
Virtual Serial Ports
Hi Guy's
I need to include a means of creating virtual serial ports in my program.
A realy good example is the program "Virtual Serial Ports Kit". (here)
This neat little app can create a pair (2) serial ports that are bridged together, so what is outputted on one port is inputted to the other,
as if you had 2 real serial ports bridged with a serial cable.
Is there a free ActiveX or .dll that can do this ?
Thanks
Oly
Serial Ports Not Being Released
From time to time my VBasic application is not properly releasing the serial ports. Even after closing the program Windows says that the port is being used by another program (Port already open Err Code 8005).
Only thing I can do to release the ports is to restart the PC.
Number Of Serial Ports
Can anyone tell me if there is an api call that can get the number of available serial ports on the machine that the software is running on. There has to be something because the device manager knows. I had a good link to all of the api calls on the M$ web site but lost it. Now I can't find it. if someone knows that to I would appreciate that information also.
thanks for your help.
Jason
Does Anyone Know How To Program Serial Ports?
I'm new to programming and I am wondering the best way to use the serial port to recieve inputs from 3 simple circuits. All I have to do is to know which circuits have been completed and in what order they where completed in. This is for a knowledge bowl type of situation with three teams. Also can we recieve the inputs through the different pins of the serial port or do I have to make some hardware that gives each strip a different binary number. Any help would be much appreciated. thank you in advance.
Explain Ports With Winsock And Mscomm
Ports, ports, ports!!!
I work with this stuff but don't know the true meaning of ports. In winsock, i usually use ports in the thousand figures like port = 1006, 1735, etc
but in mscomm I only use like port 1 to 5.
What does all this mean? I believe the definition of 'port' for both controls are different...it's something to do with hardware configuration..or working with one computer rather than a network of computers. I hear people speaking this stuff but no one had explained it to me correctly..or maybe they don't know either!
I'm not a computer science major, never had classes to explain this..but I am interested so I have a better idea what is going on..It will help me explain it to people and make better decisions on the way I will write my applications.
Any good books or articles I can read?
I appreciate your help.
Reusable Configuration Dialog For COM Ports (MSComm)
Colleagues,
It turned out that there is no reusable configuration dialog for serial COM ports for Visual Basic on the web. So, I wrote one in VB6.
The source code and write-up are here http://www.codeproject.com/useritems/CommConfig.asp
Just wanted to share and to get some feedback!
Nick
Reusable Configuration Dialog For COM Ports (MSComm)
Colleagues,
It turned out that there is no reusable configuration dialog for serial COM ports for Visual Basic on the web. So, I wrote one in VB6.
The source code and write-up are here http://www.codeproject.com/useritems/CommConfig.asp
Just wanted to share and to get some feedback!
Nick
Show All Serial Ports And Modems
Hello !!
I need to show in the combo box all serial ports and modems installed in the PC... I see HKEY_LOCAL_MACHINEHARDWAREDEVICEMAPSERIALCOMM in the windows registers but ... How i can to get that information with VB? Any Clue?
Thanks for your help and your time!!
woman in love
Probably A Stupid Question On Serial Ports
how can i verify if in a loopback cable (the TD pin with the RD one, RTS with CTS and DTR with DSR and CD in the same cable) the various connections between the pins are ok? i hope you understand my horrible english... thanks for your answer.
Working With Multiples Serial Ports
hi
i have a system that will work with 30 serial ports on PC. How is the performance of VB working with so much serials?
The machine is a Dell Pentium 4 with 128 MB RAM.
thanks
daniel
Question About Serial Ports And 2 Files In One....
Hey guys!
Plz, anyone know if this 2 things are possible to do with VB....
I need to do some stuff for a client and I will need do something like it...
1- Vb can send/receive information trought serial port as com 1,com 2 or usb... etc.. any port? =-)
2- Theres a way to put 2 or more files (any kind) in one? Like Can you create a proccess that gets 2 exe and put in a file with a new extension and them make the opposite.. Get this one file, and extract both exe from it?
Thanks in advance
Elminster
Can I Use The Parallel Printer Port As An Alternative To The COM Ports Via MSCOMM?
I use VB6 Learning edition and thus have no MSCOMM control.
If i used an adaptor cable to switch the LPT port to a 9-pin serial lead, could i reliably send ascii data to a serial compatible device?
for example if i had a geiger-counter device that is able to be controlled by a RS-232 (serial) cable, could i plug it into my LPT port and use printer commands to control it?
Note instead of Printer.enddoc and stuff like that, i would use :
Code:
Open "LPT1:" for output as #MyFileNum 'i know this technique works to print onto paper
print #myfilenum, "BS 001 02022" 'ascii command recognised by geiger
close #myfilenum
???
summary: Can i control any serial device via the printe port without the MSCOMM control?
Serial Comm Ports... Silly Question.
I like very much this subject and i am already reading some guides, the problem is, the xplanations always assume so much sttuff and it is definetely not sth easy to swallow... i was thinkng... YOU the people who actually work with this sttuff in their daily routine, do you use special controls or dll components with VB to access ports and so on or you go all by yourselves... also, IF SO, (i suppose) what controls are preffered and how much do i need to know to use it (just the basics)
Something On Webcams And Serial Ports... (and Voice Ctrls)
Hi everyone,
i have a pair of questions for you! Help me please!
1) How can i manage my webcam in a VB program? Is there a control for this?
2) And for the serial(or parralel) port?
3) Does anybody know how to make my directSS speak in italian? It speaks only in english or with english pronunciation!
4) Can you explain me how to use voice recognition in VB?
Thanks a lot!
REgarding Serial Port Communication With Greater Ports
Hi,
Actually i have to set serial ports greater than 16 for communication.
for that i used
There was a hack that came around about modifying the MsComm control to
access greater than 16 ports:
"In the code there is a unique sequence of three bytes, 3d 10 00. Pick a hex
editor and change the value 10 to say 7f. Now you have changed the default
value of a variable MAX_PORTS to 127. The name of the variable is arbitrary.
Save the changed file and off you go." the problem in using this was when some one reinstall the setup the ocx which we created is getting replaced by the old ocx so is there any way to replace an ocx(Mscomm32.ocx) which is being used by the project by another ocx which i has made by hacking the existing ocx and stored in the system file ,this has to replace the system ocx which is used by it at runtime .
give me other ways also for setting up communication with the higher ports
Opening Ports
hi, could someone please help me. I've been searching all over the web, i need a way to open ports from my application. i've tried to fathom it out but to no success. please help. thanks in advance.
Opening Ports On Winsock
How can i open ports with winsock, anyone know? Would it just be
Code:
Winsock.localport = "90"
Winsock.listen
?
Winsock Opening Ports?
Hey
When I use winsock, doesn't it open my ports?
If it opens my ports I'm not happy, because hackers can get in my system. Is there anyway to only let my client-app have access?
Thanks
VB3 - Opening The Com Ports For Data?
I need to read data (ASCII) from a device connected to a Com port. I can do it in VB6 but I need to do it in VB3 for to work in W3.x. Anyone know of any VBX controls or code?
Thanks.
|