Author Topic: Programming Computers to work with Micros  (Read 9419 times)

0 Members and 1 Guest are viewing this topic.

Offline Strube09Topic starter

  • Regular Contributor
  • *
  • Posts: 125
  • Country: 00
Programming Computers to work with Micros
« on: September 09, 2010, 08:41:13 pm »
Hey everyone,

Just wondering is anyone can suggest a good language to learn to create PC programs. Specifically I want to be able to create interfaces that work with my micro projects.

Basically I want to use USB or 232 to communicate with the micros. Example might be that I can control what the micro is doing from the PC or the Micro can report some external events to the computer. I know I can use some hyperterminal type software, but I want to be able to have my own enviroment with custom buttons and a nice GUI.

Visual basic, c++ something else?

Thanks,
Strube
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: Programming Computers to work with Micros
« Reply #1 on: September 09, 2010, 09:10:02 pm »
I use Visual C# 2010 Express Edition for USB connections and a lot of stuff. It's free for personal and commercial use.

http://www.microsoft.com/express/windows/
 

Offline DavidDLC

  • Frequent Contributor
  • **
  • Posts: 755
  • Country: us
Re: Programming Computers to work with Micros
« Reply #2 on: September 09, 2010, 09:18:58 pm »
I also use Visual Studio C# to communicate with microcontrollers via USB.
 

alm

  • Guest
Re: Programming Computers to work with Micros
« Reply #3 on: September 09, 2010, 11:23:40 pm »
Depending on your experience, starting with a more friendly language like Python might also be a good idea. VB is dead, and VB.net is basically C# with a different syntax. I wouldn't consider C# easy for someone without CS or programming background. What you want is probably possible in almost any modern language, it's just a question how hard it is to accomplish.
 

Offline Zad

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: gb
    • Digital Wizardry, Analogue Alchemy, Software Sorcery
Re: Programming Computers to work with Micros
« Reply #4 on: September 09, 2010, 11:47:33 pm »
Visual Basic is dead in the same way that Fortran is dead. In other words, it just isn't. There is such a huge code and skills base out there that it isn't going to die for quite some time. If you want marketable skills to put on your CV/resume, don't go with Python. I'm sure it has it's benefits, but then so do hundreds of other minor languages that <0.01% of the population know.


Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14020
  • Country: gb
    • Mike's Electric Stuff
Re: Programming Computers to work with Micros
« Reply #5 on: September 10, 2010, 12:03:53 am »
I statred with VB6 years ago,  and is still OK-ish, but the biggest pains are that when flipping between C on the micro and VB on the PC, you start  writing C in VB and vice versa...

Another problem is when I need to give PC code to a customer to support/test/program/calibrate the hardware widget,  you need the VB DLLs so need to make a setup package, plus you can't officially but VB6 any more so can be a problem if I want a customer to be able to do mods themselves. Another minor irritant is that VB doesn't support unsigned types - I had a hell of a job doing some code to generate a 32 bit checksum a while ago..!
What I'd really like to find is a C/C++ based dev environment which is as quick and easy as VB to do UI stuff, easy to learn, produces a single exe that requires no support DLLs or installing anything else (e.g. .net framework), and is available (free or not too expensive) and easy to install for when I need to set up a customer with it.

I had a play with The free Visual Studio a while ago to write a Virtualdub plugin, but AFAICS the free version doesn't have a GUI editor.

A few people I know use Code Blocks , which may be worth a look.
Any other suggestions welcome
 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

alm

  • Guest
