Posted  by  admin

Wxwidgets Serial Port Programming In Visual Basic

Wxwidgets Serial Port Programming In Visual Basic 9,6/10 3731 votes

As an Electronic Engineer I've worked with many languages and for some diferents plattforms including desktop and embedded systems. My natural envirovment is C/C, but I've worked with Java, C# and hardware oriented languages (VHDL, Verilog). I really like programing and always I'm looking for some ideas to development. I add to the opensource philosophy do I try to share my knowledge with other people.

Today, I will demonstrate how easy it is (and yes, it is actually not too difficult) to create a program that reads data from a scale that is connected through an RS-232 serial port or USB to a serial port converter. Jun 07, 2015  Tutorial for programming the serial port on Windows using Win32 API and serially communicating with an external microntroller board like MSP430 Launchpad. The source codes you can find “USB2SERIALWriteW32.c” which contains the complete code for writing into serial port. You can compile the code using Visual Studio Express or GCC.

Now I am developing embedded systems for nuclear industries in the Argentina most important technology Company.

So, I'll try and be concise, but I tend toward verbosity, so. Which programming language would be beneficial to learn to efficiently create host PC-based user interfaces (graphical and nongraphical) that communicate via COM ports to embedded hardware? I'm mostly talking about rather simple, straightforward window-based (not necessarily MS Windows-based) UIs with buttons, sliders, fields, etc. That communicates via PC ports to appliance hardware. Commands sent by UI software, data sent back by embedded system, outputs plotted graphically, etc. I have zero experience with this, so it is pretty much blank slate. I have some novice experience with Python and C.

C proficiency will be increasing over time. I'm looking for something that would be quick to employ once I got my basic proficiency. Bonus would be OS-agnostic during runtime, but not a strict requirement. I sometimes see other people with amazing hardware projects that involve PC control (and display/user interface) and wonder how they go about making the PC-side of things. I'm sure there's more than one way to go about this, so I'm not really looking for 'the one true way' more just some brainstorming on ideas. For example, I understand how Java uses a runtime environment and compiles to bytecode and how this lends itself toward platform compatibility. This seems interesting to me, but I wouldn't know enough to know how important this even is.

Depending on platform, if it is PC exclusive, then you have wxWidgets (my top choice), WinForms, QT and GTK. Both 4 are cross platform.

I would refrain from QT and GTK since QT is too heavy, it emulated everything which makes it slow and not blending into OS's theme. GTK has redraw artifacts under Windows, besides I do not even know if it will work under OS X. So far, wxWidgets is my best bet, but if you have experience with.NET, then WinForms can also be used. It is also cross platform, but many extended features other than basic functions may not be available outside Windows. If you are looking for cross platform between PC and embedded systems, then I would recommend QT, the golden reference in embedded linux GUI, or XAML if you are looking into Windows 10 IoT, which is also a free of charge embedded OS. XAML+C# programs (UWP) also run on Windows PC, Windows Phone and using Xamarin platform, it can be ported to iOS and Android. So far I've just started playing with Windows 10 IoT and UWP, but it looks promising.

Thanks so much for the in-depth response. I actually am completely surprised by your suggestions and am doing much reading about wxWidgets.

So it seems wxWidgets is built on C. The book I'm reading at says that although wxWidgets is a C framework/toolkit, many people learn both simultaneously. I'm sure some C is needed as a foundational prerequisite, though. This seems very much like what I am looking for. On the Windows end of things, I would use Visual Basic.

Forms are pretty much drag, drop and code the events. Adding other platforms is pretty much out of the question for VB. I would simply constrain my app to Windows and call it good. It's easy to get an app up and running. PyQt5 mixes Python coding with Qt5 windowing and should run on Linux and Windows (not sure about OSX). I played with this a year or so back and it seemed to work pretty well. Java is certainly a good possibility for cross-platform applications.

On the Windows end of things, I would use Visual Basic. Forms are pretty much drag, drop and code the events. Adding other platforms is pretty much out of the question for VB. I would simply constrain my app to Windows and call it good. It's easy to get an app up and running.

Programming In Visual Basic 2010

I've been using VB6 for more than a decade, and be honest, it is the only VB I've ever loved to use. Starting from.NET (VB7), it seems like VB.NET has no purpose compared to C#. Unfortunately, VB6 IDE cannot run on Windows 7 or later without severe lagging, and VB6 compiled programs start to show issues with Windows 10, so I was forced to move to other platforms. I would recommend Qt. It's also c, it has a company backing it so you will be able to buy support if you really need it. For wxWidgets you need to be at least an experienced programmer because it not-at-all novice friendly.

Basic

