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
ADVERTISEMENT
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
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
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
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
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
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
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
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
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
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
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
Jan 30, 2011
I am facing problem reading data from Serial port. Actually I am connecting with the hardware device called Crimp Force Analyzer. It gives the data on hyperterminal and I have to read that data from my <acronym title="Visual Basic">vb</acronym>.net program. The data is somewhat like this:
[Code]....
View 8 Replies
Nov 10, 2009
I'm currently working on a project where I am transmitting data from a comm device via the serial port and resorting the raw data (in binary) to its respective ascii values. The problem I'm facing is determining the most efficient method to accomplish my goal. Essentially, I have 68 bytes coming in, the first and second bytes represent the page and packet number and the data itself ranges from 3 to 64, the remaining for my checksum.
What I am needing to do is, grab 50 consecutive bytes per variable in my array, and that is where I'm confused. I have easily pulled my 3-64 bytes and stored that data to a string. I just don't know the most efficient method to accomplish my goal. Should I write directly to file all my data, as there are like 8 pages, of 128 packet data. [Code] I can capture the the first 50 by using a for-loop easily, but what would be the preferred method to track what data chunk I've taken? The more I think about it, I think I may just want to write to file, all my data, and then just take them back to back in 50 byte chunks. Is that the most efficient method?
View 3 Replies
Jan 12, 2012
I want to connect to serial port and get the data from that using vb.net how to do this.........
i have found one sample and i tried that but in that datareceived event is not firing
View 1 Replies
Jul 15, 2008
how to write code to read data from the serial port. I have a microcontroller connected to the serial port and I need the C++ program to read the input and to perform a certain task according to the information.
View 19 Replies
Apr 8, 2010
Data Logging Through Serial Port For Gps
View 1 Replies
Nov 6, 2011
I want a text box in my application that will display the data currently coming from the serial port,So if i will send ascii "hello" from another computer on my program it will diaplay "hello".
View 23 Replies
Jan 3, 2010
I am trying to read data from rfid tag using rfid reader. i can connect reader, but cannot get data?
View 4 Replies
Apr 2, 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 4 Replies
Nov 12, 2009
I need to read data from the serial port Ive 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 1 Replies
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
Jan 5, 2009
I am trying to recieve HEX data from a seriall device. Code is as below . but the required output is not correct. Some chracter code are not correct even in decimal . like for 80 i recieved 3F and for c0 also.for example i recived a string .
10 02 3F 00 10 03 3F 61
but in actual data should be
10 02 80 00 10 03 c0 61
[code].....
View 2 Replies
Nov 30, 2008
i was not getting o/p properly when i tried to receive data from serial port using the following code.
Public Class form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If SerialPort1.IsOpen Then
[code]....
View 4 Replies
Jun 4, 2012
I've searched in the forum thread for my needs, and I couldn't find any. So here is my problem. I need to monitor the data passing trough serial communication, between local serial port and some device with an application written in vb.netThe idea is to see the data without opening the port.For example I want to start the program, choose the serial port that I want to monitor, and then to start some other application that opens the serial port, and start to send data. Another device "answers", and I want to see the the sent and received data from the first program, and the process that opens the port.I thought that I can use the serial port event "DataReceived", but actually nothing happens. I think my approach is wrong. CHere is my code:
Imports System.IO
Public Class Form2
Private WithEvents sp As Ports.SerialPort
[code].....
View 6 Replies
Feb 18, 2011
I used this code in the pass with VB6 to send hex data over the serial port to a microcontroller.
MSComm1.Output = "C"
Send command ID
MSComm1.Output = Chr$("1") Send Command Parameter
MSComm1.Output = Chr$(CStr(240)) Send CR
I need to convert the code using VB2010, but Chr$ is not available, and anything I tried will not send the actual ascii code character......
View 10 Replies
Oct 6, 2011
the problem I am having is probably mainly because of I am very new at VB.net, anyway, the thing is, I am able to receive data from microcontroller successfully. The format of the data coming from the Microcontroller is shown below
0,2 1023,1023 1023,1023 1023,1023
1,5 1023,1023 1023,1023 1023,1023
2,8 1023,1023 1023,1023 1023,1023
[code].....
View 2 Replies
Apr 20, 2011
I use ReceiveSerialData() function to get a string (20 byte of 8 bit data) from serial portBut I faild and got the error "operation has timeout". I am new in VB 2010
View 10 Replies
Nov 27, 2010
I'm having problem while writing data to serial port. This piece of code is meant to write all the integer numbers in a text file to the SerialPort (connected to a USB-Serial Converter) when StartButton is clicked. However, it only managed to send two numbers and stopped at "USBSerialPort.Write(t, 0, 2)".
Private Sub StartButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartButton.Click
USBSerialPort.DiscardOutBuffer()
[Coe].....
View 8 Replies
Nov 9, 2011
have gps constantly sending data but can read it from the com port
View 5 Replies