Reading From Serial Port Into A String

Oct 22, 2009

For starters I'm using VB 2008 express edition.I have code that writes a string out of a serial port.My issue is that the machine sends data back and I don't know how to catch it.This is my latest attempt at creating an array of characters to create a string later but doesn't work.[code]

View 2 Replies


ADVERTISEMENT

Reading String From Serial Port

Mar 2, 2010

I do not have much experience with VB.What I need to do is to read a serialport as a hexadecimal string.I've done this with the MSCommlib, but now want to convert to system.io.ports.The equipment wich is connected to the serialport is a RFID card-reader, so the application haft to detect when it is receveing data, and then continue on.[code]

View 5 Replies

Reading Serial Port Read Data From Serial Port?

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

Reading From A Serial Port?

Feb 22, 2008

I am working on barcode reading software. Runs ok, but reads at the most 8 characters at a time. How can I get it to read the entire barcode rather than in pieces?

Here is a snippet of my code

Imports System.Data.SqlClient
Imports System.IO.Ports
Public Class Form1

[Code]....

View 4 Replies

Can't Open A Serial Port For Reading?

Aug 10, 2009

I am trying to open a GPS device on a serial port but no matter what I try I just keep getting an IOException. This is on a pocket PC BTW.

[Code]...

View 2 Replies

Communications :: Reading From Serial Port?

Dec 16, 2008

i am using serial communication to read from a plc.The plc will send a string :&H3A as a header byte then C(which is a variable that contains data)I want to read and mask out the header byte.I use the following code but cannot read anything.

Private Sub btnread_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnread.Click
Msg = SerialPort1.ReadExisting
count = Val(Mid(Msg, 1, 2))
Lblno.Text = count

[Code]...

View 1 Replies

Reading Hex Data Through The Serial Port?

Oct 27, 2009

I am having a little trouble receiving data via the serial port. I can send just fine. I am using Serial Port object.

Basically my data expected is in the form of: [0x43 0x35 0x64 0x35...] broken up into bytes. I tried using the SerialPort.Read() function but can't get it to work.

View 8 Replies

Reading Serial Port Using .net 2008?

Oct 2, 2011

I have microcontroller interfaced with serial port of my computer. In my microcontroller I have 2000 sample data and my primary target is to read those data. Now I can read those data in hyper terminal, but when it comes to my application it doesnt show anything.

Private Sub sp1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles sp1.DataReceived
sp1.Open()
MsgBox(sp1.ReadExisting())
End Sub

this simple code block should show me the data.But it doesnt.data format coming Microcontroller is in this following formate :

nitialization successful !,1023
Starting sampling process... 1023,1023 1023,1023
0,2 1023,1023 1023,1023 1023,1023 212,686 1023,1023 1023,1023
1,5 1023,1023 1023,1023 1023,1023,659 213,689 1023,1023 1023,1023

now, I dont understand why it doesn't read anything :NB: SP1 has a baudrate of 19200,Databits 8 and no parity,COM1 port. I aisnt sure whether I will be needing a buffer or not

View 1 Replies

Does Reading Serial Port Empty Buffer

Feb 22, 2009

Does reading the serial port empty the buffer?

View 2 Replies

IO - Reading Data From A Serial Port In VS2010

May 10, 2011

After searching around I am still having issues with reading data from a serial port in VB.Net/VS2010. I know the Serial Port works, I can write to the port fine but when reading from it, nothing happens. I have only been programming for the last 3 weeks so am still trying to get my head around it all.

[Code]...

View 1 Replies

Reading Serial Port On Win7 64-bits?

Oct 26, 2011

I have a strange problem. We are upgrading a software that works perfectly in a 32-bits environment.Software have to connect to a serial port (or a virtual serial port) and read data and do wathever it has to do with it. Program uses the IO.Ports.SerialPort object.

Now, under Win7 64-bits, is works well when using "real" serial devices, with a DB-9 connector. But using USB device, with a virtual serial port (provided by the manufacturer), it doesn't work at all. I receive nothing on the DataReceive event. But it works fine on a Win7 32-bits.

Strangely, it also works on the 64-bits PC using a program like realTerm. When connected to the virtual serial port, data are received and it's fine. But from our software, it don't. I don't get anything from the serial port.

View 9 Replies

Serial Data Port Reading From Swiping?

Nov 28, 2009

how to write a code for reading serial port using vb.net with the combination of c#.

Note : (Its just reading data from the swipe).

View 1 Replies

VS 2010 Reading Data From Com / Serial Port?

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

VS 2010 Reading Hex Data From Serial Port

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

Opening Serial Port And Reading Ok Response Data

Dec 21, 2010

Is there any other way to access a serial port using visual basic.net 2010? I followed the steps in this site, [URL] but I just got this output Open the serial port. Send the attention command to the modem. Wait for data to come back to the serial port... and stopped there. I can't get the Read the OK response data in the serial port. Close the serial port. And I was thinking, because it is very much easy to access serial port in vb6, so can I just use vb6 and then connect to visual basic.net? it is like a language inside a language.

View 3 Replies

Plot Graphic While Reading Data From Serial Port

Mar 24, 2012

Currently, I am using a VB.NET to read data from serial port. when i open the serial port, the data is read and plotting the graphic at the same time

