473,750 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transmit data through COM port in Visual C++

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
Jul 22 '05 #1
3 3940
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
kb******@gascad .at
Jul 22 '05 #2
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
Jul 22 '05 #3
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.l earn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
3228
by: Jerry Weinstein | last post by:
Hi, I know about stored procedures and that they can speed up data entry via the SQL 'insert ' statement. However, one drawback to this method is that using the stored procedure still requires one to manually and individually enter each and every record to be inserted to the database before the procedure is executed. I want to circumvent this tedium by finding a way to use maybe a VB application that prompts a user for the data to be...
0
1485
by: QuangPK | last post by:
we have a project to transmit and receive data on serial port (i modify it from VCTERM on MSDN). To transmit text byte I use : void CMainFrame::TxString(CString str) { CString s; VARIANT vCommOut; vCommOut.vt = VT_BSTR; vCommOut.bstrVal = str.AllocSysString(); mCommCtrl.SetOutBufferCount(0); mCommCtrl.SetOutput(vCommOut);
3
2739
by: Rasha | last post by:
Hi, What is the right way for transmitting data on the serial port of a PC using VB.NET (under XP) ? I used to use the ActiveX MSComm under VB6, which becomes obsolete and needs a certification, only available if Visual Studio 6 is installed. Thanks for any Help !!!
0
1083
by: ken | last post by:
Hi all, I'm using the MS VB example "How to: Receive Strings From Serial Ports in Visual Basic" and would like to see the data being received. I have two virtual serial ports COM5 and COM6 setup using Virtual Serial Ports Driver XP . The code below is looking at COM6 and I'm sending data via COM5 with Hyper Terminal. I know this works because when I send data (MS VB example " How to: Send Strings to Serial Ports in Visual Basic") on...
6
7387
by: john | last post by:
The standard method to transmit a file from an aspx page to a browser is to stream the file to the response then end the response. The HTML code generated by the aspx page is discarded, and the browser displays or offers to save the binary file instead. I would like to have the browser accept and display the revised HTML code as well as offering to open or save the attached file. This SHOULD be possible using a multipart MIME format -...
0
1640
by: dyc | last post by:
I'm quite new to use the microsoft visuol studio....all the things I need to learn by myself...so hope can get some help from this forum.. My problem is how do I transmit data using VB language through the hyperterminal?what thing should i set up? I will be using the serial cable RS 232 to transmit the data.... I don't know what the set up should I set and what kind of code should I look through and apply for it... anyone can help or give...
0
1436
by: zhangke007 | last post by:
Hello, everyone, Currently, I have an simple serial communication application using the serialnet.dll tool from Franson company. What this application does is to read the data through the com port in my windows ce 5 based wearable computer. The data is sent from a PIC microcontroller through the RS232 protocol. The scenario is like whenever you press a button, my PIC will detect the trigger and then send a single data through RS232...
2
11303
by: Jeff Pang | last post by:
I want to transmit an array via socket from a host to another. How to do it? thank you. --jeff _____________________________________________________________ Largest network of startups. Find new startup opportunities. Click here. http://thirdpartyoffers.juno.com/TGL2111/fc/Ioyw6iieVGxKk95ANW9UY46ZNrfO3Mp24IBoFARajXJnlSuTKfzxO4/
0
8999
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9394
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.