Readme File for PFC Code Example:

Power Factor Correction using the dsPIC device
--------------------------------------------------------------------

This file contains the following sections:
1. Hardware Requirements
2. Code Example Description
3. Folder Contents
4. Suggested Development Resources
5. Reconfiguring the project for a different dsPIC33F device
6. Revision History


1. Hardware Requirement:
--------------------------------------------------------------------

The following boards are used for developing this code example

dsPICDEM MC1 Motor Control Development Board
High Voltage Power Module

The device used is dsPIC30F6010A

MPLAB ICD2/Real ICE Debugger/Programmer is used for debugging and running this code example.



2. Code Example Description:
--------------------------------------------------------------------

The following functions are used as part of the PFC Application

SetupPorts()		-	Configure all the GPIO Ports
SetupBoard()		-	Set all the faults and pins to their reset state
InitOutputCompare()	-	Configure the output Compare Module
configADC()		-	Configure the ADC Module
Delay()			-	Power ON Delay
VoltagePIControl()	-	Voltage Error Compensator
CurrentPIControl()	-	Current Error Compensator
calcIacRef()		-	Compute reference inductor current
calcVsumAndFreq()	-	Calculate Vsum and Frequency



3. Folder Contents:
--------------------------------------------------------------------

This folder contains the following sub-folders:
a. C:\Program Files\Microchip\MPLAB C30\support\gld
        This folder will have the device GLD file, it is used for building the project. 
	This file was provided with the MPLAB C30 toolsuite.

	The following file is used in this project - dsPIC30F6010A.gld

b. C:\Program Files\Microchip\MPLAB C30\support\h
        This folder contains C header files useful in building this
        project. Device register and bit definitions are provided in
        the *.h file that follows the device name. These files were provided
        with the MPLAB C30 toolsuite.

c. C:\Program Files\Microchip\MPLAB C30\lib
        This folder contains library archive files, which are a
        collection of precompiled object files. The file
        named "libpic30-coff.a" contains the C run-time start-up
        library. These file were provided with the
        MPLAB C30 toolsuite.

d. hex
        This folder contains three file types - coff, hex and map.
        These are files generated by the MPLAB C30 toolsuite on build
        operation performed within MPLAB IDE. The *.map file contains
        details on memory allocation for various variables, constants
        and dsPIC instructions specified in the source and library
        code. The *.hex file contains a binary file that may be
        programmed into the dsPIC device. The *.coff file contains
        a binary file that is used by MPLAB IDE for simulation.

e. h and inc

        This folder contains include files for the code example.
	The following files are used in this project

	General.h

	PI.inc
	General.inc	

f. src
        This folder contains all the C source files (*.c) and Assembly
	source files(*.s) used in demonstrating the described example.
	This folder also contains a sub-folder named "obj" that stores compiled
        object files generated when the project is built.

	The following files are used in this project

	PFC Project.c
	InitPorts.c

	PFC.s
	PI.s

g. docs
	This folder contains the following file:

	ReadMe.txt : This file gives details about the firmware and its usage.
	

h. PFC Calculator
	This folder contains the following file:
	
	PFC Component Calculator.xls : This file gives a component calculator for PFC hardware selection.
	

4. Suggested Development Resources:
--------------------------------------------------------------------
        a. dsPICDEM MC1 Development Board
	b. High Voltage Power Module
	c. Real ICE or ICD2 

5. Reconfiguring the project for a different dsPIC30F/33F device:
--------------------------------------------------------------------
The Project/Workspace can be easily reconfigured for any dsPIC33F device.
Please use the following general guidelines:
        a. Change device selection within MPLAB IDE to a dsPIC33F device of
        your choice by using the following menu option:
        MPLAB IDE>>Configure>>Select Device

        b. Provide the correct device linker script and header file for your
        device. Device linker scripts and header files are available in your
        MPLAB C30 installation folder under:
        Device Linker Script-
                YourDrive:>Program Files\Microchip\MPLAB C30\support\gld
        Device C Header file-
                YourDrive:>Program Files\Microchip\MPLAB C30\support\h
        Device ASM Include file-
                YourDrive:>Program Files\Microchip\MPLAB C30\support\inc

        c. Provide the appropriate path to your MPLAB C30 support file locations
        using the menu option:
        MPLAB IDE>>Project>>Build Options>>Project

        d. Chose the development board applicable to your device. Some options
        are provided below:


        e. Re-build the MPLAB project using the menu option:
        MPLAB IDE>>Project>>Build All

        f. Download the hex file into the device and run.

	g. Refer to the application note AN1106 for more details.

6. Revision History :
--------------------------------------------------------------------
        08/31/2007 - Initial Release of the Code Example
