Transmit data through COM port in Visual C++

Discussion in 'C++' started by Liu Ju, Sep 13, 2004.

  1. Liu Ju

    Liu Ju Guest

    Dear members:
    I need to write a program in Visual C++ platform that trasmit data
    through the COM port.
    The task would be as follows:
    Whenever the peripheral device sents 1 byte to the computer through
    the RX pin of the COM Port, the program will send 4 bytes to the TX
    pin to peripheral device.

    do you know any source or the class in Visual C++ on the Internet that
    can reliably transmit data through COM port ?

    Thank you very much.

    Sincerely
    liuju
    Liu Ju, Sep 13, 2004
    #1
    1. Advertising

  2. Liu Ju wrote:
    >
    > Dear members:
    > I need to write a program in Visual C++ platform that trasmit data
    > through the COM port.
    > The task would be as follows:
    > Whenever the peripheral device sents 1 byte to the computer through
    > the RX pin of the COM Port, the program will send 4 bytes to the TX
    > pin to peripheral device.
    >
    > do you know any source or the class in Visual C++ on the Internet that
    > can reliably transmit data through COM port ?


    What's wrong with using the web?

    http://www.google.com
    Search phrase: Visual C++ COM port

    The 4-th hit seems like a start to what you are looking for
    >
    > Thank you very much.
    >
    > Sincerely
    > liuju



    --
    Karl Heinz Buchegger
    Karl Heinz Buchegger, Sep 13, 2004
    #2
    1. Advertising

  3. Liu Ju

    Liu Ju Guest

    Thank you very much for the answer.

    However I would like to ask for more specifically. In my program, I
    need to wait for a confirmation byte from the peripheral device before
    starting sending 4 data bytes. After the peripheral device completes
    processing data, it will again require 4 next data bytes. This process
    will repeat in the priod of 4 ms.
    In DOS, I often used 1 interrupt to know when the peripheral device
    requires the tramsmission from the computer. In Visual C++, what
    should I do?
    Do I have to frequently scan the RxD pin to know whether or not the
    peripheral device is sending data? IS there any solution like
    interrupt in DOS for this task?

    Thank you and look forward to your replies.

    Sincerely
    LiuJU
    Liu Ju, Sep 14, 2004
    #3
  4. Liu Ju wrote:

    > Thank you very much for the answer.
    >
    > However I would like to ask for more specifically. In my program, I
    > need to wait for a confirmation byte from the peripheral device before
    > starting sending 4 data bytes. After the peripheral device completes
    > processing data, it will again require 4 next data bytes. This process
    > will repeat in the priod of 4 ms.
    > In DOS, I often used 1 interrupt to know when the peripheral device
    > requires the tramsmission from the computer. In Visual C++, what
    > should I do?
    > Do I have to frequently scan the RxD pin to know whether or not the
    > peripheral device is sending data? IS there any solution like
    > interrupt in DOS for this task?
    >
    > Thank you and look forward to your replies.
    >
    > Sincerely
    > LiuJU


    You need to ask in a newsgroup specific to your platform.

    There are some standard properties (attributes) of a serial port,
    but beyond that, they are platform specific.

    Read the welcome.txt below to find the proper newsgroup. You
    may also want to lurk in news:comp.arch.embedded also.

    [Off-Topic]
    In general, there are two methods to read from a serial port:
    polling and interrupt. With polling, the program is reading
    the status register to determine if a character has arrived.
    With interrupts, the program is interrupted when a character
    has arrived and an Interrupt Service Routine (ISR) is invoked.
    Once the character has arrived, the value must be read out
    of the Recieve Register. After that, the status may have
    to be reset.


    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.comeaucomputing.com/learn/faq/
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    Thomas Matthews, Sep 14, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rasha
    Replies:
    0
    Views:
    1,696
    Rasha
    Mar 17, 2005
  2. SteveR
    Replies:
    1
    Views:
    591
    bruce barker
    Oct 19, 2004
  3. Replies:
    6
    Views:
    5,834
    JohnH
    May 10, 2006
  4. Replies:
    6
    Views:
    131
    Ananda Sreenivas
    Jul 12, 2005
  5. Md Mosfiqur Rahman

    real life audio data transmit & recive

    Md Mosfiqur Rahman, Apr 29, 2011, in forum: Ruby
    Replies:
    3
    Views:
    247
Loading...

Share This Page