Re: Programming Computers to work with Micros
« Reply #6 on: September 10, 2010, 12:11:41 am »
Visual Basic is dead in the same way that Fortran is dead. In other words, it just isn't. There is such a huge code and skills base out there that it isn't going to die for quite some time. If you want marketable skills to put on your CV/resume, don't go with Python. I'm sure it has it's benefits, but then so do hundreds of other minor languages that <0.01% of the population know.
Fortran compilers are still sold and developed (eg. Intel's compiler). VB was never a standard language to begin with, it was Microsoft exclusive, and Microsoft discontinued it, so it's just a question of time before VB6 becomes unusable on the next Windows version / platform.

I missed the part where Strube wanted to learn this for his resume. As long as you've got a good background in programming, picking up a new language is easy. I think considering Python one of the obscure languages like Haskell is unfair, a quick search on Monster.com suggests C# developer vs. Python developer is about 6:1. C# is definitely more popular, but nothing like  30% vs. <0.01%. It depends on the industry. For enterprise applications, Java and .NET are the big platforms. For online applications, other languages like Python, Ruby and PHP are pretty popular. But I don't expect an EE to go into hardcore software development. For small projects, whatever the developers are familiar with and gets the job done is fine.
 

Offline Strube09Topic starter

  • Regular Contributor
  • *
  • Posts: 125
  • Country: 00
Re: Programming Computers to work with Micros
« Reply #7 on: September 10, 2010, 12:44:25 am »
Thanks for all the replies.

And while it would be nice for the resume basically need to develope small interfaces that can communicate witha calibration and test board that has a micro on it. Then I can store the results on the computer for tracking and other purposes. Eventually I would like to be able to store the info on our network too.... But I will take it one step at a time.

C# Sounds like the way to go. Any good development enviroments I should look for?

Thanks again
Strube
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: Programming Computers to work with Micros
« Reply #8 on: September 10, 2010, 02:08:47 am »
C# Sounds like the way to go. Any good development enviroments I should look for?

Thanks again
Strube

The Visual C# Express Edition includes an interface designer which can be Windows Forms or WPF (nicer looks). You just draw the buttons, menus, combo lists, etc. and assign code to them. It's really easy.

It also includes a Publish option to include the Net Framework into a setup file, so your users won't bother downloading it.

http://msmvps.com/blogs/haarongonzalez/archive/2007/04/09/772757.aspx
 

Offline DavidDLC

  • Frequent Contributor
  • **
  • Posts: 755
  • Country: us
Re: Programming Computers to work with Micros
« Reply #9 on: September 10, 2010, 02:24:30 am »
If you are a student you can get Visual Studio 2010 for free, that will be a good option for people still in school.

Even if you are taking some trainings, you can also get it.

If not you can go to ebay and get Visual Studio 2008, I saw a lot of offers that claims the software is un-opened and legal.
 

Offline TopherTheME

  • Regular Contributor
  • *
  • Posts: 196
Re: Programming Computers to work with Micros
« Reply #10 on: September 10, 2010, 03:06:04 am »
I do stuff like this with my projects all the time but I like to use Matlab instead of any of the typical programming languages. Its probably not the most elegant way of going about it but most my projects involve some pretty serious computation which for me makes Matlab the best option hands down even though Matlab GUIs can be a bit of a pain sometimes.

I've also done this before with just plain old VBA in excel. Although that was back in the office 2003 days, I'm sure its changed by now. A lot of people crap their pants when I show them full blown custom GUIs that control some stupid little robot or something done entirely with MS excel!
« Last Edit: September 10, 2010, 03:08:49 am by TopherTheME »
Don't blame me. I'm the mechanical engineer.
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: Programming Computers to work with Micros
« Reply #11 on: September 10, 2010, 03:23:29 am »
If you are a student you can get Visual Studio 2010 for free, that will be a good option for people still in school.

Even if you are taking some trainings, you can also get it.

If not you can go to ebay and get Visual Studio 2008, I saw a lot of offers that claims the software is un-opened and legal.

Visual Studio Express Editions are free for personal and commercial use. There's no need to buy a pro or enterprise edition because we electronics engineers won't use all the features those versions offer.  :)
 

Offline DavidDLC

  • Frequent Contributor
  • **
  • Posts: 755
  • Country: us
Re: Programming Computers to work with Micros
« Reply #12 on: September 10, 2010, 03:31:38 am »
I agree on that Santiago
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14020
  • Country: gb
    • Mike's Electric Stuff
Re: Programming Computers to work with Micros
« Reply #13 on: September 10, 2010, 09:10:47 am »
Quote
It also includes a Publish option to include the Net Framework into a setup file, so your users won't bother downloading it.

http://msmvps.com/blogs/haarongonzalez/archive/2007/04/09/772757.aspx
which (apart from the  download size) is fine until you get PCs on which the .net install crashes inexplicably - this happens on 2 of my PCs.

Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline scrat

  • Frequent Contributor
  • **
  • Posts: 608
  • Country: it
Re: Programming Computers to work with Micros
« Reply #14 on: September 10, 2010, 09:38:38 am »
I've done some experiments with Visual C++ Express Edition and Microchip examples for USB (Microchip USB Framework). They're easy to use, provided that you know quite well C++. Visual C++ has some strange things out from standard C++, but not so much difficult to understand. I chose C++ instead of C# because of examples from Microchip were in that language and more because I've studied C++ (it's not so common to learn C# at university here). Visual IDE help is really useful and self-contained, so you can easily find the way to add and use new objects.
I found it very funny to do something like a very rudimentary software scope and a PC-controlled PWM with a simple PIC18F4550.

BTW, can someone please give some practical differences between programming (generally, not only about interfacing with micros) in C++ and C#? How much is it worth to learn to use C# if one has a quite good knowledge of C++?
Thanks
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. - Elbert Hubbard
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 835
  • Country: au
Re: Programming Computers to work with Micros
« Reply #15 on: September 10, 2010, 11:05:49 am »
I believe your choice of programming platform is a personal choice. All the Visual Studio languages have there strong points. I use VB Express and can use C#/++ is the need arrises. VB is a nice RAD environment to code "Project Level" applications. But all the Microsoft Visual Studio languages use a common runtime now days so the differences are now come down to syntax. The big bonus with VB is the huge amount of code examples on the net. Sites like "The Code Project" are a great resource.

Best of luck Strube.
Testing one two three...
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20000
  • Country: gb
  • 0999
Re: Programming Computers to work with Micros
« Reply #16 on: September 10, 2010, 01:12:43 pm »
Fortran compilers are still sold and developed (eg. Intel's compiler). VB was never a standard language to begin with, it was Microsoft exclusive, and Microsoft discontinued it, so it's just a question of time before VB6 becomes unusable on the next Windows version / platform.
Agreed, let that be a warning to anyone who considers using a proprietary product for anything in future.

Same with electronics, I tend to avoid proprietary ICs wherever possible: I always think what are the alternatives? Is a compatible IC made by anyone else? If the company stops making that IC how easy is it to adapt the design to a different part?

Going back to the original question, I've done it before, but with good old fashioned RS-232 which was easy to do. Unfortunately it was for work and I had to use VB6. I agree the installation program wizard creates horribly bloated code which was much larger than my program. If I did it again, I would try to use something like FreeBASIC, make the program text mode (I didn't think a GUI was needed or helpful), it would've been under 200KB and required no installation - just run straight from a USB stick or CD.
 

Offline Strube09Topic starter

  • Regular Contributor
  • *
  • Posts: 125
  • Country: 00
Re: Programming Computers to work with Micros
« Reply #17 on: September 10, 2010, 01:23:53 pm »
Hero999,

Yeah I would try to use a text base interface but this would be used in production for testing and I have very little confidence in them taking the time to completely read a sentance... or understanding it.

They seem to like pictures and our picture book of assemblies. Especially when some of this will be done in china and the Chinglish translation is sometime confusing.

While I feel as though I do alright with C in the micro world I need to learn (in any language) how to address the 232 or USB in the computer programming world.... is there just a library that can help me with this? Basic C books don't really get into using the computer ports.

Does C# or Visual C++ make this easy?

Thanks again for all your help... as you can see I am not a trained programmer... just an EE trying to make it work.

