AVR单片机的CTC模式

2019-03-24 20:29发布

购买的单片机附赠资料上提到了CTC模式,但是没有具体的教程,可以分享一下经验吗? 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答
hnjylijunz
2019-03-25 08:46
# include <iom16v.h>
# define uint unsigned int
# define uchar unsigned char

void time0_ctc_init(void)
{
         /*8分频  CTC模式   比较匹配时取反*/
         TCCR0|=(1<<CS01)|(1<<WGM01)|(1<<COM00);
         OCR0=250;
         
}
void main(void)
{

         time0_ctc_init();
         DDRB|=(1<<PB3);
         PORTB|=(1<<PB3);
         while(1)
         {
       
         }
}
/*
ATME16我写的定时器0 CTC模式,你参考一下啊
*/

一周热门 更多>