CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2008
    Posts
    1

    Reading Data From A Serial Port

    Afternoon ladies and gentlemen.

    I just got a new project on my desk today for coding a Windows Application. Having only coded web projects, I am here to seek some help as to what to research.

    What needs to happen is this. My company uses scales (made by OHAUS) to weigh compounds and the scales that they use have serial ports. I need to write a Windows Application (preferrably in VB) that retrieves the data from the scale via a serial port. This data can be literally be imported into anything, but for now lets just stick with either an XML or Excel document.

    I am not asking for the code to do this because I want the challenge and fun of learning this from scratch. All I am looking for is a little direction on what to research.

    Thank you very much for your time and I look very forward to your responses.

  2. #2
    Join Date
    Apr 2007
    Posts
    81

    Re: Reading Data From A Serial Port

    DifferenceOfOpinion,

    If I were going to start a serial port project I would start at this web site:

    http://hardandsoftware.com/

    Kerry Moorman

  3. #3
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Reading Data From A Serial Port

    there are several threads dedicated to Serial communication...

    Do a search on CG with 'serial' and 'MScomm' keywords...

    to get you started check out Serial Port In VB.NET

    Gremmy
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  4. #4
    Join Date
    Apr 2008
    Posts
    82

    Post Re: Reading Data From A Serial Port

    Code:
    dim firstB as Byte
    'in form load
    AddHandler SerialPort1.DataReceived, AddressOf SerialPort1_DataReceived
            SerialPort1.PortName = "COM7"
            SerialPort1.'addOtherSerialStuff
            SerialPort1.Open()
            dim firstB as Byte
    'end in form load stuff
    
        Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
                firstB = Convert.ToByte(SerialPort1.ReadByte) 'read a byte
        End Sub
    Last edited by Oblio; April 21st, 2008 at 09:26 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured