Tool Tip: Rediscover What it Feels Like to Finish Ahead of Schedule!

Whether you are a newcomer to embedded C still trying to blink a LED or a seasoned engineer wanting to get a head-start on the next project, C-Wiz could be just the thing you are looking for.


What is C-Wiz?

C-Wiz is a component within HI-TIDE that will generate the C code needed to get your device and its peripherals ready for use. All you have to do is tell it exactly what you want.

What does C-Wiz do?

The purpose of C-Wiz is to translate your microcontroller configuration requirements and convert them into C code. Just tell C-Wiz what functionality or peripherals you require and C-Wiz will generate the source code necessary to make it happen. Include the source generated by C-Wiz into your HI-TIDE project so that when executed, your device will be configured to your requested specifications.

Why use C-Wiz?

Aside from saving you time and money, the aim of C-Wiz is to make your job easier. Life wasn't meant to be spent searching through datasheets and manuals. All of the settings that you provide to C-Wiz are saved as part of your HI-TIDE project so they can be recalled again later if you need to make minor adjustments. Also, if at a later date your project requires you to change to another microcontroller, C-Wiz will translate your settings across to the new chip (where possible), even if the peripherals are more sophisticated or SFRs are renamed. This is bound to spare you from a few headaches.


To demonstrate how efficient you can become when using C-Wiz, here is an example (takes 2 minutes) using our HI-TECH PICC compiler and a 4MHz PIC16F72 processor. Suppose you are required to write a program that toggles a LED at frequency of 1 Hertz using interrupts. Assuming that you have already created a HI-TIDE project, selected a chip and allowed HI-TIDE to create your main() function.


Step 1: Start C-Wiz (Time = 0 Sec)

Begin by pressing the button to start C-Wiz.


Step 2: Disable WDT (Time = 6 Sec)

Click the Chip settings tab and disable WDT. See following screenshot.


Step 3: Setup I/O (Time = 13 Sec)

Enable an I/O port and set the bit corresponding to your LED to output. See following screenshot.


Step 4: Setup a Timer (Time = 41 Sec)

Hint: Timer 2 has a period comparison facility. With reload value = F9h; prescaler = 1:16 and appropriate postscaler adjustment, you can get a period of 40 mSec (25 interrupts = 1 Sec). Enable and activate the timer, select to enable and generate interrupt code. See following screenshot.


Step 5: Generate Code and Import (Time = 76 Sec)

Generate the code and import it into your HI-TIDE project, just press the save button.


Step 6: Edit isr.c (Time = 79 Sec)

Edit the file isr.c that C-Wiz just generated and modify the interrupt handler for the timer so that it toggles the LED and save changes. See following screenshot.


Step 7: Edit main.c (Time = 91 Sec)

Edit main.c, add a while loop at the end of main() and save. The project will be recompiled automatically by HI-TIDE.


 

Look at that! You'll now have an executable hex file that you could download to your device to toggle the LED at a 1 Hertz frequency and there's still 29 seconds to spare! Wow, what will you do with all of that extra time?

C-Wiz comes as a standard component included with HI-TECH PICC, HI-TECH PICC-18 and HI-TECH C® for MSP430 compilers.

   

 

March 2006.