MCU_CC2530的定时器1模模式配置

/*****************************************************************************************************************************************

*Author:JYW

*Time:2019_04_02

*Describe:学而记之进而习之

*****************************************************/

#include<ioCC2530.h>

#define  LED1  P1_0 

void InitLed()
{
  P1DIR |= 0x01;
  LED1 = 0;
}

void main()
{
  CLKCONCMD &=~0x40; //1011 1111
    while(CLKCONSTA & 0x40);
  CLKCONCMD &= 0xC0;//11 00 0 000
    
  InitLed();
  EA = 1;
  T1IE = 1;
 // TIMIF |= 0x40;本来默认就是1
  T1IF = 0;
  T1STAT &= ~0x01;
  T1CCTL0 |=0x04; //0000 0100
 // T1CTL = 0x0D;//0000 11 01自由运行模式
  T1CTL = 0x0E;//0000 11 10模模式
  T1CC0H = 25000/256;
  T1CC0L = 25000%256;
  
  while(1);
  
  
}

#pragma vector = T1_VECTOR
__interrupt void T1_ISR()
{
  static unsigned char count = 0;
 count++;
  
  T1IF = 0;
  T1STAT &= ~0x01;
  
  if(count >= 10)
  {
    count = 0;
    LED1 = !LED1;
  }

}

做T1的模模式实验时将通道中断与之前学习的自由运行中断搞混,故记之

推荐文章:https://blog.csdn.net/idea1____/article/details/68122651


 

猜你喜欢

转载自blog.csdn.net/jiangxiaoweijxw/article/details/88974462