Transmit data through COM port in Visual C++

L

Liu Ju

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
 
K

Karl Heinz Buchegger

Liu said:
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
 
L

Liu Ju

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
 
T

Thomas Matthews

Liu said:
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 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top