Qt has the advantage that it can run on Windows and Linux if you intend this from the start. It seems heavier than VB6 because it uses a bunch of dll files instead of built-in.NET. With Qt Quick (not gpl) you can make fancy UI's. Such as EA Origin, or Eneco Toon. It's not the fancy open source project anymore it was years ago. If you're brave, you could consider Delphi. (yes, that still exists) But you have to buy it first.

quote name='rstofer' post=1057503 timestamp= On the Windows end of things, I would use Visual Basic. Forms are pretty much drag, drop and code the events.

Adding other platforms is pretty much out of the question for VB. I would simply constrain my app to Windows and call it good.

It's easy to get an app up and running. I've been using VB6 for more than a decade, and be honest, it is the only VB I've ever loved to use.

Wxwidgets Serial Port Programming In Visual Basic

Starting from.NET (VB7), it seems like VB.NET has no purpose compared to C#. Unfortunately, VB6 IDE cannot run on Windows 7 or later without severe lagging, and VB6 compiled programs start to show issues with Windows 10, so I was forced to move to other platforms. /quote it may be depend but we code VB6 on seven with ZERO LAG.

(compatibilty options - disable themes) and all our applications run without issues from XP to 10, though they all are interfaces for our products so they only use the virtual com module. No active x or stuff like that what i really dig about visual studio: you don't have to have the manual open. Every time you write something the the autocomplete shows up with useful informations like the implemented modules and then the possible outcomes. I tried to play around with WxWidgets and Qt but the lack of this function (or me being unable to enable it if present) made me reconsider, because then i would have to learn both C and the software lingo at the same time WxWidgets and Qt are direct competitors. Both C, and both are tools that when used right will get you something.

The main difference is Qt is an all-in IDE, and WxWidgets need more toolchain work and knowledge. Both require C, which isn't hard. It's the Object Oriented way of software design that is hard. You don't need much experience, but this depends on the scale of your application.

Programming In Visual Basic 6.0

You risk creating maintenance hell if you start doing this without proper plan or experience. One of the advantages of C/C is that you can share selected project headers with the embedded application. The definitions for complex data structures. Any advice for a starting tutorial for Dummies about both C and wxWidgets? I've been developing a small application that talks to two different COM ports to control some embedded hardware, with the requisite sliders, etc.

I'm using QT 5, mainly because their COM port handling is amazing (does a really nice job finding the port name under windows, for one). But, deployment ends up being huge-ish. My exe is around 500KB right now, but the support libraries baloon it to many megabytes. I've done some wxWidgets stuff for giggles in the past, and all I remember is going through some headaches getting the versions matching so it ran correctly. I think I ended up building from source, which seemed really ridiculous at the time. WxSmith and CodeBlocks worked together fairly well.

It's all C but I'm being gross and writing my algorithm in C, while the GUI stuff is in C. I know, I'm a terrible person and fully expect to reside in a special circle in Hell. If you're brave, you could consider Delphi. (yes, that still exists) But you have to buy it first. Delphi sucks badly especially cross-platform.

One of my co-workers got a burn-out trying to port an application and I had to take over.insert massive barf emoticon. I second the suggestion for WxWidgets. I have written several PC and embedded Linux applications for customers using WxWidgets as a cross-platform framework. You have to buy the book though as a reference manual. What is nice about WxWidgets is that it also deals with the idiotics things in the underlying OS and offers a lot of nice features on top of it.

For example a filename class which makes it easy to get the path, filename, extension, full path, etc from a filename. Also the API has been pretty stable over the years so existing code can be compiled with newer versions of WxWidgets if you want. Definitely Qt. It's the only one that's really cross-platform. Apart from the widgets (GUI) library, it's a complete C framework including libraries for COM ports and Bluetooth.

Support and documentation is the best. You can use Qt under the LGPL license, also for commercial closed source programs or you can buy a commercial license if you want payed support. Downside is that you need to understand at least the basics of C. GTK is C based and in theory cross-platform but in practice it's very hard to setup on windows, at least for beginners. Whichever you choose, if you have never used it before, don't expect to master it quickly.

You could take a look at some PC control programs for amateur radios. They usually duplicate the controls of a transceiver, and add a bit more functionality, and control the hardware over serial port.

+1 Qt unless you have any specific reason for not using it. I have Visual Studio Community Edition 2015 (free). It took less than 5 minutes to create a VB project with a default main window and drop a serial port object on it. I didn't pursue it beyond that point. Some years back, I wanted a little app to select files from a list and put them into another list and then send the files in the second list out over the serial port.

I don't recall having any problem doing this with very little effort. The idea was to emulate a card reader and the files were decks of cards to be read in sequence. Pretty easy to do. And totally non-portable to Linux or OSX. I'm not walking away from Windows 7 or 10 any time soon. Linux has a place around here but I'm not going to complicate matters by forcing cross-platform compatibility where it isn't necessary. I want the results and I want them right now!