Blogs

Get your microcontroller and PC to talk

Jayaraman Kiruthi VasanAugust 15, 20115 comments

(and get it done free ‘n’ easy!)

 

The Need

Specifications can dynamically change during the product development cycle. Bosses/clients suddenly approach us with additional requirements, which, however simple, can put us in a fix.  One such requirement could be to have a PC based design interface for a standalone microcontroller project.

On many occasions, the required PC software has to just behave like a slave display or to minimally control the microcontroller to do some simple jobs.

The Dilemma

Some of us, the embedded  C/ASM types, are more used to programming  the  Microcontroller than the PC. We have been always used to limited memory programming and are very stingy on RAM usage. We prefer learning new microcontrollers and score through volumes of datasheets for hardware and software specifications rather than focussing on Visual programming IDEs for the PC.

There are several reasons for this which includes the cost of such IDEs. Also, the structure of these new languages is different  (sometimes very easy) and gives us a jolt when we start using them the first time. Even then, we try to find a way to use them with a need-to-know approach. We may not want to learn the nitty-quitties of the language and want to stay focussed on the job at hand.  Having to try out a short-cut method to reach our goal, we often overlook important aspects of the software and end up having a half-baked software which downgrades the great job that we have done at the microcontroller end.

 

For example, for the above requirement, Visual Basic can be the right candidate.  There are scores of information available  on how to use Visual Basic or the latest Visual Basic .net to communicate through the COM port. Details on MsComm.ocx flood the internet. Visual C++ also is being used for various such applications. In spite of all these, sometimes, we have to face the fact  that , for a Embedded C programmer, these easy visual programming languages, make it a necessity to learn new methods in programming.

 

Most of us definitely would like to write PC software which 

·         Communicates with our embedded system

·         Provides an interactive interface

·         Can be customised to our individual applications

·         is easier to write and re-write the same way we write our Embedded code.

·         Help debug our design.

 

The wish

A package which saves from the pitfalls encountered by a newbie while helping to write code without much hassle is the need of the hour.  The features expected from such a product would be

·         C like syntax

·         Faster learning curve

·         Not too complex in terms of configurations as the requirements may need a simple UI , while having the power to provide future opportunities for an advanced UI.

·         Portable to platforms such as Windows, Mac OS and Linux

·         Has components and controls to facilitate a good user experience

·         Most importantly, has a way to communicate through the COM port

·         And why not, it must be open source

The Search

Google and other searches yielded results which are much oriented towards VB and VC++. Some die-hard PC programmers had advocated using C, Python and other languages including the Assembly (under DOS) for such requirements. Some of the posts were so excellent that it is irresistible to copy-paste them and start using them directly. However, these demanded one thing: knowledge on various related programming concepts and, may be, hardware. We needed to learn things without much pain, isn’t it? Some could call this a lazy approach, but remember the old saying :

Give the toughest job to the laziest person and you will have a shortest route to complete it.

The Solution

Posts in a social networking site gave the much-needed answer. One member, Dave, informed about the “Processing” Language.

Processing is a C/C++/Java like language which simplifies major hurdles for people like us who may not be interested to learn all the aspects of a visual programming language, yet, are forced due to project requirements.

The website Processing.org says

“Processing is an open source programming language and environment for people who want to create images, animations, and interactions.”

The website provides volume of useful information. The language reference and learning pages give us quickly the syntax and utility of each of the commands and functions. Each command is explained in a detailed manner with examples.

Many libraries are available for free download helping us to work on

·         Video interface

·         Networking through the net

·         Serial Communication

·         Pdf Export

·         Arduino interface (great!)

Arduino users can directly control their boards from the Processing environment.

The IDE is so easy to operate and very interactive.

The error messages are more human, like "Syntax error, maybe a missing semicolon?". Interesting isn't it?


When we tested Processing to interface with a standard 8051 microcontroller and a Renesas R8C microcontroller through the serial port, we were delighted to note that , we have found our answer, indeed.

Coming Up…

Processing talks with a 8051!


Previous post by Jayaraman Kiruthi Vasan:
   Embedded - Where to start and how to continue?
Next post by Jayaraman Kiruthi Vasan:
   Massive Open Online Courses ( Transforming education )

[ - ]
Comment by jms_nhAugust 30, 2011
Interesting! A good intro to something that might save time for many of us. I look forward to more details.
[ - ]
Comment by vinnieOctober 4, 2011
Good article. I was just looking at the same questions today. Processing is Java, with many of the complexities hidden. Libraries make it really shine. Arduino support is typically throught the COM port, so any MCU would be able to implement the target code. R8C is a good pick for the interfacing - plenty of great free tools and an excellent debugging environment.
[ - ]
Comment by grassDecember 17, 2011
Excellent post! It is really helpful for me, as a java beginner. I wanna use java to write a java barcode generator, which I saw from “http://www.onbarcode.com/tutorial/java-barcode-generation.html ”. It is easy-use, I want to write one like it. Do you have any good suggestions? Thanks in advance!
[ - ]
Comment by CryptomanJune 17, 2012
Processing is on my list of GUI technologies to explore indeed. Alternatively, one can use MFC and .NET for designing a Windows based GUI that allows your PC to talk to your embedded environment but it's such a pain in the neck! I am hoping that Processing will be much more straightforward. Also, for those people who are planning to connect the PC to a 3.3v embedded hardware, make sure you use a level shifter (such as MAX3232).
[ - ]
Comment by AnkurSMarch 16, 2015
Hi everyone there!
We Gill Instruments Pvt. Ltd. have a requirement for an engineer with a strong expertise and hands on experience in the field of MSP430. Candidates who are willing to relocate in Bangalore can send us their CV on - ankur@gill-instruments.com.

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Registering will allow you to participate to the forums on ALL the related sites and give you access to all pdf downloads.

Sign up

I agree with the terms of use and privacy policy.

Try our occasional but popular newsletter. VERY easy to unsubscribe.
or Sign in