Author Topic: Which Programming Language for Creating PC UIs for Embedded Systems?  (Read 7454 times)

0 Members and 1 Guest are viewing this topic.

Offline Syntax_Error

  • Regular Contributor
  • *
  • Posts: 204
  • Country: us
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.
It's perfectly acceptable to not know something in the short term. To continue to not know over the long term is just laziness.
 

Offline blueskull

  • Supporter
  • ****
  • Banned!
  • Posts: 12433
  • Country: cn
  • Power Electronics Guy
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #1 on: October 27, 2016, 12:09:14 am »
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.
 

Offline Syntax_Error

  • Regular Contributor
  • *
  • Posts: 204
  • Country: us
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #2 on: October 27, 2016, 03:54:43 am »
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

https://ptgmedia.pearsoncmg.com/images/0131473816/downloads/0131473816_book.pdf

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.
It's perfectly acceptable to not know something in the short term. To continue to not know over the long term is just laziness.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 6538
  • Country: us
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #3 on: October 27, 2016, 03:58:43 am »
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.

 

Offline blueskull

  • Supporter
  • ****
  • Banned!
  • Posts: 12433
  • Country: cn
  • Power Electronics Guy
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #4 on: October 27, 2016, 04:04:32 am »
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. 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.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 3315
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #5 on: October 27, 2016, 05:52:03 am »
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.
« Last Edit: October 27, 2016, 05:56:30 am by Jeroen3 »
 

Offline blueskull

  • Supporter
  • ****
  • Banned!
  • Posts: 12433
  • Country: cn
  • Power Electronics Guy
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #6 on: October 27, 2016, 06:01:10 am »
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.

wxWidgets is more friendly if you have experience with MFC, which I have.
wxWidgets started as an improved open source MFC clone.

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.

wxWidgets allows you to statically link its libraries without violating LGPL.
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 2560
  • Country: it
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #7 on: October 27, 2016, 06:06:23 am »
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. 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.
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
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 3315
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #8 on: October 27, 2016, 07:22:01 am »
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.
« Last Edit: October 27, 2016, 07:25:53 am by Jeroen3 »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 8064
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #9 on: October 27, 2016, 08:09:29 am »
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.
 

Offline ElektroQuark

  • Supporter
  • ****
  • Posts: 1216
  • Country: es
    • ElektroQuark
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #10 on: October 27, 2016, 09:37:45 am »
Any advice for a starting tutorial for Dummies about both C++ and wxWidgets?

Online Dielectric

  • Regular Contributor
  • *
  • Posts: 123
  • Country: us
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #11 on: October 27, 2016, 01:27:53 pm »
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.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 17884
  • Country: nl
    • NCT Developments
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #12 on: October 27, 2016, 01:57:41 pm »
If you're brave, you could consider Delphi. (yes, that still exists) They promise a lot. 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.
« Last Edit: October 27, 2016, 01:59:28 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1398
  • Country: 00
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #13 on: October 27, 2016, 02:17:38 pm »
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.

The difference between theory and practice is less in theory than
the difference between theory and practice in practice.
Expensive tools cannot compensate for lack of experience.
 

Offline @rt

  • Frequent Contributor
  • **
  • Posts: 972
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #14 on: October 27, 2016, 02:29:30 pm »
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.
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 1788
  • Country: fi
  • Embedded SW/HW.
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #15 on: October 27, 2016, 02:41:15 pm »
+1 Qt unless you have any specific reason for not using it.
« Last Edit: October 27, 2016, 02:48:25 pm by Kalvin »
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 6538
  • Country: us
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #16 on: October 27, 2016, 02:42:40 pm »
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!
 

Offline elgonzo

  • Supporter
  • ****
  • Posts: 690
  • Country: 00
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #17 on: October 27, 2016, 02:49:28 pm »
+1 Qt unless you have any specific reason for not using it.
Ditto. I second the suggestion of Qt...
« Last Edit: October 27, 2016, 03:04:18 pm by elgonzo »
 

Offline edm68

  • Contributor
  • Posts: 7
  • Country: us
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #18 on: October 29, 2016, 05:51:58 am »
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
 
The following users thanked this post: blueskull

Offline ChunkyPastaSauce

  • Supporter
  • ****
  • Posts: 524
  • Country: 00
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #19 on: October 29, 2016, 06:28:52 am »
LabView will also do it but $$$$

[but ... expensive]
« Last Edit: October 29, 2016, 09:57:04 am by ChunkyPastaSauce »
 

