473,795 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serial Port Visual Basic 08

2 New Member
Hello every one ,
This is my first message on fourm ....looking forward to reply

This is regarding serial port in visual basic 2008.

when i run the following VB program. After 2 minutes it will will show on my hyperterminal (configured at 9600, 8bit,1 stop bit ). And I will get strange characters like }~j2 .......

Basically, i need help in reading and writing data in ( hex ) and display messages on hyperterminal:

Code:
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Sub SendSerialData(ByVal data As String)
  3.     ' send string to serial port
  4.      Using com1 As IO.Ports.SerialPort = _ 
  5.                My.Computer.Ports.OpenSerialPort("COM1")
  6.           com1.WriteLine(data) 
  7.      End Using
  8.    End Sub
  9. End Class
Attached Images
File Type: jpg msg_1.jpg (6.9 KB, 834 views)
File Type: jpg msg_2.jpg (6.2 KB, 1813 views)
Feb 21 '09 #1
5 4451
debasisdas
8,127 Recognized Expert Expert
Question moved to .net forum.
Feb 21 '09 #2
Plater
7,872 Recognized Expert Expert
Are you setting the baudrate and databits correctly on both sides?
Your VB app does not seem to be doing that.
Feb 23 '09 #3
jen786
2 New Member
do you have a sample code i can use as a reference....
Feb 24 '09 #4
Plater
7,872 Recognized Expert Expert
http://msdn.microsoft.com/en-us/libr...rs(VS.80).aspx
Feb 24 '09 #5
tlhintoq
3,525 Recognized Expert Specialist
Just to confirm something... This is running between two computers, right? Hyperterm on one PC, and your application on the other.

Suggestion: Don't rely on the serial port being already configured the way you want it, and just open it as-is. Make a new port object, set the baud, parity, stopbits, databits and flow control yourself. *THEN* open it. Now there is no doubt as to its settings.

PS - The images you attached are so small as to be unreadable
Feb 25 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
4140
by: IanHale | last post by:
Is there any way of simply using the COM port from Visual Basic? All the solutions I've found seem to require the use of Visual Studio whereas I only have the the 'basic' version. I'm not after anything too complicated as all I want to do is read a serial stream of data. Thanks in advance
3
1275
by: Todd | last post by:
Hello Oh ye Gods of .Net, I'm going to finally upgrade from VB(5) to NET. I havent written in much of anything else than Visual Basic. Will I need to buy Visual Studio or can I get by with Visual Basic Standard for applications that send and recieve with the serial ports? I'm using a PC to talk to industrial equipment. thanks for reading,
2
1370
by: Matthew Ryan via .NET 247 | last post by:
I have a fairly large heritage VB 6 application that controlsabout 5 serial port devices with a fairly complicated but lineartimer scheme to service all of them (a work around of the singlethread aspect). I am trying to upgrade incrementally, and wantto write a VB.net stand alone class / module / application thatcan service one of these devices on it's own. I'd start thisapplication from the VB6 heritage program and (ideally) serviceinterrupts...
3
3295
by: Essam | last post by:
Hi All I have two programs ; both of them I need to give read/write access to the same Comm Port. How can I do so; using Code or third party tool/library
5
2704
by: EMW | last post by:
Hi, For my windows application I'm using OpenNetCF's serialport stuff but I'm having a small problem. In my program I want to list a range of available ports to select. This works fine for the first 16 ports, but not for the higher ports. I do this as folowed: For ab = 1 To 32
4
3380
by: Dave Cullen | last post by:
I need help using the serial port under VB.NET. I found a control called AxMSComm which I assume is the comm control, but there's no documentation in my MSDN help. Where can I find descriptions of the methods and properties of this control? And why doesn't MSDN have it? Thanks
2
2905
by: Hugh Janus | last post by:
I am trying to receive GPS data into a pocket PC 5.0. I am using the device emulator. The main PC has a bluetooth dongle connected and is bonded with the bluetooth GPS transmitter to COM8. In the device emulator, I am mapping Serial Port 1 to COM8. The below code *should* work as far as I can see but it does not. It hangs on the ReadLine line. Any ideas anyone? If I use hyperterminal on the main computer to read COM8 I can see the...
5
5624
by: =?Utf-8?B?UGV0ZXIgSm9uZXM=?= | last post by:
Hi, Hopefully this is a pretty basic question. I need to perform serial IO using VB.Net (VS2005/Framework 2.0) but the devices I communicate with can be either RS-232 or 422/485. Is this a concern to me as the programmer, i.e. does the UART or whatever handles the electrical side of things or do I need to be aware of the type of connection being made a program accordingly. I know I need to use System.IO.Ports.SerialPort but does this...
4
4780
by: JDS | last post by:
I have an application that interfaces with a USB device using the .Net serial port. The code works fine, displaying live data on the screen; that is until the USB lead is pulled out from the PC when the program hangs. The obvious answer is not to pull the lead out, but unfortunately the application is one in which there is a high possibility the lead will be pulled out so the code needs to be more robust. The form has a timer...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.