View 2 Replies

Reading Data From Serial Port For Barcode Scanner

Aug 28, 2009

I am developing a Winforms application which read barcode from barcode scanner. It's an Human wedge scanner. This will work if I placed the cursor in any textbox or notepad. But i don't want like that. Reason is that it's cordless scanner. If some want to scan some thing in store they will move around, so there is possibility of screen saver coming or system gets locked if that happens the barcodes wont capture, but the user who is scanning the barcodes won't know this thing.

So i am reading the data using serial port communication and my scanner sending the data character by character, Not a whole string. so for that I wrote the following code. Thsi code will works if i am writing to any textbox. But it is not working if want to store it in any global string. Only first character is storing in the string. The below code is working perfectly fine. but if want to save the string in Global String variable instaed of textbox the only first character in the string is storing.

[Code]...

View 1 Replies

Reading Serial Port - Cannot Get Read Data Back

Jan 13, 2009

Using 2008 VB.Net trying to do serial communications. I have a Scantron scanner I can send data to it, but I can not get read data back sent to my serial port. I have tried ReadLine, ReadByte, etc. but i'm not capturing anything, and I don't understand the DataReceived event. [Code]

View 15 Replies

Reading The Serial Port - Read And Display The Whole 16 Bytes In One Go?

Jul 8, 2009

I'm working on a project involving reading RFID tags, I've written the code and it reads the tags ok by using the recieved data handler and displaying the result in a listbox, the only problem is that the data displayed has a couple of unreadable characters at the start (I'm using ReadLine() command.)If I read the buffer byte by byte the data is all readable.How can I read and display the whole 16 Bytes in one go??

View 3 Replies

VS 2008 Reading And Writing Data To A Serial Port

May 25, 2009

reading and writing data to a serial port. the settings for the port are correct (from manual of device):

[Code]...

View 1 Replies

Reading Data From Serial Port And Converting To Double Format?

Apr 3, 2012

I am using a VB.NET(VS2010) to read data from serial port. I have 8-bit data to collect through rs232. This data is represented numbers. What reading method should I use and how to convert it to double format?

View 3 Replies

Serial Port Timing - Reading Large Flash Contents

Feb 10, 2011

I am having an issue with serial port timing when using it to read large flash content. If I slowly step through the code the program works as expected. If I let it runs by itself it only shows part of the result. The problem is not related to displaying the data on the form but mainly the "Serialport.BytesToRead".

Here is the code
Private Sub MemoryReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MemoryReport.Click
Me.BackgroundWorker1.RunWorkerAsync()
'Memory_Report()
'SerialPort.DiscardInBuffer()
[Code] .....

View 6 Replies

VS 2010 - Reading Data From Serial Port And Outputting To Screen And Access Db?

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

Check If String, Which Receive Via A Serial Port Matches To A String In A Database (access)?

Jun 22, 2010

I got an app, which receives data via a R232 port, convert it to a string and on the other side I got a database, where the strings are saved. How can I find a way to compare the string with all strings in one database column and get back the another stringform the same row in this database. I never programmed a database

View 1 Replies

Serial Port - String To Hex

Nov 14, 2011

I m writing serial port program i can send hex data without any problem but i stuck when I get response in buffer for example response is a string "?-??"

[Code]...

View 22 Replies

Serial Port Example Code - Connect To A Modem Thru The Serial Port

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

Send A Control String From .NET To A Serial Port?

Aug 5, 2010

I am trying to send a control string from VB.NET to a serial port. I am using a pololu trex jr. on the receiving end of the serial port. I have attached a copy of my current code which compiles without errors, but fails to send data. I can tell that it is not sending data because I have a light on the control board connected to the port and it normally blinks when data is received. The program that came with the board drives it perfectly but does not serve the purpose I need it to. I am open to any suggestions as I eventually plan to write a class to contain the control routines.

View 12 Replies

Send Data : String Through Serial Port?

Mar 11, 2010

i knew Serial ports are a type of computer interface that complies with the RS-232 standard. They are 9-pin connectors that relay information, incoming or outgoing, one byte at a time. Each byte is broken up into a series of eight bits, hence the term serial port.And I want to write a program chatting through Serial Port.

View 3 Replies

Send String Through Serial Port To Arudino?

Apr 18, 2012

im very new to visual basic. as in i just started 2 days ago. Currently i have a little program written up that has a couple of radio buttons and then a submit button. when you select a radio button and click the submit button, a little message box with pop up and say "you selected such and such"

Well now im trying to make something that will send a string to arduino through the usb cable. Basically it will use the same set up as stated above but instead of a pop up message it will just send the string through the port. for example Radiobutton1 - when selected and submit button pressed will send "1" (no quotes) through the serial port Radiobutton2 - when select and submitted will send "1" and then maybe "3"

and so on and so. Some radio buttons will only send 1 string through them and some may send multiple. Now, i dont need help with arduino, i have that already set up to wait for the strings to come through the com port. just need to figure out how to do it in VB.

View 1 Replies

VS 2008 Using Serial Port To Read String?

Jun 9, 2009

I have an application in Electronics to communicate with serial port. With using VB I have succesfully read a character using

Serialport1.ReadByte
or
Serialport1.ReadChar

[code].....

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved