Which Programming Language for Creating PC UIs for Embedded Systems? - Page 1
Forum section: electronics / general

author: Syntax_Error
author_rank: Regular Contributor
timestamp: October 26, 2016, 10:33:41 pm
content: 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.

author: Syntax_Error
author_rank: Regular Contributor
timestamp: October 27, 2016, 03:54:43 am
content: 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 athttps://ptgmedia.pearsoncmg.com/images/0131473816/downloads/0131473816_book.pdfsays 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.

author: rstofer
author_rank: Super Contributor
timestamp: October 27, 2016, 03:58:43 am
content: 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.

author: Jeroen3
author_rank: Super Contributor
timestamp: October 27, 2016, 05:52:03 am
content: 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.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)They promise a lot.But you have to buy it first.

author: JPortici
author_rank: Super Contributor
timestamp: October 27, 2016, 06:06:23 am
content: Quote from: blueskull on October 27, 2016, 04:04:32 amit 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 thatwhat 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 withusefulinformations 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

author: Jeroen3
author_rank: Super Contributor
timestamp: October 27, 2016, 07:22:01 am
content: 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.You risk creating maintenance hell if you start doing this without proper plan or experience.

author: Ian.M
author_rank: Super Contributor
timestamp: October 27, 2016, 08:09:29 am
content: One of the advantages of C/C++ is that you can share selected project headers with the embedded application. e.g. the definitions for complex data structures.

author: ElektroQuark
author_rank: Unknown
timestamp: October 27, 2016, 09:37:45 am
content: Any advice for a starting tutorial for Dummies about both C++ and wxWidgets?

author: Dielectric
author_rank: Regular Contributor
timestamp: October 27, 2016, 01:27:53 pm
content: 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.

author: nctnico
author_rank: Super Contributor
timestamp: October 27, 2016, 01:57:41 pm
content: Quote from: Jeroen3 on October 27, 2016, 05:52:03 amDelphi 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.

author: Karel
author_rank: Super Contributor
timestamp: October 27, 2016, 02:17:38 pm
content: Definitely Qt.It's the only one that'sreallycross-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.

author: @rt
author_rank: Super Contributor
timestamp: October 27, 2016, 02:29:30 pm
content: 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.

author: Kalvin
author_rank: Super Contributor
timestamp: October 27, 2016, 02:41:15 pm
content: +1 Qt unless you have any specific reason for not using it.

author: rstofer
author_rank: Super Contributor
timestamp: October 27, 2016, 02:42:40 pm
content: 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'm lazy! I want the results and I want them right now!

author: elgonzo
author_rank: Unknown
timestamp: October 27, 2016, 02:49:28 pm
content: Quote from: Kalvin on October 27, 2016, 02:41:15 pmDitto. I second the suggestion of Qt...

author: edm68
author_rank: Newbie
timestamp: October 29, 2016, 05:51:58 am
content: I saw VB6 was mentioned. I don't know if this does what you need but B4J seems very similar to VB6. And it's free.I use B4A from the same developer and am impressed with it.You might want to check it out -https://www.b4x.com/b4j.html

author: ChunkyPastaSauce
author_rank: Unknown
timestamp: October 29, 2016, 06:28:52 am
content: LabView will also do it but $$$$[but ... expensive]

author: Dago
author_rank: Frequent Contributor
timestamp: October 29, 2016, 06:31:38 am
content: Definitely Qt, it is very very nice for creating UIs and it includes a LOT of other useful stuff as well (serial port handling, ethernet stuff, database stuff etc etc etc.), easy to use too. It doesn't even force you to use the IDE in any way if you don't want to (I personally don't use IDEs, Qt is simple to integrate to a project with a few lines of cmake). And like others said it really is cross platform and requires pretty much exactly 0 lines of extra code to run on Linux or Windows.

author: Karel
author_rank: Super Contributor
timestamp: October 29, 2016, 06:52:48 am
content: Quote from: ChunkyPastaSauce on October 29, 2016, 06:28:52 am... it's terrible.And it requires a very heavy run-time environment, worse than dotnet or Java.

author: julianhigginson
author_rank: Frequent Contributor
timestamp: October 29, 2016, 08:45:05 am
content: +1 QT.it's very comprehensive and lots of people know all about it. you'll find lots of example stuff out there.yes, probably a bit bloated, but an app for setting/modifying options in an embedded device doesn't normally need to be blazing fast.if you just want windows GUI, c# is a pretty powerful thing.(someone told me recently that c# is possible to target Linux, but not using visual studio?? some third party thing??but I honestly have no personal experience with this one and haven't taken any time to even check this... just mentioning it as a maybe)

author: nctnico
author_rank: Super Contributor
timestamp: October 29, 2016, 08:57:28 am
content: Quote from: blueskull on October 29, 2016, 06:55:00 amThe magic word in the above is 'should be'. Knowing Microsoft you have to be very carefull with the objects you use and if you only have basic features available you might find yourself with a very limited environment. It will be a world of pain based on what I have seen from .NET for Windows CE. The best choice for cross-platform is Qt or WxWidgets and you don't have to use C++ because (AFAIK) both have bindings for other languages.

author: kripton2035
author_rank: Super Contributor
timestamp: October 29, 2016, 09:39:19 am
content: take a look at Xojo. works natively for windows, linux, mac, and even raspberry pi. (and iOS and android sooner or later)

author: ChunkyPastaSauce
author_rank: Unknown
timestamp: October 29, 2016, 09:54:29 am
content: Quote from: Karel on October 29, 2016, 06:52:48 amOh, that was supposed to say "LabView will also do it but expensive" (for smaller work anyway).IMO Labview is pretty good for what it's meant for...... but it is terrible for stuff it's not meant for though. Creating a standardized PC UI interface for an embedded device, is one thing it's meant for.The default run-time is heavy/large because it contains all libraries and interfaces (a ton)... you can of course setup a build specification to remove what you don't use, bringing it to a typical run-time size (or segment manually if one wants to reduce it further).

author: Kjelt
author_rank: Super Contributor
timestamp: October 29, 2016, 10:04:23 am
content: Reading the other suggestions I am probably outdated.Still I see for win only a lot of C# with .net development, is that going to end soon?

author: Psi
author_rank: Super Contributor
timestamp: October 29, 2016, 10:58:46 am
content: Quote from: Jeroen3 on October 27, 2016, 05:52:03 amYou can get full version Delphi Starter edition totally free at the moment, they have a sale on.It doesn't have any database components and you don't get the cross platform or mobile ios/android support though. Just get win32 development.However you do get firemonkey, so can create some pretty fancy 3D UI's if you wish.For com port stuff the easiest way would be to install one of the 3rd party com port component libraries.That way its just, drag component onto form, and use one of the events to grab the serial data from the serial buffer. Saves having to deal with the windows API yourself.I've not tried 3rd party component libraries with delphi Starter Edition though. But afaik you can still do that.

author: ebclr
author_rank: Super Contributor
timestamp: October 29, 2016, 02:43:24 pm
content: I'm doing with Delphi for more than 20 years, and many version, and still didn't find anything better for that task Delphi is easy, simple and powertfull

author: rstofer
author_rank: Super Contributor
timestamp: October 29, 2016, 03:00:52 pm
content: How about MATLAB? I haven't tried it on Linux but apparently it works.There is example code for COM ports by way of Google.I'm currently working with the connector between MATLAB and a Raspberry PI. The PI will do IO over SPI and communicate with MATLAB on a PC via Ethernet. Pretty cool!I really like MATLAB. It has some fun building blocks in Simulink.

author: nctnico
author_rank: Super Contributor
timestamp: October 29, 2016, 03:20:39 pm
content: Quote from: Kjelt on October 29, 2016, 10:04:23 amProbably not but using C# effectively rules out releasing software which works on Linux or Mac. That could be a problem down the road which is why I really like me code to be platform independant without checking every component I want to use for portability. I actually develop Windows applications on Linux because it is easier/quicker. The last stage is compiling on Windows and doing final testing.