Single Phase

download Single Phase

If you can't read please download the document

description

kjjhhjjjk

Transcript of Single Phase

/*****************************************************This program was produced by theCodeWizardAVR V2.04.4a AdvancedAutomatic Program Generator Copyright 1998-2009 Pavel Haiduc, HP InfoTech s.r.l.http://www.hpinfotech.comProject : Version : Date : 3/6/2012Author : NeVaDaCompany : FarhanComments: Chip type : ATmega16Program type : ApplicationAVR Core Clock frequency: 11.059200 MHzMemory model : SmallExternal RAM size : 0Data Stack size : 256*****************************************************/#include #include #define f 400#define spc 24#define adj 6#define Phase1L PORTC.0#define Phase1H PORTC.1flash unsigned char PWMCodes[721]={0,4,9,13,18,22,27,31,35,40,44,49,53,57,62,66,70,75,79,83,87,91,96,100,104,108,112,116,120,124,127,131,135,139,143,146,150,153,157,160,164,167,171,174,177,180,183,186,190,192,195,198,201,204,206,209,211,214,216,219,221,223,225,227,229,231,233,235,236,238,240,241,243,244,245,246,247,248,249,250,251,252,253,253,254,254,254,255,255,255,255,255,255,255,254,254,254,253,253,252,251,250,249,248,247,246,245,244,243,241,240,238,236,235,233,231,229,227,225,223,221,219,216,214,211,209,206,204,201,198,195,192,190,186,183,180,177,174,171,167,164,160,157,153,150,146,143,139,135,131,128,124,120,116,112,108,104,100,96,91,87,83,79,75,70,66,62,57,53,49,44,40,35,31,27,22,18,13,9,4,0,4,9,13,18,22,27,31,35,40,44,49,53,57,62,66,70,75,79,83,87,91,96,100,104,108,112,116,120,124,127,131,135,139,143,146,150,153,157,160,164,167,171,174,177,180,183,186,190,192,195,198,201,204,206,209,211,214,216,219,221,223,225,227,229,231,233,235,236,238,240,241,243,244,245,246,247,248,249,250,251,252,253,253,254,254,254,255,255,255,255,255,255,255,254,254,254,253,253,252,251,250,249,248,247,246,245,244,243,241,240,238,236,235,233,231,229,227,225,223,221,219,216,214,211,209,206,204,201,198,195,192,190,186,183,180,177,174,171,167,164,160,157,153,150,146,143,139,135,131,128,124,120,116,112,108,104,100,96,91,87,83,79,75,70,66,62,57,53,49,44,40,35,31,27,22,18,13,9,4};void main(void){unsigned char i=0;DDRA=0x00;DDRB=0x13;DDRC=0x3F;DDRD=0x10;TCCR0=0x6a;OCR0=0x00;while (1) { for (i=0;i