Offline Dago

  • Frequent Contributor
  • **
  • Posts: 657
  • Country: fi
    • Electronics blog about whatever I happen to build!
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #20 on: October 29, 2016, 06:31:38 am »
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.
« Last Edit: October 29, 2016, 06:34:28 am by Dago »
Come and check my projects at http://www.dgkelectronics.com ! I also tweet as https://twitter.com/DGKelectronics
 

Offline Karel

  • Super Contributor
  • ***
  • Posts: 1398
  • Country: 00
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #21 on: October 29, 2016, 06:52:48 am »
LabView will also do it but ...

... it's terrible.

And it requires a very heavy run-time environment, worse than dotnet or Java.
The difference between theory and practice is less in theory than
the difference between theory and practice in practice.
Expensive tools cannot compensate for lack of experience.
 

Offline blueskull

  • Supporter
  • ****
  • Banned!
  • Posts: 12433
  • Country: cn
  • Power Electronics Guy
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #22 on: October 29, 2016, 06:55:00 am »
And totally non-portable to Linux or OSX.

Why? Unless you have used some evil M$ exclusive WPF or DWM technology, WinForms plus basic core features of .NET up to 4.5 should be supported by Mono.
If you want to use XAML, then you can try Xamarin, which will not generate apps running on Linux, but it can target OSX, iOS, WinPhone and Android.

Xamarin is an IDE for .NET targeted at portable devices, while the .NET used in these platforms is supported by open source .NET core library and Mono.
Xamarin and Mono used to be competitors to VS, until being acquired my MS, to create internal competition to UWP/VS Community.

I use VS Community, and the binary it generates runs happily on Linux under Mono. In fact, popular Linux music player, Banshee, is based on .NET (C# and GTK#).
 

Offline julianhigginson

  • Frequent Contributor
  • **
  • Posts: 697
  • Country: au
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #23 on: October 29, 2016, 08:45:05 am »
+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)
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 17884
  • Country: nl
    • NCT Developments
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #24 on: October 29, 2016, 08:57:28 am »
And totally non-portable to Linux or OSX.
Why? Unless you have used some evil M$ exclusive WPF or DWM technology, WinForms plus basic core features of .NET up to 4.5 should be supported by Mono.
The 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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline blueskull

  • Supporter
  • ****
  • Banned!
  • Posts: 12433
  • Country: cn
  • Power Electronics Guy
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #25 on: October 29, 2016, 09:05:09 am »
(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)

You can run VS compiled C# programs under Linux using Mono, or you can compile C# programs under Linux using Mono compiler, then execute it under Mono. Mono compiled programs can also run on Windows.
.NET programs are managed, which means an executable is just a package of byte code, not real machine code. When Windows kernel loads one, it will call .NET runtime to compile the byte code into machine code on the fly, then execute in a JIT fashion. The same for Linux, when Linux kernel detects a .NET program, it calls Mono to load it.
 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 1761
  • Country: fr
    • kripton2035 schematics repository
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #26 on: October 29, 2016, 09:39:19 am »
take a look at Xojo. works natively for windows, linux, mac, and even raspberry pi. (and iOS and android sooner or later)

Offline ChunkyPastaSauce

  • Supporter
  • ****
  • Posts: 524
  • Country: 00
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #27 on: October 29, 2016, 09:54:29 am »
LabView will also do it but ...

... it's terrible.

And it requires a very heavy run-time environment, worse than dotnet or Java.

Oh, 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).

« Last Edit: October 29, 2016, 09:58:31 am by ChunkyPastaSauce »
 

Online Kjelt

  • Super Contributor
  • ***
  • Posts: 5696
  • Country: nl
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #28 on: October 29, 2016, 10:04:23 am »
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?
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 7346
  • Country: nz
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #29 on: October 29, 2016, 10:58:46 am »
If you're brave, you could consider Delphi. (yes, that still exists) They promise a lot. But you have to buy it first.

You 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.
« Last Edit: October 29, 2016, 11:04:53 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 1874
  • Country: 00
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #30 on: October 29, 2016, 02:43:24 pm »
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
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 6538
  • Country: us
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #31 on: October 29, 2016, 03:00:52 pm »
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.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 17884
  • Country: nl
    • NCT Developments
Re: Which Programming Language for Creating PC UIs for Embedded Systems?
« Reply #32 on: October 29, 2016, 03:20:39 pm »
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?
Probably 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.
« Last Edit: October 29, 2016, 03:22:34 pm by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 
The following users thanked this post: Kjelt


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf