Which language to use on PC to communicate to PIC's

Discussion in 'Programmer's Corner' started by Guinness, Feb 6, 2011.

  1. Guinness

    Thread Starter Member

    Dec 31, 2009
    81
    1
    Hi all,

    Basically I write my programs on my PIC's in C, thats not a problem. But what I want to do now is learn a language on the PC side to communicate with my PIC projects as a control interface. I am looking for a language that I can create my own GUI's in. I have looked around and the two easiest seems to be Visual Basic or Java.
    But I dont know which one to learn?
    and im cheap and dont want to spend any money or as little as possible:)

    Im not after a bit debate over which is better ( just saying that as most posts on internet seem to be why one is worse than the other, and there's is best ), just a suggestion as to which would be easier for me to learn and better suited for PIC control. Bearing in mind that I want to create my own GUI and will be communicating through usb, not rs232.

    Cheers in advance.
     
  2. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    You're in for a fairly steep learning curve regardless of which language you choose. Writing GUI code isn't inherently difficult, but you'll spend a goodly amount of time searching through the documentation trying to figure out how to do something that you know can be done. I've written GUI stuff in C++, Java (a little and quite a while ago), python, and VB and each language has its positives and negatives. I'd recommend picking a language and library that you can purchase a decent introductory book for. While the on-line documentation is good as reference material, it's usually not so good for explaining higher-level concepts and how things fit together; a good book can help you with this.

    You should consider using a GUI library that's available on multiple platforms; for example, Qt and wxWidgets are popular for this. There are bindings for popular scripting languages too, so don't rule out using something like python, perl or ruby.

    Of course, if you know you'll never move to another platform, then a tool specific to one platform can be used. But I have learned the hard way over the last few decades how things change down the road and how you may rue the day you decided to use a particular tool that locked you in.

    My last GUI app was in python using wxPython (a wxWidgets binding). It worked well and I was able to use add-on libraries to talk to instruments using USB, serial, and GPIB connections. All the libraries were free, although I did have to buy a USB to GPIB adapter.
     
  3. Guinness

    Thread Starter Member

    Dec 31, 2009
    81
    1
    I have heard python mentioned here and there, I will look into that again aswell. My first thought was C++, but nearly everything I read said it was one of the harder languages to do GUI stuff with, so I thought I would give it a miss till a later date.

    Do you know of any decent books to purchase?
    There are so many I would not know a good one from a bad one.

    Cheers.
     
  4. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    As I mentioned, I used wxPython for my last GUI. A friend and I had done a GUI in wxWidgets and C++, but it was a lot of work and not worth the effort in my opinion. For a simple, run-of-the-mill GUI program, it's hard to beat Visual Basic. But that locks you into a specific platform/tool. And I once used VB6 to develop a GUI version of a console program I was shipping to customers, but found out Microsoft's packaging and deployment tools were horrible -- and caused customers to have crashes and generate bad will.

    I used the book "wxPython in Action" and recommend it. I consider it a good book because I was able to bring myself up by my bootstraps and write a fairly sophisticated GUI program. Realize that the book is "only" 500 pages, so it simply does not have the room to cover every thing in gory detail -- GUI programming libraries are complicated beasts. But the authors did a good job of explaining the principles and what I couldn't find in the book I either found in the reference documentation or figured it out by experimentation.

    wxPython was sophisticated enough to let me write the application to be localized for a number of different languages. This was important, as the company I wrote it for sells internationally. Interestingly, I wrote some tools to use Google's translation facilities to make the translations for the program and this worked quite well, greatly reducing the effort to internationalize a program (but it's still a lot of work, as only a person who has gone through such an exercise knows!).

    If you choose to use wxPython, run the demo program that comes with it. This will show you hundreds of different components that people have written to make the programmer's life easier. You will get excited by all the different shiny toys to play with, but realize they take time to learn too. I was excited to find a floating point graphical plotting tool for the application mentioned above, but a week or so after starting to use it I realized it was a flawed implementation, so I had to spend a week writing my own replacement for it. But it was nice that the tools were there to do so.
     
  5. Guinness

    Thread Starter Member

    Dec 31, 2009
    81
    1
    Well thank you very much for all the info, I will use the python language and will look for the book you mentioned.

    Thats me busy for the next year:)

    Cheers
     
  6. nigelwright7557

    Senior Member

    May 10, 2008
    487
    71
    How about Visual C# express 2010 as your already into C?

    You can download it free from Microsoft.

    As said earlier it is one very steep learning curve. I was lucky in that I came from a Delphi background and so foinf it not too big a change.
     
  7. Guinness

    Thread Starter Member

    Dec 31, 2009
    81
    1
    I did look briefly at that, but most websites I looked at, there were more people saying its not very good than people saying its good.

    I will look into C# after Python, I want to learn other languages in the future, as I know that not every language is good at everything. But for now I will prob learn Python, it sounds like the easiest to learn to make GUI's.

    Cheers for response
     
  8. debjit625

    Well-Known Member

    Apr 17, 2010
    790
    186
    Every language have some advantages and some disadvantages
    If you are not in windows platform (i.e.. not a windows based OS like linux,Mac) then its not good,but if your application is meant to be run under windows platform (like XP,Vista,Win 7) C# is a good choice for faster development it also gives you the .net components lib with visual editor so that you can create GUI applications very fast,its also a safer language we call it managed code i.e.. it handles many error that we programmers do both at debug time and runtime,Most important .net the core of the language and the language itself is developed (or still under development for future) by Microsoft the company which created the platform under which you want to run your application, so I don’t have to say that they knows better what is best for their OS.

    Now off course we cant compare it with native languages like C,C++ they still will be the first priority for any system level or time demanding application in short its robust.

    My platform is windows so I always use C# for my application prototype to test the structure and flow of my program and when all is done well, I port it to C++.

    In windows communating with USB is not so easy,you have to create your own drivers and they are system (kernel) level softwares,they are developed with native languages like C or C++ with some mixture of assembly,only native language can be used for drivers development,you may find libraries from other parties that can be used in your applications for communating with USB but that limit your application in many ways as the libraries are implemented by others many things are hidden so I dont use libraries from other parties I create my own driver.

    Ok above that driver stuff dont get confused drivers development is totally different subject for now just start learning about any language that let you create your GUI applications well.I just said those driver stuff to you to point the advantages of C/C++ i.e.. they are almost capable of every thing.

    Good Luck
     
    Last edited: Feb 9, 2011
Loading...