📄 myproj.c
字号:
#include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
/*--------------------------parameter setting-----------------------*/
#define XtalFreq (11.059200)//Crystal Frequence
#define FALSE 0
#define TRUE 1
/*--------------------------sfr setting-----------------------*/
sfr CCAPM0=0xDA;//PCA module 0 mode
sfr PCACL=0xE9;//PCA timer Low BYTE
sfr CCAP0H=0xFA;//module 0 get High BYTE
sfr CCAP0L=0xEA;//module 0 get Low BYTE
sfr CMOD=0xD9;//PCA module timer mode
sfr CCON=0xD8;//PCA module timer control
sbit CR=0xDE;//The PCA Start Count
sbit CEX0=0x93;//PWM output CEX0 output P1.3
/*-------------------------------main-------------------------------*/
void main()
{
//CCAP0L=0x4e;
CCAP0H=0x01;//using for the control of the PWM pulse
CMOD=0x80;//using the T0 overflow for the Count Pulse,none Interupt,none WDOG/remain count
CCAPM0=0x42;//model 0 work state
CR=1;//start the PCA Counter
while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -