VS 2010 Serial Port Communication?
Dec 31, 2010
I'm trying to read data coming from a serial port. I simply want to ignore all other data besides the string "button_pushed". The device actually writes "button_pushed" to clean up the display when viewing the serial connection from console or similar. I can change this easily but I'd like to keep it if possible.
My code is as follows:
[Code]...
I'll get an IOException from readLine(). I tried using readExisting() which prevented the error but results in the block being executed twice (probably caused by the "") so the log reads "No data match" and "Data match" for one button push.I have a few questions. First, why does ReadLine cause an exception? I tried to negate that with is_closing but it still occurs. Second, will I run into problems using readExisting as it reads the entire buffer?
View 1 Replies
ADVERTISEMENT
Feb 22, 2012
I am using two computer to connect to each other via serial port, I have made a program in VB that allows me to read from the serial port then store whatever that character is to a variable. The only problem is I have to hit a button to read in from the serial port and pass the character to the variable. Is there any way to do this automatically?
View 6 Replies
Dec 30, 2009
i'm creating a windows form to send/receive data to/from serial port.At first : i send the data as string to the serial port .Second: i tried to read the string again for test the successfull transmission , but i recieved empty string
[Code]...
View 4 Replies
Feb 9, 2009
I am using two serial port in my programm.What is want is, i need to receive data from one port and send on another port and vice a versa.This code receive data from one port but can't receive data from another port. I have tried to simulate this code by using hyper terminal and it works properly with both com port. Where as i have written code in Vb6 too and its is giving same problem as giving interupt while recieved data from one port but not giving interupt which receiving from another port. I know the another way to receive data is by using timer and read data by command as readline(), but what to do to make both the port gives interupt which receive data.Please help to find out the porblem, the code is in Vb.net and it is as under.[code]
View 1 Replies
Dec 23, 2011
I am trying to get serial port communication working between two PC's.
My environment is: XP SP3, 9 pin serial ports on both ends, connected by a null modem cable, Visual Basic 2010 Express.
I have a sending routine and a receiving routine, both based on the on line documentation.
There are no Errors, Warnings or messages.
Problem: The receiving machine shows no sign of receiving a message sent by the sending PC. I have tried making the sending PC into the receiving PC - makes no difference.
My sending routine looks like this:
Sub SendSerialData(ByVal SendData As String)
'Send string to serial port
Using com1 As IO.Ports.SerialPort = My.Computer.Ports.OpenSerialPort("COM1", 9600, Parity.None, 8, StopBits.One)
[Code].....
View 1 Replies
Apr 10, 2009
How do I implement Serial COM Port communication?
View 1 Replies
Nov 14, 2011
I am trying to interface an instrument that I send orders to.An order consists of 4 lines which I am to write to the serial port one at a time and receive an ACK before sending the next line.I have interfaced in the past using the MSCOMM, I'm new to the Serial Port class. But even then I've always received data, never sent anything.My question is when I'm looping through my 4 lines of my order, at what point do I receive ACK? Obviously, not in the same function, right? And how do I know I received an ACK and can go on to output the next line?
View 2 Replies
Nov 1, 2010
I am working on an application on serial port communication with PLC machine. Now this communication is only done with one PLC at a time. So I m sending a query to PLC and until its responds back the application goes into wait mode. i.e. no other operations can be done, and an hourglass cursor should be displayed with all other components locked on the form. So how do I achieve this using vb.net?
View 3 Replies
Aug 6, 2009
tell me the settings required for serial port communication
View 1 Replies
Feb 7, 2012
I am trying to create a client server application. I am going to make this simple so that a basic chat application. I have gone through these tutorials:
[Code]...
View 1 Replies
Jul 9, 2007
I have a VB2005 application that sends and recieves data with another application (3rd party, not vb 2005) via COM port. When I run the apps on different computers they work great, they send all data to eachother and everything is fine. When I run them both on the same computer with either virtual null modem ports or with 2 hardware ports connected together via null modem cable they stop communicating.
[Code]....
View 5 Replies
Jun 16, 2010
In my application I am using MSComm32.ocx control for the purpose of serial port communication.
when i am using it I am getting a following error while writing data to the port.
"AxMSComm1.Output {"Exception from HRESULT: 0x800A018A (CTL_E_GETNOTSUPPORTED)"} Object "
I am writing the output to the port like below. AxMSComm1.Output ="Hello"
I mention the properties of the ocx control in the form load like below. AxMSComm1.CommPort = 1
AxMSComm1.Settings ="9600,N,8,1"
AxMSComm1.InputLen = 0
AxMSComm1.PortOpen =True
I searched for this error in the net.But I am not found any information for this issue.
can anybody explain why I am getting that error and how to resolve it???
View 5 Replies
Sep 4, 2009
I have a VB.net app running on one computer, displaying text into 2 texboxes or labels.I need to see the two values in two sperate textboxes or labels from the two labels on another computer via a null modem serial adapter.
1st computer.
Code:
serialport1.writeline(label1.txt)
straight forward right?
2nd computer to read the data
Code:
Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
dim s as new string = serialport1.readline()
label1.text = s
This is what I was thinking;
Code:
serialport.writeline(label1.text & label2.text
This would send the two values over the serial port. How would I seperate the two values and display them in two different texboxes?cannot use them together)Am I on the right path at all? Or using the serialport.writeline method won't work at all....
View 4 Replies
Jun 16, 2010
I am using MSCOMM (mscomm32.ocx) for serial Comm. using VB.NET 2005:
Receiving Error: "AxMSComm1.Output {"Exception from HRESULT: 0x800A018A (CTL_E_GETNOTSUPPORTED)"} Object "
How to resolve this Issue, Below is the code snippet which i am using. [Code]
View 1 Replies
Mar 10, 2012
as i learn VB 2010 express, i want to try some serial communication and i found this code for VB6..but i have no idea how to make it work in VB2010?
Private Sub Form_Load()
MSComm1.RThreshold = 44 'transfer data into VB program only after receiving 44 characters into buffer
MSComm1.InputLen = 0 'i think only for receive data & not for sending data ...check
MSComm1.CommPort = 1
[code]....
View 4 Replies
Jan 10, 2012
I implemented a serial communication between a PC and a circuit based on ATMEL mP, managing the submission of correct / incorrect reception of commands ... The following code works, I wanted a block on the performance and reliability as it is for me very important part of this project that I'm doing.
Public Class frmTrattamento
Dim IsStart As Boolean = False
Dim inputData As String = ""
Dim Stmp As String = ""
Public Event DataReceived As IO.Ports.SerialDataReceivedEventHandler
[Code] .....
View 1 Replies
Aug 16, 2011
i am a absolute beginner and i want to use vb to receive data from micro controller through serial port using rs232 standards, i found this code to receive the data serially, can any one tell me where should i paste this code, so that the data received will be displayed in message box.Private Sub DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) HandlesSerialPort1.DataReceived
[Code]...
View 9 Replies
Oct 26, 2011
The link below has code to connect to a modem thru the serial port but it is for an earlier version of VB. when I convert the code, it does not fully convert and has 4 errors that prevent building the project. can someone tell me what needs to be changed or added?
[URL]
Note: the error: not CLS-Compliant
View 8 Replies
Jun 3, 2012
I am trying to buld a DLL in VB.NET 2010 that will be use to control a vending machine.Whin a call into the DLL to a function to open and setup the comport the first time its opens it just fine, but if a call into the DLL again it does not know that the port is open even if it is still open. I can check with another program and is shows the port is open and if I try to call into the DLL again to open the port I get an error that the port is already open. Any idea how to set this up so it will work.
I need to open and config the com port in one call that leaves it open and then in other call use the com port to talk the equipment in the machine without closing the com port untill it is required to close it.
View 1 Replies
Jul 18, 2011
I want to send hex values across the serial port. I know, I know, your thinking not this again. But what I need to do does not seem to be addressed, or I am some how missing it when I search around.
[Code]...
View 2 Replies
Apr 3, 2012
Private Sub receive_data(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Dim aBuffer(255) As Byte
Do While SerialPort1.BytesToRead > 0
[code]....
Basically, what I am trying to do is everytime I receive data from the serial port, I turn that data into an array (aBuffer) and I then call another sub using that info.The problem I'm having is that everytime I receive data, the array only fills up to the first 8 bytes! This isn't a problem when I receive smaller packets of 6 bytes but anything else gets chopped off.
What is really frustrating is that it seems quite fickle. I've read somewhere that this happens because the computer is handling the bytes received faster than they are being put in the buffer?? Not really sure but if I put a couple of breakpoints during debug, sometimes the array fills up correctly... Note the maximum size of any one incoming message would be 255 bytes.
View 4 Replies
Apr 23, 2010
This is an amateur radio project. I have a TNC (modem) that receives a digital stream (AX.25) from my radio. The TNC decodes the AX.25 frames and translates them to KISS frames (the protocol used between the TNC and the PC, see documentation here: [URL] It sends the data as HEX values.
What I'm looking for on the serial stream is the beginning of a data frame marked by 0xC0 0x00 and ending with 0xC0. Should be easy. Using serialport.readbyte() I should get binary data that I can convert to hex and look for the beginning of a data frame and then convert the subsequent data to ascii, as it will be text from a chat session.
Just to try it out and see the raw data coming from the port, I use teraterm or realterm and capture the data and it's a mix of junk (control frames and what not) and valid text. When I display the same data in a text box in VB I get data that look like this:
[Code].....
View 5 Replies
Aug 31, 2011
I have a serial port hub with 4 ports. 2 of them work perfectly and the other 2 don't.I've found out that the 2 that don't work always have CTS, CD, and DSR on/true.The 2 ports "don't work" because they aren't able to receive a response.How can I turn off CTS, CD, and DSR holding? It seems that they are ReadOnly properties.I don't know if this will help, but I've recorded a log (recorded pin values every 1 second interval) for one port that worked and another that didn't.The one that didn't work:
RTS,CTS,DTR,DSR,CD,RI,TX Total,RX Total,TX CPS,RX CPS,Break,Overrun,Parity,Framing
0,1,0,1,1,0,9,0,4,0,0,0,0,0
0,1,0,1,1,0,9,0,0,0,0,0,0,0
[code]....
As you can see, the one that doesn't work has a value of 1 in CTS, DSR, and CD at all times. Also, the one that does work was able to receive the data, which is shown by the 14.
View 4 Replies
Mar 18, 2011
I got an Arduino hooked up to the PC and would like to read the serial port of it. I read the serial port in Visual Basic with com.Readline, but it won't read everything. It looses around 2-3 lines that were sent over the serial port to the Visual Basic code. They get "lost".
[Code]....
View 1 Replies
Mar 29, 2012
In my project I'm trying to send data to Serial port. I have added the serial port control to the form. Now if I try to send data to serial port using Serialport1.write method in a button click event, I'm able to send the data successfully to the serial port. Otherwise if I try to send the data using the same "Write" method from another thread other than the one in which the serial port component was created, I'm getting an exception saying serial port busy.
View 1 Replies
May 30, 2012
i'm using serial port monitor 4.0. i need to know how to received the data and show in a textbox.
here is how my data look like in the serial port monitor:
40 03 04 05 00 00 00 80 05 04 01 00 00 00 11 00 @......�........
80 07 04 05 00 10 00 01 02 02 14 80 07 04 05 00 �..........�....
10 00 01 02 02 14 80 07 04 05 00 10 00 01 02 02 ......�.........
[Code].....
View 9 Replies
Apr 25, 2012
how to convert received string to double.
I'm receiving string as 420.8 280.9 140.2 like this from serial port.. and transferred it into textbox..
I'm using following code to split string and to convert to double
Dim ReceivedText As String
ReceivedText = txtReceived.Text
Dim str_RY_1U, str_RY_1V, str_RY_1W As String
[Code]...
For calculating percentage RY_R is calculating fine.. But when it comes to RY_Y it showing error "string not in a correct format..."
View 3 Replies
Jul 12, 2011
What baud rates are supported by the serial port object in VB 2010?
View 1 Replies
May 1, 2011
I have conquered the problem of the database however what i need is the serial port data sent to a database and outputted on screen however i keep getting cross thread errors ..
Imports System.Data.OleDb
Imports System
Imports System.ComponentModel
Imports System.Threading
[code]....
View 3 Replies
Apr 11, 2012
I'm trying to make a rs232 serial data logging program, that accepts a 12 bit hex RFID tagID from an RFID module. My end objective is to save this RFID tagID into a database and assigned to a person for a personnel management system.I had to use button3 to add the value of the variable 'msg' into textbox1 because I was getting the following error "Cross-thread operation not valid: Control 'TextBox1' accessed from a thread other than the thread it was created on". It is a temporary workaround.When I do press button3, I get the incomplete hex number, instead of "4C00A2C82A0C", I get "A2C82A0C", and sometimes I get random digits like 1,A,C etc etc.
Public Sub OpenPort()
Try
If SerialPort1.IsOpen Then
SerialPort1.Close()
[code]....
View 4 Replies