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)
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Use Comm Ports
I have a selfmade keyboard which is connected to the commport
how could i use mscomm to get the commands from the board?
Comm Ports
Just a quick question!
Is the use of comm ports and printer port to hard for a Beginner ??? I have an Eeprom Programmer that I would like to write a Windows interface for.
Thanks!!
Comm Ports
hello!
how can i close all of the comm ports on the computer using vb?
thanx
Comm Ports In W98 And W2k
Got a weird glitch in a piece of code. I'm reading data in from a comm port using MScommctrl. It is kind of a clock signal that is read in in binary and converted to a integer # and displayed. each second or so I get a new "pulse" of about 6 characters. I developed the program on a w2k machine. It works fine ... but when I migrate to a w98 machine ... it doesn't work. The best way to describe the error is to say with my Rthreshhold is set to 1, by the time w2k gets to the OnComm event ... the other characters are already in the buffer, where as in w98 it seems only the first character is in the buffer. Are serial ports handled that much faster in 98? Does anyone have any idea's on how to fix this problem?
Comm Ports?
How do you detect how many Comm ports are on a computer?
Comm Ports And VB Can You....HELP!!
Help VB Gurus!,
I am working with a problem that I HOPE can be solved using VB, perhaps using API calls, but the only API code that I use is borrowed, moved to modules and accessed with functions that I understand because the API is way beyond me. Here is a basic outline of the problem:
A PC on a ship needs to communicate with an MCS system that monitors a large number of sensor inputs around the ship. The current method of doing this uses a form with a mscomm control and a Timer control. The Timer control checks the I/O status (ie sends a request for certain sensor inputs, or Waiting for a response). The mscomm_OnCom event is used to trigger data retrieval and processing. Everything currently works fine until a user begins to drag windows around or do other things that occupy the system for more than 2 seconds (the MCS drops communication after a 2 second timeout limit) and then the monitoring system crashes (or ceases to monitor). The problem seems to be that the VB code is not “High” enough in the system priority list. The obvious answer is to have a computer dedicated to the sensors, but because of space limitations this is not a desirable solution. The ultimate goal of the app is to store real time sensor data in a database, and to allow the user to select which sensors to monitor. The MCS system can accept a request for up to 70 sensors in a block and the communications take around 2ms from request for data to data recieved …. Ok, enough back ground. Four solutions seem viable: 1) Use the API to adjust the priority of the VB app at run time. So that no matter what the user does the Monitoring app receives processing time for at least 2ms out of each second. 2) Write the equivalent of a “TSR” that handles the I/O and keeps the MCS connection open and either places the data in the database or holds it in a buffer that the App can access. 3)Use "C" to write an interface. (I have NO experience with C, but understand that it allows a great deal more control over the OS than VB.) 4) Find or Develop an interface card that will allow communication with the MCS to remain open and communicate with the program in a less time critical manner. (Least desirable solution).
Any help and/or suggestions on how to accomplish the goal would be greatly appreciated. I find myself in way over my head. I hate it when everything works except when the client goes to use it, and then he does things that weren't part of the description!
Thanks,
Hunter
ps. There is a similar post in the API forum. In case any one else is interested in this sort of problem I will post replies here if there are any viable solutions posted there and vice versa. Thanks again!
Comm Ports
I am currently creating a VB app to run on a laptop or PC and to allow the user to choose to print a barcode label from an IP address, comm port, or a local printer. The problem is I do know how to programatically figure out how many comm ports the laptop/pc has and to display the appropriate number of the available comm ports in a drop down box to allow the user to select which one the app should use.
Any help would be great on how to do this.
Thanks
Comm Ports
How easy is it to print characters to the comm port?
I am a Qbasic user who currently uses the OpenCom statement.
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.
Listing COMM Ports
I know this has been discussed before but the search feature has been disabled. What I am looking for is a way to find the current COMM ports on the system running my program.
Thanks in advance!
How To Detect The No. Of Comm Ports
Hey ,
Can u guys pls tell me is there any method to detect the number of Comm ports in a machine.
IF its stored in registry then whats the path or is there any API for that
Thanks in advance
Detecting Comm Ports
Can anyone tell me how to use VB to detect which
comm ports (COM1, COM2, etc...) are installed on
the computer the app is running on?
Much thanks if you can.
Guinness
Selecting Comm Ports
Hi People,
I have a form with a menu called Communcation>Comm Port>Comm 1 ....through to Comm 8.
When i click on a comm choice i want to select that comm port, but how do i code that?
I know i can do PortOpen, but i want to have it so only 1 comm choice can be 'checked' at one time. and so that only 1 comm port can be used at one time.
Also being quite new to this VB thing i'm not sure if this next question is v hard or easy....but here goes.. what would be ideal is for the software to determine what comm ports are present on the machine and dissable the non-present ones within the menu dropdown. How do i do that??
Any help, or sample code of choosing comm ports would be excellent. Even i nudge in the right direction would be appreciated
Many thanks
John
Number Of Comm Ports
How can I get the number of comm ports on a computer? I want to have a settings dialog for my program that allows you to select the comm port to use for the serial communications. Is there an easy way to do this?
Big Trouble With Comm Ports
The target machines for my application have comm ports 1,2,5,6. I would still like to use my application on machines with less than that number of comm ports(just with lost functionality)
I'm using this function
Code:
Sub SVO58ports(i As Integer)
'This sets up the ports for the SVO5800 VCR
MsgBox "before case"
Select Case i
Case VCR1_INDEX
MsgBox "case 1"
VCRForm.VCRComm(i).CommPort = SVO58PORT1
Case VCR2_INDEX
MsgBox "case 2"
VCRForm.VCRComm(i).CommPort = SVO58PORT2
End Select
MsgBox "after case"
On Error Resume Next
For j = 0 To 1 Step 1
MsgBox ("j =" & j)
VCRForm.VCRComm(i).InputLen = 0
VCRForm.VCRComm(i).PortOpen = True
If Err And (VCRCommFind(i) = True) Then
MsgBox "VCR " & i + 1 & " is unavaliable"
VCRCommFind(i) = False
Err = 0
Else
If VCRCommFind(i) = True Then
VCRForm.VCRComm(i).InputMode = comInputModeBinary
VCRForm.VCRComm(i).Settings = "38400,O,8,1"
End If
End If
Next
End Sub
When i am in the development environment, this works perfectly fine.
If i make an exe i get as far as message "before case" before i get a run time 91 error.
Number Of Comm Ports
I have as system with 20 serial ports.
I have used the comm control to access
the first 16 ports, and then used some
api functions to try using the
remaining 4 ports using ....
Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (byval lpFileName as string, byval dwDesiredAccess as Long, byval dwShareMode as Long, byval lpSecurityAttributes as Long, byval dwCreationDisposition as Long, byval dwFlagsAndAttributes as Long, byval hTemplateFile as Long) as Long
Declare Function ReadFile Lib "kernel32" (byval hFile as Long, lpBuffer as Any, byval nNumberOfBytesToRead as Long, lpNumberOfBytesRead as Long, lpOverlapped as Long) as Long
Declare Function WriteFile Lib "kernel32" (byval hFile as Long, lpBuffer as Any, byval nNumberOfBytesToWrite as Long, lpNumberOfBytesWritten as Long, lpOverlapped as Long) as Long
and so on, along with some other calls.
My problem is I can't access the ports 17-20.
The api calls work fine when I use them for ports 1 -16 and I can access ports 17-20 using hyperterminal.
Does VB not allow access to more than 16 serial ports?
Curt
Unassociating Hardware (COMM Ports)
I am developing code for a device that uses an FTDI USB<>RS232 chip. Every new device I plug in gets assigned a different COMM port, instead of using the first available. In other words, I have COMM ports 3-9 marked as "in use", with no hardware attached; when I try to re-assign the COMM port number. Apparently Windows is attaching a COMM port for each new board I plug in.
When I plug in a device, its trying to use COMM port 10, instead of 3, even though only COMM PORT 1 is the only port showing in hardware manager. I know Windows (2000) is remembering the association somewhere in an .inf, but where??
Shot In The Dark (Comm Ports)
Hi all
I have a program that uses 6 comm ports through a USB to serial convertion.
Now the 6 comm ports are running at:
3: "4800,n,8,1"
4: "19200,n,8,1"
5: "9600,n,8,1"
6: "1200,n,8,1"
7: "9600,n,8,1"
8: "9600,n,8,1"
now when I run the program it communicates fine with all of the comm ports.
I then close the program, and then try to run the program again, and it fails to communicate with comm port 6. (the comm port using "1200,n,8,1")
if I move the comm ports around it follows the device communicating at "1200,n,8,1".
The only way I can get it to work again is shutting down the computer and restarting.
arrrgh
Has anybody had this problem before and is there a way around this.
Thanks in advance
Device Names On Comm Ports
Hi Guys
Can somebody help me I am new to eVB. I am trying to get the names of devices that are on a comm port to be displayed in a listbox. I have seen this done in other programs like ones that let you select what comm port a Navman is on.
Thanks for any help
Using An Array To Check/assign Comm Ports?
I'm sure this is something real fast and easy but I've been trying different things for a couple of hours and so far have had no luck. I'm really hoping somebody can point me in the right direction on this one.
I downloaded (from here) this .zip file which creates an array based on commports from 1 to (whatever you declare as a constant). Then it checks if that commport is available and if so makes it enabled in a menu (which is generated from the array).
It works great but I'm trying to do a couple of additional things. One, I want to assign the "default" comm port from a database file (which I'm currently doing). When the program is launched, I want the currently selected comm port to be "checked" in the menu list. Also, if the user selects a different comm port from the menu, I would like to make that commport be an integer so that I can then store it in the database (as the new default comm port).
I've been trying several things but each thing has not worked. I've gotten errors from Wrong Type to Variable Not Defined.
Does anyone have any suggestions on what I'm doing wrong. I'm including the "original" code (because the code that I've been working on is just riddled with comments and commented-out errors.
I'm pretty sure this is a quick, no-brainer type of fix but it is just not clicking for me (sad, I know).
Any help would be greatly appreciated.
DTFan
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?
Writing Files In The ESRI Shape File Format, COMM Ports
I am trying to create a small application which allows the user to save the work they are doing as a ".shp" file, that which is used for ESRI ArcView. My application includes linking a GPS receiver to a iPAQ, and then reading the imformation from the GPS and allowing them to map geographical features they want. I also need some help in regards to programming for comm ports so I can read the data from the GPS receiver
If anyone is able to help me I would be really appreciative if you could contact me.
Dane Harkin
Undergraduate Student
Department of Geospatial Science
RMIT University
GPO Box 2476V
Melbourne Victoria 3001
Australia
Email: daneharkin@hotmail.com
Vb To Pic Serial Comm
hi there, is there any way to see in my form the data that I'm sending via the comm port? thanx in advance
Serial Comm Help
I am trying to use the mscomm to receive about 40kb of data at any one time and process them immediately. The end of the data packet is signalled by a byte value of 3. I am using the oncomm event. However, when the baud rate is lowered from 115200 to 9600, i don't seem to get the byte value of 3. The code is as follows:
Code:
Dim dataInputBuffer(1 To 45000) As Byte
Dim counter As Long
'MSComm1 input mode set to binary, inputlen set to 0
Private Sub MSComm1_OnComm()
Dim i As Integer
Dim dummy() As Byte
Select Case MSComm1.CommEvent
Case comEvReceive
dummy() = MSComm1.Input
Call ProcessData(dummy())
End Select
End Sub
'This is just for debugging, the actual implementation is different
Private Sub ProcessData(ByRef dummy() As Byte)
Dim i As Long
For i = LBound(dummy) To UBound(dummy)
counter = counter + 1 'counter is 0 at startup
dataInputBuffer(counter) = dummy(i)
If dataInputBuffer(counter) = 3 Then 'End of packet
' dataDisplay is just a text box
dataDisplay.Text = dataDisplay.Text & "Success! "
counter = 0
End If
Next i
End Sub
The problem is when the baud rate is 115200, i do see "Success! " being displayed. But when the baud rate is lowered to 9600, i don't see anything being displayed after 1+ minutes since the commence of the sending of the data (9600 baud is necessary for my application). Any form of help is greatly appreciated.
Serial Comm Help
Hi all ,
I am trying to input barcode data thru a scanner into a textbox. here is the sample code iam using
If MSComm1.InBufferCount > 0 Then ' If theres data in comm buffer
Text3.SetFocus
Text3.Text = Text3.Text & MSComm1.Input
End If
The problem i have is if i scan a barcode that contains 11004700450 , the text3 contains only 11004700 and mscomm1.input has the remaining characters . its not adding the whole value and displaying it into the text3.
need ur thoughts
Serial Comm
Hi, I'm doing the serial comm through RS232, with the following code, I cant receive the data in the sequece what I want. Eg, the transmitter send "ABC" continuously, I might receice it as "ABCABCCBAABCBAC......." etc. Anyone can tell me what is going wrong? Thanks an advance!!!
Private Sub Form_Load()
With MSComm1
.CommPort = 5
.Settings = "9600,N,8,1
.RThreshold = 1
.InputLen = 0
.PortOpen = True
End With
End Sub
Private Sub MSComm1_OnComm()
DIm tmpstr as string
tmpstr = MSComm1.Input
Text2.Text = tmpstr
End sub
Regards,
pingping
Serial Comm App On Win XP Pro
Dear All,
I had Serial Comm. App (developed by using VB6) .. it runs properly on Win 98SE, when trying to run on Win XP Pro .. I got Windows error (it asks me to send error email to Ms).. my question is: is there any special treatment/trick for doing this on XP? .. I need advise
Regards
Teddy
Serial Comm In VB
Can anyone tell me how to show rs232c reception as it is, ie 0's & 1's. I have to make a prg wherein the input is 5 bit and in iat2 format...for teleprinters...it is differen from ASCII i have to stop Mscomm from interpreting it as ASCII??
Bluetooth Serial Comm
i am doing a vb program which make use of bluetooth to communicate between two computers. the bluetooth set is connected to the serial port of the computers. i got no problem communicating by direct cable connection of the serial port but using bluetooth, i need to know the target bluetooth device which the master need to find to communicate with the slave. anyone got a clue about this?
Serial Comm With No Response
Hi guys,
I'm trying to communicate with a UPS in ASCII at 2400,n,8,1 with this simple code:
MSComm1.PortOpen = True
MSComm1.Output = "Z" & vbCrLf
Sleep = 1000
MSComm1.Output = "Ax 1" & vbCrLf
'Sleep = 1000
MSComm1.Output = "Uv" & vbCrLf
Sleep = 1000
Text1.Text = MSComm1.Input
MSComm1.PortOpen = False
but I can't get response from the UPS, Z and Ax 1 are for start communications and Uv to get the utility voltage (12737=127.37 volts)
When I try in HyperTerminal it works fine but not in VB.
Please, some ideas why is this happening?
Serial Comm Problem
I am writing a simple serial comm program to communicate with a motorolla microprocessor. the microprocessor accepts ascii characters and sends the following string when reset (in hyperterminal):
BUFFALO 3.4 (ext) - Bit User Fast Friendly Aid to Logical Operation
With my VB prorgram i get the following after reset:
LO 3.4 (ext) - Bit User Fast Friendly Aid to Logical Operation
It should also respond to commands such as mdxxxx (show memory contents xxxx) and give errors when unknown command, which it does in hyperterminal but in my program it echos back what ever i send to it.
so i'm wondering if anyone has any ideas as to why it does this and how to fix it, thanks in advance
here is my code:
Code:
Dim sendstring As String
Private Sub form_keypress(keyascii As Integer)
Text1.SelStart = Len(Text1.Text)
'if key pressed is letter
If ((keyascii >= 32) And (keyascii <= 126)) Then
Text1.SelText = Chr(keyascii)
sendstring = sendstring + Chr(keyascii)
'if key pressed if CR
ElseIf (keyascii = 13) Then
If (Len(sendstring) = 0) Then
Text1.SelText = vbCrLf
Else
Text1.SelText = vbCrLf + "<<MESSAGE SENT>>" + vbCrLf
MSComm1.Output = sendstring
sendstring = ""
End If
'if key pressed is backspace
ElseIf (keyascii = 8) Then
If (Len(sendstring) <> 0) Then
sendstring = Left(sendstring, Len(sendstring) - 1)
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
Text1.SelStart = Len(Text1.Text)
End If
'if any other key pressed
Else
MsgBox "Invalid Entry"
End If
End Sub
Private Sub Form_Load()
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
If (MSComm1.CommEvent = comEvReceive) Then
Text2.SelText = MSComm1.Input
End If
End Sub
Serial Comm Help A Newbie
Hi,
I'm new to VISUAL BASIC 6.0
can anyone help me to send some data over my serial port ?
I know that I need to use MSCOMM32
Here is my initalisation of the port
Private Sub Form_Load()
MSComm1.CommPort = 2 ' COM port number (1,2,3 for COM1,COM2,COM3 etc.)
MSComm1.Settings = "115200,N,8,1" ' set baudrate
MSComm1.InputLen = 0 ' disable input
MSComm1.PortOpen = True ' open port
End Sub
PROBLEM: When I run it, I get an ERROR: OBJECT REQUIRED
What does it mean ? do I have to load the MSCOMM32, how ?
Thank you,
Adi,
Serial Comm... How Can I? ... New2vb6
I am fairly new to VB6. I am working on a project of converting a dos batch file routine into a VB6 form. The batch file called a text file that had text and control characters. Each file had about 30 lines in it. There are nearly a thousand of these files now and I would like to call them from my VB6 form and copy to the com port. (Without have to edit the files). After that, addition information from the form needs to be sent to the com port. I know how to Open the com port from vb6 and write form data to it. I'm just wondering about the exsisting text files.
Thanks for your help in advance
Serial Comm To A Projector Rs-232
Hi,
I am tiring to control my Electrohome projector using it's rs-232 port I have all the Technical Bulletin that tells me what to send but I do not know and have not be able to find information how to do this.
the Tech Bulletin can be downloaded from:
http://rennfast.dns2go.com/Public/CR..._bulletins.zip
I have attached some C source code found from another site (but I do not know how to accomplish in VB).
From: http://www.ks.uiuc.edu/Development/MDTools/projector/
any help would be appreciated.
Thanks,
Jason
Serial Comm Problem
I am trying to send a 5 byte data stream across the serial line. I am currently using the RTS line but the timing is way to slow (about 28msec/bit or 35 baud) I need to run at 2400 baud. can anyone tell me is there a way to get this speed out of the RTS line using the following method of placing the RTS line into a high or low state.
mscomm1.rtsenabled = true
mscomm1.rtsenabled = false
If there is no answer can anyone please tell me if there is a way to control a single transmition pin. The programming language I am using for this project is visual basic 6.0.
Patrick Foley
foleypmaa@sbcglobal.net
Serial Comm. For More Than 1 MB Data
Hi all,
after a long time. this problem is somewhat related to VB. I am writing code for comm between VB and microcontroller. thru RS232. I use Modbus protocol. but it has limitation of 256 bytes. I have to send 2MB data. So i want to know is there any protocol for that or i have to develop my own protocol.
Eagerly waiting for reply
Thanks
Yogi
Serial Comm And Pocket PC
Hi...
I´m not sure if this is the correct forum to post to, but...
My problem is that I´m trying to implement an application for a Pocket PC, that is capable of writting and reading the serial port.
I am trying to use Windows API´s CreateFile, WriteFile... However, I find that there is no API for setting the state of the serial communication (in Visual C++ I use GetCommState and SetCommState...)...
Has anybody worked with something similar?
Thanks in advance.
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,,
|