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


ADVERTISEMENT

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

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

Sending Data To Serial Port?

May 1, 2010

i am doing a project in vb 2008 .net.during execution of the code, a different number is generated every second. the numbers are either 0,1,2,3,4, or 5. how do i send this number every second to the serial port. at the serial port i have a microcontroller connected which should accept this number and light up an LED coresponding to the number received.

View 1 Replies

Sending Hex Data Through Serial Port?

Mar 1, 2010

I am trying to send a command through my serial port to a external device. The format of the command frame is, more or less, like this:

'0x0A 0x03 0x20 0x00 Checksum'

What I've written on my code is just this:

VB code
num_dec = &HA + &H3 + &H20 + &H0
checksum = DecToHex(num_dec) '2D
data=&HA & &H3 & &H20 & &H0
SerialPort_RFID.Write(data & checksum)

The problem is that when I stop the program on the Serial...Write line, I see that the data I sent is on integer format instead of Hex format.

View 8 Replies

Serial Port VB Net Error Sending &HBB

Sep 9, 2009

When i try to send the &HBB value through it just sends a &H3F value i think is an error character i use this code:

SerialPort1.Write(System.Convert.ToChar(&HBB))

I am able to send other ascii character using this but i really need to send this &HBB value through serial port.

View 2 Replies

Sending / Receiving Data To Serial Port

Aug 13, 2009

I'm trying to control a serial port device that both send and receives data. I can receive data quite happily from the serial port but I don't appear to be able to send data to the device. The device works perfectly as I can test it using putty, I open putty select serial and select 1200 baud, the device immediately lights up and can send and receive. However when the port is set up and opened in VB the device doesn't light up so I can't send data to it but can receive data from it. According to the instructions I need to send either ASCII 'X' Hex '$58' or Decimal '88' to make the device ready.

Code (VB Studio 2005) :-
Public Sub New(ByVal synchronisingObject As ISynchronizeInvoke)
ComPortUsed = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESoftwareNJB", "COMUSED", Nothing)
PricePerTrack = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESoftwareNJB", "PRICETRACK", Nothing)
Me.synchronisingObject = synchronisingObject
[Code] .....

View 11 Replies

Sending Data Into VB Through A Serial Port On Computer?

May 2, 2009

I am sending data into VB through a serial port on my computer, from a microcontroller. The data enters VB in an ASCII form, but I need it as a number. I can use the Asc command to convert numbers 0-127 however after this it dosent work. I believe this is becaus the ascii character map only goes through 127. So how can I convert the rest of the data (128-256) to a numbers?

View 3 Replies

Sending/receiving Serial Port Data?

Feb 22, 2011

Opening and closing the port works fine, and as far as i can tell, the serial.write("blahblah") should be writing to the output buffer, but I am unable to test or verify this by reading it in. the commented "Receive data from serial port" and subsequent DoUpdate() function are where i am having trouble. It doesnt seem to actually be reading in the data if it is in fact writing it correctly.

[Code]...

View 9 Replies

Dead Simple Example Of Sending Hex Data To A Serial Port?

Jul 6, 2011

I ran into this problem while trying to write a Pan/Tilt/Zoom controller program. I found some very complicated examples, but managed to put the pieces together into this simple test program.I first import System.IO.Portsthen I define a new serial port and give it the required parametersI open the com port when the form loadsI have two working buttons, one to pan left, one to stop panning. The hex commands are pre-configured.The one for Stop is A0 00 00 00 00 00 AF 0FThe one for Pan Left is A0 00 00 04 14 00 AF 1FI declare a byte array to contain the command bytes and put them into the correct position.

Code below:
Imports System.IO.Ports
Public Class Form1

[code].....

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

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

Unable To Close Serial Port After USB / Serial Converter Disconnected

Mar 28, 2006

I have a stand alone VB.Net 2005 application that uses a serial port that generally stays open while the application runs on a Windows XP system. In trying to bullet-proof the UI, I ran into a problem when the USB to Serial Converter normally used to provide the serial port is disconnected while the serial port is open. In trying to handle the resulting error when accessing the port, I find I cannot close the port.

When trying to do so, the error message says something like "unable to close the port. You may not have sufficient permissions." Reconnecting the USB/Serial Converter does not reactivate the port.

