Wxwidgets Serial Port Programming Hardware
USBDM Debugger interface for Freescale RS08,HCS08,HCS12,Coldfire and ARM-Kinetis Devices. Christensen and Associates, Inc. Oracle, Java, Sun. PonyProg: a powerful but simple serial device programmer with a GUI framework for Linux and Windows. With PonyProg and SI-Prog you can program Wafercard for SAT, eeprom within GSM, TV or CAR-RADIO. Furthermore it can be used as a low cost starter. New GUI probably based on wxWidgets and USB support. May 30, 2008 - This is just a simulation for a device that I am going to be using that has a serial port connection, however, that device has not been made yet and I don't have anything to test my program with. Because of this I'm using 2 computers connected through serial to test my program and see if they communicate.
Like for example suppose i want a windows app to have a few buttons such that when i press a button a particular character is sent to the serial port; now i can send a character using any serial console apps described above, but suppose i need it for use by people of non-technical background to operate this. Then it would be a bad idea to think of training the end user for operating the product using a terminal app which would obviously be difficult for non-technical people instead we can just ask the end user to press a button. But recently i figured it out how to write a simple ( totally basic command line) program to send and receive data from serial port. Well this was a good start then building upon it, I decided to build a console like Windows app in C/C++( not.net) and i can say i somewhat succeeded as i was able to send and receive data using it. I built the GUI part using wxWidgets(had to mess around a lot first to get the wxWidgets to work at beginning) and used the same C code used in the console app to deal with the UART interfacing part. Well it has a few bugs but i consider it not bad for beginners like me.
Below you can find the complete code for the command lin e program. The program below uses. You can compile it using any free version of Visual Studio or using mingW. You can use Codeblocks also it comes with a pre-configured version of mingW.
Most of the code is self explanatory but i will explain the important ones. Here is the link to whole project you can download it and modify it if you like. I think after going through the whole code thoroughly by now you must have understood the basics of sending and receiving data from the serial port in C using. So lets now proceed to make a more user-friendly app i.e. A GUI(Graphical user interface) program, which should be easy to use even by the non-programmers.
So using the same functions used above to send and receive data i made a GUI program. I made the GUI part using and IDE. Well Codeblocks i a great IDE and when combined with wxWidgets makes building the GUI part as easy as possible. Here is a screen shot of my app.
Now if you want the program only and want to skip the hassle of searching for the dependencies then here it is. It contains all necessary files related to the program. However i have to warn you that this is test-only initial release and it has lot of bugs especially related to the receiving part. Because the program needs to actively keep polling the serial port buffer for any new characters received, So that it can be shown in the app window. But it requires multi-threaded programming or Inter process communication, with which i am not much familiar. So what i did was i used wx_timer to initiate a 1-Second timer and whenever the timer event was triggered i would display the characters in the lower Receive Data Box.
Well this works but isn't a very clean solution to our problem. So i welcome you to modify the code and solve the issue if you like. For basic programming of serial port in linux please read the next part of this blog.
Dear thanks for you source code and clear explanations about codes, i am using VS 2005 and i used your cods but it was not work, i send errors in the below: 1>------ Build started: Project: hello, Configuration: Debug Win32 ------ 1>Compiling. Hello, I have generated my code in eclipse ide. The code seems to running fine. Serial Jvcomm32. I am able to open the serial port and able to receive the data too.