Serial Port Visual Basic 08

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jen786
    New Member
    • Feb 2009
    • 2

    Serial Port Visual Basic 08

    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:
    Code:
    Public Class Form1
        Sub SendSerialData(ByVal data As String)
        ' send string to serial port
         Using com1 As IO.Ports.SerialPort = _ 
                   My.Computer.Ports.OpenSerialPort("COM1")
              com1.WriteLine(data) 
         End Using
       End Sub
    End Class
    Attached Files
    Last edited by Frinavale; Feb 23 '09, 05:05 PM. Reason: Moved to VB.NET Answers from .NET and added [code] tags
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Question moved to .net forum.

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Are you setting the baudrate and databits correctly on both sides?
      Your VB app does not seem to be doing that.

      Comment

      • jen786
        New Member
        • Feb 2009
        • 2

        #4
        do you have a sample code i can use as a reference....

        Comment

        • Plater
          Recognized Expert Expert
          • Apr 2007
          • 7872

          #5

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

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

            Comment

            Working...