Get data from RS232 serial port with C/C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • summerch2
    New Member
    • Feb 2007
    • 3

    Get data from RS232 serial port with C/C++

    I have developed a hardware that will give data in terms of angle of rotation. The hardware is connected to PC via serial port. I can show the value through Hyperterminal. Now i'm on the way to develope a software for it. So, I would like to know how to get the data into my user interface with C/C++ programming language? Furthermore, i would like to store it in DAT file. Anyone has done it before? Or any suggestions/ websites of tutorials that enable me to learn bout this/ any sample source codes on related works.... thanks for the help...
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Originally posted by summerch2
    I have developed a hardware that will give data in terms of angle of rotation. The hardware is connected to PC via serial port. I can show the value through Hyperterminal. Now i'm on the way to develope a software for it. So, I would like to know how to get the data into my user interface with C/C++ programming language? Furthermore, i would like to store it in DAT file. Anyone has done it before? Or any suggestions/ websites of tutorials that enable me to learn bout this/ any sample source codes on related works.... thanks for the help...
    I think the commands you are looking for are either inb() and outb() or inp() and outp().

    Comment

    • summerch2
      New Member
      • Feb 2007
      • 3

      #3
      Originally posted by Motoma
      I think the commands you are looking for are either inb() and outb() or inp() and outp().
      Can sir please explain further on it? As I'm a beginner in programming... Thanks for your kindness...

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        Originally posted by summerch2
        Can sir please explain further on it? As I'm a beginner in programming... Thanks for your kindness...
        The inb() and outb() functions are used for communicating with the serial port.

        Comment

        • horace1
          Recognized Expert Top Contributor
          • Nov 2006
          • 1510

          #5
          Originally posted by summerch2
          I have developed a hardware that will give data in terms of angle of rotation. The hardware is connected to PC via serial port. I can show the value through Hyperterminal. Now i'm on the way to develope a software for it. So, I would like to know how to get the data into my user interface with C/C++ programming language? Furthermore, i would like to store it in DAT file. Anyone has done it before? Or any suggestions/ websites of tutorials that enable me to learn bout this/ any sample source codes on related works.... thanks for the help...
          the following code works with Visual C, Borland C and DEV-C++ (using gcc)
          http://www.geocities.c om/horacespider/Serial_IO/DEV-C/terminal.c

          also have a look at
          http://www.thescripts. com/forum/threadedpost225 1579.html#post2 251579

          Comment

          • summerch2
            New Member
            • Feb 2007
            • 3

            #6
            Originally posted by horace1
            the following code works with Visual C, Borland C and DEV-C++ (using gcc)
            http://www.geocities.c om/horacespider/Serial_IO/DEV-C/terminal.c

            also have a look at
            http://www.thescripts. com/forum/threadedpost225 1579.html#post2 251579
            Thanks for all the comments n guides!! I'm in the process of studying and trying the program...

            Comment

            • horace1
              Recognized Expert Top Contributor
              • Nov 2006
              • 1510

              #7
              Originally posted by summerch2
              Thanks for all the comments n guides!! I'm in the process of studying and trying the program...
              also worth looking at is
              http://www.codeproject .com/system/serial.asp

              Comment

              • yousuf
                New Member
                • Jan 2008
                • 4

                #8
                Code removed per Posting Guidelines

                Comment

                Working...