可用于软件定时,外部脉冲捕捉,高速脉冲输出及脉宽调制(PWM)输出。
1.用于扩展外部中断
三路输入CCP0/P1.1 CCP1/P1.0 CCP2/P1.3 有的只有前二路输入

代码如下:


2.用作16位定时器功能


代码如下:


3.高速输出模式

初值计算方法
高速输出模式与16位定时器模式相似 T=1/f

程序如下:


4.脉宽调节模式(PWM)
pwm有2种应用,1.把单片机数字量转化为模拟量 2.进行pwm控制 比如直流无刷电机调速
占空比=高电平时间/周期


程序如下:

本文标题:stc15CCP/PCA/PWM/DAC模块 2020-02-0
本文链接:https://www.haomeiwen.com/subject/djzgxhtx.html
网友评论