Making Your Own Microcontroller Serial Communications Application

From OpenCircuits
Jump to navigation Jump to search

My family of microcontroller serial communications applications is also meant to be a foundation for the creation of other custom serial communications applications. You can of course just take the source code and do with it what you want ( but please post the application somewhere and let me know about it ). Here I am going to suggest what I think is an easier way, one that should work for most custom applications. First pick the application from my current ones tha most closely resembles what you want to do. For example if graphing is important you might pick the PICMeter application, if not you might pick the BitWacker application.

( Note: This is one of a series of articles on Microcontroller Serial Communications, rooted at this site here: Microcontroller Serial Communications Articles )

My applications are structured so that each application has its own source directory and package: BitWacker is in rshensel.bitwacker ( notice that packages and directories are always lower case ). There are some core packages that are normally also required; these include rshensel.rs232probe and rshensel.picmeter. An of course there are the external libaries ( see the batch file building of the classpath to document these ).

  • Step One:
    • Make your own directory for an application and copy the source files from your template application that you have choosen above.

  • Step Two:
    • Rename the files appropriate to the new application ( you could get away with just the new package name, but this could become very confusing, don't do it. The simplest structure for an application is: 1) a main application ( ex: Bitwacker ) 2) a frame for the application ( ex: BitWackerFrame ) 3) at least one panel for the frame ( ex: BitwackerPanel ) 4) if you have a new microcontroller you may have a specialized driver for it ( ex:BitWackerUnit ). Note that in the usual case the hardware driver is choosen in the property file.

  • Step Three:
    • Change the internal names in the files to bind them together as an application, this includes the package names, the include directives, the class names, and the declarations and sometimes the names of internal variables.

  • Step Four:
    • Test the application. If everything was done correctly then your new application should work just like the old one.

  • Step Five:
    • Modify away to get the new behavior you want. Email me russ_hensel if you would like me to improve the internal docs of any component or for any other help that time allowing I can give.

By way of interest the BitWacker application has only about 100K of code that is unique to it, the rest is framework code that is shared by shared by, or unique to other applications.

Back to Microcontroller Serial Communications Articles on this site.