I am having trouble reading data through serial communication in C++. Some of the data read in is being cutoff. It reads all the data fine in hyperterminal but not in C++. Can anyone help?
I am having trouble reading data through serial communication in C++. Some of the data read in is being cutoff. It reads all the data fine in hyperterminal but not in C++. Can anyone help?
what compiler and operating system? you probably need to implement some type of interrupt driven read function. How to do that depends on os and sometimes compiler.
Your program is losing data because it probably is not reading the UARTs fast enough and the UART's buffer gets overwritten with new incoming data.
Everything is written in visual C++. I am communicating it to a PIC device. I am using a Visual C++ compiler and windows xp. I know the data is there because the PIC is able to display all the information on the hyperterminal but it's not displaying all the information on my C++ GUI display.
Last edited by NewGuy100; 03-12-2006 at 02:20 PM.
Add breakpoints especially within the calls to IO API.
Kuphryn
Whats the best method for serial communication in MFC and Visual C++?
To my knowledge MFC doesn't directly support serial communications functions -- probably a lot easier to use win32 api functions. You can set up a callback function which win32 will call when something arrives at the UART, that way you don't miss data. And I put that in a different thread.
Can you direct me to where I can find examples of this? I am very new to visual C++!
Thank You,
I have attach the following files. I am having trouble reading my serial port in main from the commdlg.
I also used the MSCOMM with the GetInput(), but it keeps cutting off some of the data I am reading in through the serial port!
Last edited by NewGuy100; 04-13-2006 at 10:17 AM.
Whats the difference between using MSCOMM or HANDLE for serial communication? I am kind of confused on this.