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


ADVERTISEMENT

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

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 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

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

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

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

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

VS 2010 Cross Thread Access Of Serial Port

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

VS 2010 Receiving Data From Serial Port Monitor 4.0

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

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

VS 2010 Reading Data From USB Port?

Feb 26, 2012

how to read data from a USB Port. I have a games joystick connected to a USB port on my computer and the joystick has 10 buttons which each when pressed sends some binary code into the computer via the USB port. I need to capture these button clicks and perform a different event for each button click.

View 8 Replies

Error In Serial Port Data Capture Program In Visual Studios 2010?

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

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 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

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

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

Does Reading Serial Port Empty Buffer

Feb 22, 2009

Does reading the serial port empty the buffer?

View 2 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

Read The Data From Barcode Weight Scales By Serial Port And TcpIp Port?

Nov 27, 2010

I'm mohammed from Oman ,I'm visual studio.net programmer How I can Read the Data From Barcode Weight scales By Serial port and TcpIp port

View 7 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

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

Communications :: Serial Port - Run Program, "Access To The Port 'COM1' Is Denied"?

Oct 15, 2008

Im having problem with the Serial Port. When i run my program, "Access to the port 'COM1' is denied". What does that mean? Im not sure whats happening because theres no error in my code. Someone suggest me to use 'COM2'. Which is also the same result. I have a microcontroller, programmed and run it. And i need to capture the data onto my vb, which is on a multiline textbox. How to i do that?Just to double check my code?

[code]...

View 1 Replies

Access Serial Port In 2008?

May 25, 2008

[Code]...

m really not sure in here because this code is for vb .net 2003.. are they the same?

View 2 Replies







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