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
ADVERTISEMENT
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
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
Aug 16, 2010
I have a very basic knowledge of coding, just enough to understand some PicBASIC Pro and program a microchip to send the values of some variables to a PC via the com port. I've used a terminal utility like Hyperterm to confirm the right variables are being sent, so I thought it would be cool to have a custom application on the PC to display these variables, and possible set them via the application by writing the new one back to the PIC. So I downloaded VB express 2008 - and whilst it was "simple" to draw a box and add a few text boxes I'm lost at how to actually do anything practical with it
[Code]...
Could someone advise me in laymens terms exactly what I need to do inorder to populate the text boxes with the data from the PIC micro. Whilst I understand the basics about BASIC, I have no idea on things like classes etc
View 5 Replies
Dec 20, 2009
What I am doing is creating an app to send and receive CNC programs to machine tools via the RS232 interface. At the moment I am testing the software with 2 laptops linked together through a cable I have made up. which all works. I have added a serial port to my form 1 and using the code below I can send and receive data. However with the send button I can open the comm port send the data and then close the comm port (No Problems there). With the receive button I want to open the comm port receive the data and close the comm port. The problem I have is checking when the app has finished receiving data so I can then close the comm port
Private Sub Btn_Send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Send.Click
Try
[Code]....
View 2 Replies
May 11, 2011
I have serial port object which continuously receiving data from weighing device, which sends data in 0001450= format (8 Bytes). I read about datareceived event, and implement that, but i must use Thred.Sleep to get all data and read with serial.ReadExisting. Does the ReadBytesTreshold=8 raised DataReceived event after 8 bytes of data??
Is there any way to cancel, abort, stop DataReceived event?
View 4 Replies
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
Feb 13, 2009
first post here at the forums. I am a complete noob when it comes to VB .Net, but I have done a lot of VBA programming and some VB6 back in the day. I have posted this question on two other forums (including the MSDN forums) and no one has responded so please let me know if I need to clarify the question.
I am (trying) to write my first .net app which reads/writes data to a device connected over the serial port. I have manged to get it to work to send commands to the device and receive the reply back, mainly using the info from this article: Beth Massi - Sharing the goodness that is VB : Reading from a Serial Port and Saving to a Database
However, I am having problems with updating the controls on the main form based on the received data from the serial port. Basically I want the user to click a button (one of six on the form) which will send data to the device, then based on the response from the device, the BackColor of that particular button, will be changed accordingly. I just am missing something b/c the button click is a different sub than the sub that handles the form controls update and I can't get the two to talk
[Code]...
View 5 Replies
Apr 28, 2012
I ve been reading forums all over the net for 2 weeks and I failed to find solution for my problem. here is my problem;
I am able to receive data from serial port in to richtextbox and its working fine .. what i wanna do is dislay data in textbox by spliting string[code]...
View 5 Replies
Jan 16, 2010
Recently we have connected one bluetooth device which receive data from our serial device. The bluetooth device further transmite this data to a Windows Mobile which is bluetooth enable. Baud rate of whole system is 19200 with 7 data bit and 1 stop bit.When we send command to serial device through bluetooth device it is accepting the command and respond accordingly. but some of data byte of string is desplay as question mark (?).But in case we connect the serial device directly to PC, the string received is correct.[code]Response given by Serial Port is "?09?D03?A D?
View 1 Replies
Jan 16, 2010
Recently we have connected one bluetooth device which receive data from our serial device. The bluetooth device further transmite this data to a Windows Mobile which is bluetooth enable. Baud rate of whole system is 19200 with 7 data bit and 1 stop bit.When we send command to serial device through bluetooth device it is accepting the command and respond accordingly. but some of data byte of string is desplay as question mark (?).[code]...
View 4 Replies
Jul 18, 2009
I need to write an application for receiving data (ascii characters) from microcontroller through the serial port in three separate parts. I've created three RichTextBoxes, but I do not know which commands I need to type. In first textbox I need to receive one byte... next six bytes need to be placed in second text box, and finally last seven bytes need to be placed in third textbox.
View 11 Replies
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
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
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
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 5, 2009
I don't really quite understand how the receiving works but could anyone please help me on how does the receive sms works when using serial port and AT-commands? Here is how I use my code:
Imports System.Windows.Forms.Form
Imports System.Text.Encoding
Imports System.Threading
Imports System.IO.Ports
[Code]...
View 21 Replies
Jun 28, 2010
I am doing a project on receiving the serial port. but the problem is that I am a lost now because I am in the dead end because my project is near the dateline. I am at blank now. Can anyone help me to teach me step by step on how to do the part on receiving sms using the modem?
View 10 Replies
Sep 19, 2011
If I touch the Power & Send wires together on a serial cable the program needs to count up by one. It is just acting as a counter is all.I have some code, but I cannot get it to count....It doesn't even appear to be getting to the SerialPort1_DataRecieved event....ok at this and see what I'm missing? I'm using VB 2010 Express. The serial port properties are all left at default.
Code
Public Class frmMain
Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As
[code].....
View 1 Replies
Sep 10, 2011
I am using VB studio 2010 now. What I want to do is to receive data from another port and save it in my directory. However the port can receive my buffer from another port but could not save the file. [Code]
View 14 Replies
Jul 14, 2010
I am currently writing a console code that I will eventually create with a GUI. The problem I am currently having is that when a message I received to the port is an ASCII command code i.e. <BEL> <CR> then rather than printing these messages
it performs the command and I am unable to respond as per when the command is received. Is there a way to alter the code so I can see these messages or at least determine its been sent so I can respond to it?
View 5 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
Nov 11, 2009
Im woundering how does Receiving/Sending data work in a TCPClient/Server that is connected in the same networkstream.
View 4 Replies
Nov 14, 2011
Currently I had write a simple VB code, my aim is when i click "Forward" button then the vb will send a character "A" to PIC, "Reverse" button will send "B" so I write my vb code for sending as below:
Dim Forward As Char = "A"
SerialPort1.Open()
SerialPort1.Write(Forward)
For the receiving part, after I received the data from PIC then I will show it at the label which act it as a screen. the receiving code as below:
SerialPort1.Open()
receive = SerialPort1.ReadChar()
If receive = "A" Then[code]....
View 14 Replies
Dec 4, 2011
I am working on system support for an electronics project wherein I have to receive an 8 bit (binary) data through a USB port and store either the binary or the corresponding decimal into a variable. How can I implement this in visual basic 2010?
View 11 Replies
Dec 13, 2009
I have a program that receives serial data from a microcontroller and displays it.If I use windows terminal I get the right data.For some reason my program is not displaying the right data.What is sent is temperature.So the actual data is 24 degreesC and my program is showing 10 degreesC.
Private
Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
[code]....
View 8 Replies