[Code]...

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

Get FullName From Available Serial Port (Com Port) From Device Manager In Windows Form With .net?

Jul 25, 2011

I have a Windows form.in windows form have a combo box that give me a list of available port serial with it code (Dim ports As String() =SerialPort.GetPortNames())for example( Com1,Com8,Com15,...).but I want to give me fullname of serial port in device manager for example in dvice manager is these (Comunication Port(COM1) - Printer Port(LPT1) And USB Serial Port(COM8)).how to Get it?

View 2 Replies

The Given Port Name Does Not Start With COM/com Or Does Not Resolve To A Valid Serial Port?

Aug 2, 2011

If I uninstall the COM1 and reboot, it works. If I shut down (power off) and restart, I get the message below. If I uninstall then click on Scan for Hardware Changes,The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name:portName

View 8 Replies

Buffer 28 Bytes From The Com Port?

Apr 21, 2010

I have a problem that i cant solve i am trying to buffer 28 bytes from the com port into the array actual_packet_VPS1(30). It works with the counter set to 0 - 15 but doesnt work when we increase the counter size to 0 -28.

Private Sub MSComm5_OnComm(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MSComm5.OnComm
Dim buffer As Object

[Code].....

View 2 Replies

Serial Communication - Converting To Bytes

Dec 1, 2011

I want to take a number such as 600 (0x0258) and send these hex values to a C-based system which is assigning char's to the received bytes and rebuilding to the original number. Currently, I am converting to bytes in VB.Net but it is not giving me the expected outcome (because of the ascii nature of the transfer most likely) [Code] I've also tried using Hex but this doesn't get the data in the correct format.

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

Edit The Port Bytes In The TCP Packet?

Feb 21, 2009

i have a program that sniffs for packets on a port going to a specific address on my lan and then sends an exact copy to the same address on another port, the problem is when i edit the port bytes in the TCP packet i have to regenerate the checksum, and thats where the problem comes in, everything i have researched on this just doesnt make sense to mei am looking for a function that will output the checksum and a little explanation on what i need to put in for it to come out right

View 1 Replies

Return Key Event Make WriteFile For Com Port 0 Bytes Written?

Jan 22, 2010

I have textbox with vbscript, user could type integers, then hit return key, KeyUp event for return would trigge theWriteFile()being called for com port to write string to the device, if Ihit return key slow, I would get 0bytewritten for WriteFile(), timeout happening basically,if I hit return keyquick,

View 1 Replies

Serial Port Use In A DLL?

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

View 7 Replies

.net - Serial Port Communication?

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

Accessing The Serial Port?

Oct 21, 2011

I can find documentation (preferably with code samples) that will guide me through all the steps to activate and read from a serial port?

View 6 Replies

BreakState Serial Port In CE6.0?

Oct 31, 2010

For my application a need to set a breakstate on/off of 25ms.In Xp this runs fine when I set breakstate=true and wait for 25ms and then breakstate= false and wait 25ms.In CE6.0 when I set breakstate = true, it only throws a puls.It is even not possible to keep breakstate on.

how to solve this or is there an alternative to simulate a breakstate?

View 3 Replies

Communicate To Serial Port?

Jan 15, 2011

can we communicate to Serial port COM1 through Microsoft Robotic Studio?We are developing wireless robot which will take data from serial por

View 14 Replies

Communications :: Like A Serial Port

Mar 8, 2010

For many years, I have sent data between 2 computers using serial ports."Here is the data", "Thank you for that data!" type stuff.Where do I get more information for doing the same thing with 2 computers that are networked together? Assume a local ethernet connection.I have experimented with serial-ethernet modems and that works well but I don't want any more hardware.Is there a good thread here I should read?I want 2 VB programs running and I want to exchange data periodically.

View 2 Replies

Controlling The Serial Port?

Apr 23, 2006

I know things have changed in VB2005.net and i have Express and i want to controll the serial port. I have a program from VB6 that i understand and i tried to convert it but i get alot of errors and i have know idead what they mean. As you can tell i haven't been programming very long.

If someone can point me in the right direction for programming the serial port in VB2005 .net i would appreciate it or tell me what differences there may be.

View 12 Replies







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