程序如下,搞了快二星期了,波形都没有,
#include<pic.h>
__CONFIG(0x00d2);
//cc
#define OUTPUT_ONE_ENABLE()
TRISC1=0
#define OUTPUT_ONE_DISABLE()
TRISC1=1
#define OUTPUT_TWO_ENABLE()
TRISC4=0
#define OUTPUT_TWO_DISABLE()
TRISC4=1
//----------------------------------------------------------------------
// void SetupA2D(void)
//
// Initializes the A2D to measure Vac, VBias.
//----------------------------------------------------------------------
void SetupA2D(void)
{
TRISC0 = 1; // scaled AC reference input
TRISC3 = 1; // AC voltage feedback
TRISA2 = 0; // C1 output
ANSEL0 = 0xD8; // AN0, AN3, AN4, AN6, AN7 are analog
ANSEL1 = 0x0F; // AN8 - AN11 are analog
ADCON1 = 0x50; // Fosc/16
ADCON0 = 0xA0; // Right Justified
// Vdd reference
// Select AN8 <- VBIAS
// Turn A/D Off
}
//-----------------------------------------------------------
int main(void)
{
unsigned char i;
OSCCON = 0x00;
for(i=0; i < 210; i++); // Wait in low power for bootstrap cap to fully charge //150
OSCCON = 0x00;
// 20M
TRISB7 = 0;
PWMPH1 = 0x1f;
PWMPH2 = 0x1f;
PWMCLK = 0x39;
PWMCON0 = 0x03;
PWMCON1 = 0x5f;
OUTPUT_ONE_DISABLE();
//in
OUTPUT_TWO_DISABLE();
//in
while(1)
{
//RB7 = !RB7;//500KHZ
}
}
特请高人帮我看下———— |