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


ADVERTISEMENT

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

Cannot Correctly Read Bytes From Serial Port Consistently

Jun 4, 2009

I have a timer control that sends data to a hardware every 3 seconds. I sent 6 bytes of data. In return I am expecting 8 bytes of data in DataReceived event. First time I send 6 bytes of date, in DataReceived event, I get the expected 8 bytes. Then in next 3 seconds, again the expected 8 bytes of data is received. But after that I find that DataReceived is fired 2 times: first time I get 6 bytes and then I get 2 bytes. After that I again get 8 bytes as expected. So in short, 2 times I get 8 bytes as expected and 6 bytes and 2 bytes and again 8 bytes. This pattern is repeating continuously. Why? Is there any reason why I cannot get all 8 bytes everytime? Note that the code is in vb.net 2008

Code in button btn_Start ()
'Set serial port parameters
x.PortName = "COM1"

[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

Timer Tick Event And Serial Port / Read And Display Live Data?

Jun 21, 2009

[code]...

I have a quick question regarding the serial port and timer tick event. Basically i have a micro processor connected to the PC via the serial port. With a baurd rate of 38400 set.When the PC sends the micro ":K + VBCRLF" the micro response with a string of information (ASCII encoded) and delimited with a "," and at the end of the transmission a cartridge return line feed is added.Example of sent string:

"12,1134,123,545,76,6868,34,232,1,2,3,6,7,8" These numbers are then split using the VB mystring.split(",") function into an array of strings, then the numbers are converted using ctype. After which my UI is then updated.I have Witten the code in a tick timer event using a timer count of 300ms. Although the program runs and the UI is updated i end it with lots of exception errors. I think allot of this is down to the serial port either timing out or not reading complete string.Or possibly the timer has not executed all the code before another tick event happens Even after adding a few try catch statements i am still having problems. Can anybody suggest a better way of doing it?I was thinking of using a do while loop and at the end a sleep function instead of the timer tick event.I need the speed as i am trying to read and display live data.

[code]...

View 1 Replies

Sending Bytes From The Serial Port?

Aug 30, 2010

I'm working with a device using the serial port and i am sending a command from the pc to the device like this:

1. I Change the parity to mark

2. then send a byte

3. then Change the parity to space (here is the problem)

4. Send a lot of bytes

but the device just ignores all the last bytes, im pretty sure its a timing problems, so a timeout occurred attempting to send a command, how can i change the parity without losing time?

View 24 Replies

Serial Port Sending Numbers As Bytes?

Mar 10, 2010

I'm using 2008 Express and I'm trying to send 1 byte of data on the serial port.

Serialport1.write(123) Sends 3 bytes with the ascii codes representing 1 2 and 3.

I want to send 1 byte that contains 123.

View 2 Replies

[2008] Serial Port Received Bytes Is Zero?

Mar 12, 2009

In my serial port application, I have my code -

Private Sub SerialPort_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived
Dim cnt2 As Byte

[code]....

For some packets I sent, "Error Data Received" came up. I checked BytesReceived, it was 0. My question is: since SerialPort_DataReceived processes data received, data was supposed to be received. Why the number of bytes I read was zero? BTW, when is this event accessed? it is accessed when any number of bytes received or the whole packet received?

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

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

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

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

How To Read Serial Port

Oct 27, 2009

i am new to VB.net and i am writeing a program to read a serial port and if there is any thing in the buffer i want to read the data and put it in a string then clear the buffer

View 1 Replies

How To Read The Serial Port

Jun 22, 2010

Ive got a big problem.I need to read data from the serial portIve used serialport from the toolbox , but dont know how to use it.I used to do it on a Amiga like this

open serial("serial.device".0.2400.0) rem(open port)
repeat GW.w=readserial(0)
if gw>29 and gw<128

[code].....

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







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