![]() |
Web Development »
Applications & Tools »
Tools with source code
Intermediate
License: The Code Project Open License (CPOL)
A PIC C Code WizardBy Carlos BuelnaCreates C code templates for PIC microcontrollers. The default templates are for use with the Hi-Tech (tm) PICC compiler. |
VC6Win2K, WinXP, MFC, Dev
|
|
Advanced Search |
|
|
|
||||||||||||||||
I do some C programming for PIC microcontrollers at work. Some time ago, I developed a "PIC" C AppWizard (under MS-Visual Studio v6) to create C PIC applications. Now I've decided to make it a Win32 "regular" executable so the wizard does not depend on Visual Studio IDE.
This PIC-C Wizard creates C code templates to be used for certain Microchip (tm) PIC microcontrollers using the Hi-Tech's PICC compiler (tm). I know these two issues limit the usability of the tool, so I hope someone finds it useful.
The demo files provided are part of a demo PIC C project created using this wizard.
To be honest, all these features are not yet implemented 100% and the wizard may still be "buggy". I'll be posting frequent updates as I'm still working on it.
I have not yet created an installer for this tool. So for now, simply download it and place it under a folder of your choice. I have tested it under Windows XP, 2K and NT SP6.
The wizard will create a folder under the wizard's root folder. This folder will be named: Templates_<username>. For instance, if the actual logged on user is trinity, the folder created will be: Templates_trinity. This is where the wizard will put the default C templates and configuration files used to create PIC applications for different users. If a user's folder has been removed for some reason, the wizard will create it again with default templates.
The user can modify these C templates and the wizard will just replace the macros contained in them.
This is a list of the files generated by the wizard:
Common to both PIC and PC:
main() entry point and the interrupt vector, as well as a default program structure based on a simple tasks scheduler. The user can add code to this file that is specific to the application. For PIC compilation:
For PC compilation:
You may be wondering, why is there a Win32 version of an application that is supposed to go into an 8-bit micro? Because the idea was to debug the application, to some extent, before actually downloading the zeros and ones into the micro. The idea made some sense to me before, as it's easier to debug under VC. But quickly I learned that I lack the time and knowledge to simulate the PIC's peripherals.
Well, at least it helps me to debug certain applications using floating-point based algorithms.
Since I've used the Visual C/C++ AppWizard several times, my brain could not think of another good way to implement one, but to imitate the way MS-VC does it. Of course my implementation falls short compared to the real one but I think it does the job. So this wizard basically looks for special words, called macros, in all the template files and replace them with values provided by the user through the GUI interface.
One clear advantage of this wizard is that the C templates are open for the user to modify. It makes sense, I mean, I provided these C default templates, which only reflects my limited experience in C programming; good enough for the novice user though. But for the expert, mmh, let's better have another look at that code.
Now, for someone to start modifying the default templates, it's necessary to know all the available macros and I'll include them in this article in the very near future.
Short answer is yes. Soon I'll provide more information on what and how to modify the source code provided to have another wizard.
A tutorial will be coming soon...
What? You really think that the only cool things about the wizard were programmed by me? Of course not, I really must thank these guys for their great code:
| You must Sign In to use this message board. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 5 May 2003 Editor: Smitha Vijayan |
Copyright 2003 by Carlos Buelna Everything else Copyright © CodeProject, 1999-2009 Web20 | Advertise on the Code Project |