利用PCA产生的PWM波幅值不是5V而是在1.6V到1.7V之间,这不合逻辑啊,调整占空比为100%也不能达到5V。求高人指教!
程序如下:
#include<reg52.h>
#include<intrins.h>
#define FOSC 1843200L
#define unsigned char BYTE
#define unsigned int WORD
sfr CCON=0XD8;
sbit CCF0=CCON^0;
sbit CCF1=CCON^1;
sbit CF=CCON^7;
sbit CR=CCON^6;
sfr CMOD=0XD9;
sfr CL=0XE9;
sfr CH=0XF9;
sfr CCAPM0=0XDA;
sfr CCAP0L=0XEA;
sfr CCAP0H=0XFA;
sfr CCAPM1=0XDB;
sfr CCAP1L=0XEB;
sfr CCAP1H=0XFB;
sfr PCAPWM0=0XF2;
sfr PCAPWM1=0XF3;
void main()
{
CCON=0; CCON=0;
CL=0;
CH=0;
CMOD=0X00;
CCAP0H=0X00;
CCAP0L=0X00;
PCAPWM0=0X00;
CCAPM0=0X42;
CCAP1H=0X40;
CCAP1L=0X40;
PCAPWM1=0X00;
CCAPM1=0X42;
CR=1;
while(1);
} |