包含文件和仿真文件的下载地址:/f/stc12c5a60s2_spwm.zip
下面是主程序部分:
#include #include本文引用地址:/article/11/323869.htm
#define uint unsigned int
uchar index;
uchar a;
void init_pca(void)//pca计数器初始化函数
{
CMOD=0x04;//计数器0的溢出为PCA计数器的时钟源
CCON=0x00;
CCAPM0=0x42;//8位PWM输出,无中断
CL=0x00;//清零pca计数器
CH=0x00;
CCAP0L=pwm[0]; //初始化spwm输出的占空比
CCAP0H=pwm[0];
CR=1;//运行adclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=17&is_app=0&jk=25357d4a26439b28&k=pca&k0=pca&kdi0=0&luki=3&n=10&p=baidu&q=98059059_cpr&rb=0&rs=1&seller_id=1&sid=289b43264a7d3525&ssp2=1&stid=0&t=tpclicked3_hc&
如果觉得《单片机spwm c语言程序 stc12c5a60s2单片机spwm发生程序带仿真文件》对你有帮助,请点赞、收藏,并留下你的观点哦!