Strube
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: Programming Computers to work with Micros
« Reply #18 on: September 10, 2010, 01:30:38 pm »
While I feel as though I do alright with C in the micro world I need to learn (in any language) how to address the 232 or USB in the computer programming world.... is there just a library that can help me with this? Basic C books don't really get into using the computer ports.

Does C# or Visual C++ make this easy?

I wrote a basic bulk USB tutorial for C# which may be helpful for PICs.

http://www.migsantiago.com/index.php?option=com_content&view=article&id=9&Itemid=10

Just use the translator above.  ;)

PS And also download the latest mchpupsb.dll which now works with Windows 7 32 and 64 bit edition.
 

Offline scrat

  • Frequent Contributor
  • **
  • Posts: 608
  • Country: it
Re: Programming Computers to work with Micros
« Reply #19 on: September 10, 2010, 09:30:47 pm »
They seem to like pictures and our picture book of assemblies. Especially when some of this will be done in china and the Chinglish translation is sometime confusing.

While I feel as though I do alright with C in the micro world I need to learn (in any language) how to address the 232 or USB in the computer programming world.... is there just a library that can help me with this? Basic C books don't really get into using the computer ports.

Does C# or Visual C++ make this easy?
Well, as I said above, and as Migsantiago agrees, Microchip made very suitable drivers and examples. Once you have MPLAB IDE and Visual Express installed properly, it is easy to develop Visual C++ applications that exchange command-response with a PIC. There are a number of PIC18F with an integrated USB peripheral, like PIC18F2550/4550, but beware that one which is really cheap (I think it was something like PIC18F14k50) has not the In-Circuit Debugging hardware. Firmware/software examples show a few different ways to access to PIC by USB, the more interesting ones for a simple monitoring/control are in my opinion serial emulation (it should allow you to write the same PC software for a real RS-232 device and for a USB one) and WinUSB driver.
On the PC side I used Visual Express 2005, since 2008 release didn't work (perhaps because of Win Vista). Starting to modify the examples from Microchip, creation of graphical windows with buttons, gauges and even an xy graph is quite easy (it was my first application in Visual C++). You can do very nice things as long as you can manage with C++ and you use the huge help resource which is installed.
If you would decide to go this way, just ask, I'd like to take off some dust from that thing :)


Going back to the original question, I've done it before, but with good old fashioned RS-232 which was easy to do. Unfortunately it was for work and I had to use VB6. I agree the installation program wizard creates horribly bloated code which was much larger than my program. If I did it again, I would try to use something like FreeBASIC, make the program text mode (I didn't think a GUI was needed or helpful), it would've been under 200KB and required no installation - just run straight from a USB stick or CD.

RS232... On new PCs serial port is an optional! :(
Why did they implement such a complex protocol in USB? I'm hardly convinced it was really needed, wasn't it possible to design a standard that substituted RS-232? I mean, if a USB device was by default in a RS232-like mode, and then you could select which mode you'd like, wouldn't it be  great thing? For example, USB protocol FW on PIC is a quite large piece of code, although it has a dedicated USB peripheral, seems too complex to me!
OK, people who wrote USB standard are of course experts, while I'm a simple engineer, but I suspect sometimes big interests (look at how much income FTDI makes with their chips) overcome engineering reasons.
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. - Elbert Hubbard
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14020
  • Country: gb
    • Mike's Electric Stuff
Re: Programming Computers to work with Micros
« Reply #20 on: September 10, 2010, 10:19:11 pm »
Quote
RS232... On new PCs serial port is an optional! Sad
Why did they implement such a complex protocol in USB? I'm hardly convinced it was really needed, wasn't it possible to design a standard that substituted RS-232? I mean, if a USB device was by default in a RS232-like mode, and then you could select which mode you'd like, wouldn't it be  great thing? For example, USB protocol FW on PIC is a quite large piece of code, although it has a dedicated USB peripheral, seems too complex to me!
Because RS232 is about the least of what USB was designed to do. And even then, RS232 wasn't a heavily used interface compared to the sort of things USB replaced when it first came out, it was stuff like scanners, printers and other stuff that was previously kludged onto printer ports or needed its own dedicated card, not to mention its own power supply.

 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11712
  • Country: my
  • reassessing directives...
Re: Programming Computers to work with Micros
« Reply #21 on: September 11, 2010, 04:45:14 pm »
I work in Windows XP. I learnt VB and VC++, i've made Arduino Mega controllable through a C++ program in PC, which the development environment was built on a VB program. Thats the only thing i know until i'm dead or the VB/VC dead (unsupported in my OS).
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: Programming Computers to work with Micros
« Reply #22 on: September 12, 2010, 12:06:50 am »
Why did they implement such a complex protocol in USB? I'm hardly convinced it was really needed, wasn't it possible to design a standard that substituted RS-232? I mean, if a USB device was by default in a RS232-like mode, and then you could select which mode you'd like, wouldn't it be  great thing? For example, USB protocol FW on PIC is a quite large piece of code, although it has a dedicated USB peripheral, seems too complex to me!
OK, people who wrote USB standard are of course experts, while I'm a simple engineer, but I suspect sometimes big interests (look at how much income FTDI makes with their chips) overcome engineering reasons.

Why not?  :o :D

USB is an universal serial bus which may accept any expansion board you require. From audio, video, HID, Communication, security, Wifi, Mass storage, healthcare, printing, and on... you can connect anything and anything should work on your pc when using the appropiate drivers and OS.

The word universal is what made the USB protocol so complex.

Rs232 is just an interface. USB is a whole protocol.  ;D

I know its complexity scares anyone away, but there's people who know about scarey guys and make their lives easier...

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en546923

... way better than any FTDI...  ;D
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: Programming Computers to work with Micros
« Reply #23 on: September 12, 2010, 12:20:08 am »
And there's people who can actually take apart some USB-RS232 almost-compliant cables and turn them into USB TTL adapters for their projects...

http://hackaday.com/2010/09/11/cheap-cable-reused-to-add-usb-to-your-project/
 

Offline scrat

  • Frequent Contributor
  • **
  • Posts: 608
  • Country: it
Re: Programming Computers to work with Micros
« Reply #24 on: September 16, 2010, 05:30:37 pm »
Because RS232 is about the least of what USB was designed to do. And even then, RS232 wasn't a heavily used interface compared to the sort of things USB replaced when it first came out, it was stuff like scanners, printers and other stuff that was previously kludged onto printer ports or needed its own dedicated card, not to mention its own power supply.

Sorry for such a late reply. Of course, USB makes things that RS-232 could not, and USB standard defines the protocol.
I like the differential signalling (was already there in RS-485, and it was widely used in industry), the automatical sensing of a device (so it allows for automatical plug-and-play), the presence of a (standard rated) power supply and the overall flexibility.

What I was trying to say is that, since many of the USB devices we use don't require much more than RS-232 performances, if the standard was something that by default was the simplest replacement for RS-232 (like the numerous USBtoRS-232 adaptors make), perhaps we could make many things to work very easily. Just needed to implement the physical level, and it worked. Then, if one needed something more, could add handshaking and a proper driver to achieve it.
Instead, with this standard, even the simplest device has to manage a quite complex procedure prior to become useful. This means a large piece of code on a PIC18F, for example (provided that already has an USB peripheral) and a peculiar driver on the PC.
Then there is the problem of making own USB peripherals, since one should buy a licence to use a peripheral ID and a vendor ID.

Although FTDI chips are very versatile and useful, their widest use is just for traslating USB RS-232 emulation mode into UART. This perhaps could be avoided if USB was by default simpler.

A last little thing: USB is called a bus, but physically isn't. One host peripheral can manage many devices, but they must pass through a "smart" hub (it has not only physical connections). Couldn't it be done as a real bus?

However, I appreciate very much when a standard is accepted widely like USB has been, historically this has always led to technical  acceleration (USB allowed to do so many tiny devices, first of all USB pens).

In the future I'll try to be more humble and to stay in my place... and to write less words :)
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. - Elbert Hubbard
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf