文档详情

一份正玄波源程序.doc

发布:2017-04-23约6.89千字共6页下载文档
文本预览下载声明
/***************************************************************************** * Filename: MAIN.C ****************************************************************************** * * Author: Dave Karipides * Company: APS, Inc. * Date: 3-3-97 * Compiled Using MPLAB-C Rev 1.21 * ****************************************************************************** ****************************************************************************** * * Description: The main routine calls all the functions for generating * an OPEN_LOOP or FEEDBACK sine wave of either 50 or 60 Hz. * ****************************************************************************** * * * ******************************************************************************/ /***************************************************************************** * main() * * Description: The main routine initializes the registers and loops * forever.??All control is handled in the TMR0 INT * routine. * * * Input Variables: NONE * * Output Variables: NONE * * ******************************************************************************/ //#define OPEN_LOOP #define FEEDBACK //#define 50Hz #define 60Hz #pragma option v #include 17c43.h #include #include #ifdef OPEN_LOOP // This table yields Full VRMS input unsigned char const pwmtab[32]={0,25,50,74,98,120,142,162,180,197,212, 225,235,244,250,254,255,254,250,244,235, 225,212,197,180,162,142,120,98,74,50,25}; #endif #ifdef FEEDBACK // This table yields slightly less than Full VRMS input unsigned char const pwmtab[32]={0,20,40,60,79,97,114,131,145,159,171, 181,189,197,202,205,206,205,202,197,189, 181,171,159,145,131,114,97,79,60,40,20}; #endif long read_ad(unsigned char); // Prototype for A/D converter function unsigned char index; // Index into the sinewave reference table unsigned char sign; // Flag used to unfold sinewave reference table long reference; // Value of the sinewave refrence after unfolding unsigned ch
显示全部
相似文档