荣耀彩票代理

IT技术互动交流平台

4MSP430定时器_定时器中断

作者:杨奉武456  来源:IT165收集  发布日期:2016-12-26 20:23:10

荣耀彩票代理YIKAISHIMEIXIEHAOJIUSHANGCHUANLE,,,,,,,,ZHEICILAIGEQUANDE

ZIJIXUEMSP430SHIWEILEXIEYIPIANGUANYUPIDDEWENZHANG,XUYAO430ZAIproteusSHANGZUOFANGZHEN,YIZERENWEIZAIZIDONGKONGZHISUANFASHANGPIDZHENDEHENJINGDIAN,PLCSHEBEISHANGDADUOSHIMOKUAISHIDE,NALAIJIUSHICANKAOSHUOMINGSHUSHEZHI,SHEZHI,,,ERDUIYUDANPIANJIERYANJIUSHICHENGXU!!!ZHIYOUZIJIXIECHULAIPIDSUANFA,CAINENGDUIPIDYOUGENGSHENKEDELIJIE,..ERLAIGANJUEZIJIYIJINGHAOJIUDOUMEIYOUXIEYIPIANRANGZIJIGANDAOMANYIDEWENZHANGLE......

荣耀彩票代理ZHEIXIETIAN,,,,JINTIANZHONGYUJIECHULEWODEHENDAYIHUOLE,,,,,,,ZHONGYUKEYIWANCHENGZHEIPIANPUTONGPUTONGDINGSHIQIZHONGDUANDEWENZHANGLE,,,,,,QISHISHUOPUTONGYEBUPUTONG,,MSP430DEDINGSHIQIQUESHISHEJIDEHENQIANGHAN,,,,,,,,

荣耀彩票代理QISHIDUIYUPUTONGDINGSHIQIBA!BUWAIHU,,,,DINGSHI,,,,CHANSHENGZHONGDUAN,,,,XIJIEWENTIJIUBUSHUOLE,,,,KANWOXIAMIANDELILUNJIESHAOBUFEN,,,WOGENGZHUZHONGYUSHIZHANJIANGJIE,,YINWEIZIJIXUEXIYEXIHUANTINGYIBUYIBUSHIZHANJIANGJIEDE.RANHOUZAI.

KANYIXIAJUTIDELILUNZILIAO,,,,,,RANHOUJIU,,,,,DONGLE,,,,HUILE

CCR0   HE  TACCR0  SHIYIGEHA,,,,,,,,BIEZAIBIECHUKANDAOCCR0JIUMENGLEHA,,,ZHEISHISHEZHIDEJISHUBIJIAOZHI,,

430DEDINGSHIQINENGXUANZESHIZHONGLAIYUAN,,JUTIKANXIAMIAN,,,RUGUOBUXUANZENEIMEJIUSHIYONGYIGEYINJIAO(TEDINGDE)DESHURUPWMZUOWEITADESHIZHONGLE

XIANSHANGCAI----WAIBUYINJIAOLAISIGESHANGSHENGYANJIUJINRUXIAMIANDEZHONGDUANHANSHU  

荣耀彩票代理SHIZHI----NEIBUJISHUQITARZAIJISHUDAOCCR0(TACCR0)SHIJIUJINLAILE

__interrupt void Timer_A0 (void)     //定时器A0中断服务程序
{
  P4OUT ^= BIT1; //P4_1引脚反转
}

荣耀彩票代理RANHOUZAILAIYIGESHANGSHENGYAN,,JIUHUIJINRU---YICHUZHONGDUAN-------KEYIQUXIAO,BURANGTAYOUYICHUZHONGDUAN   

SHIZHI----NEIBUJISHUQITARZAIJISHUDAOCCR0HOU,,ZAILAIYIGESHANGSHENGYANJIUBIANCHENG 0 LE,,,RANHOUJIUJIUJINLAILE

__interrupt void Timer_A1 (void) //A1,A2,溢出中断都会进
{
  switch( TAIV )
  {
  case  TAIV_TAIFG://溢出中断
             P4OUT ^= BIT1; //P4_1反转
             break;
  }
}

XIAMIANSHIWANZHENGDECHENGXU

P1_0YINJIAO,LAISIGESHANGSHENGYANTARBIANWEI4,,P4_1FANZHUAN,,,ZAILAIYIGEYANTARBIANWEI0,ZAILAISIGE,TARBIANWEI4,,P4_1FANZHUAN,ZAILAIYIGEYANTARBIANWEI0,ZAILAISIGE,TARBIANWEI4,,P4_1FANZHUAN,,,XUNHUAN

SUOYIFAXIANDIYICILAISIGEP4_1FANZHUAN,,,,HOULAIDEDOUSHILAI5GEZAIFANZHUANLE,,SUOYIRUGUONIXIANGLAISIGEFANZHUAN,,NEIMETACCR0YINGGAIWEI3

#include 'io430.h'

void main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;//关闭看门狗
  
  P4DIR |= BIT1; 
  
  TACTL |= TASSEL_0 + MC_1+ TAIE + TACLR;//时钟外部引脚输入,增计数模式,产生溢出中断(可以取消),清除一下溢出,,其实严谨一点嘛,先清除再说

  TACCR0 = 3;//计数值3
  TACCTL0 = CCIE;//允许中断
  
  __enable_interrupt();//打开总中断
}

#pragma vector = TIMERA0_VECTOR
__interrupt void Timer_A0 (void)     //定时器A0中断服务程序
{
  P4OUT ^= BIT1; 
}

#pragma vector = TIMERA1_VECTOR
__interrupt void Timer_A1 (void) //A1,A2,溢出中断都会进
{
  switch( TAIV )
  {
  case  TAIV_TAIFG://溢出中断
             P4OUT ^= BIT1; 
             break;
  }
}

XIANZAIQUDIAOYICHUZHONGDUAN

 

#include 'io430.h'

void main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;//关闭看门狗
  
  P4DIR |= BIT1; 
  
  TACTL |= TASSEL_0 + MC_1+TACLR;//外部引脚模式,,增计数模式

  TACCR0 = 3;//计数值3,其实是4,,因为有一个溢出变为0
  TACCTL0 = CCIE;//允许中断
  
  __enable_interrupt();//打开总中断
}

#pragma vector = TIMERA0_VECTOR
__interrupt void Timer_A0 (void)     //定时器A0中断服务程序
{
  P4OUT ^= BIT1; 
}

XIAMIANSHIYIXIEJUTIJIESHI

#include 'io430.h'

void main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;//关闭看门狗
  
  P4DIR |= BIT1+BIT2; 
  
  TACTL |= TASSEL_0 + MC_2+TACLR;//外部引脚模式,,连续计数模式

  TACCR0 = 4;//计数值4
  TACCTL0 = CCIE;//允许中断
  
  __enable_interrupt();//打开总中断
}

#pragma vector = TIMERA0_VECTOR
__interrupt void Timer_A0 (void)     //定时器A0中断服务程序
{
  P4OUT ^= BIT1; 
}

KEYIZHEIYANG

#include 'io430.h'

void main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;//关闭看门狗
  
  P4DIR |= BIT1+BIT2; 
  
  TACTL |= TASSEL_0 + MC_2+TACLR;//外部引脚模式,,连续计数模式

  TACCR0 = 4;//计数值4
  TACCTL0 = CCIE;//允许中断
  
  __enable_interrupt();//打开总中断
}

#pragma vector = TIMERA0_VECTOR
__interrupt void Timer_A0 (void)     //定时器A0中断服务程序
{
  TACCR0 = TACCR0 + 4;//******这里,这里***********//
  P4OUT ^= BIT1; 
}

YINWEISHILIANXUJISHUMOSHI,SUOYIKEYIYONGTACCR1LE,,,,

#include 'io430.h'

void main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;//关闭看门狗
  
  P4DIR |= BIT1+BIT2; 
  
  TACTL |= TASSEL_0 + MC_2+TACLR;//外部引脚模式,,连续计数模式

  TACCR0 = 4;//计数值4,TAR==TACCR0进入它的中断函数
  TACCTL0 = CCIE;//允许中断
  
  TACCR1 = 6;//计数值6,TAR==TACCR1进入它的中断函数
  TACCTL1 = CCIE;//允许中断
  
  __enable_interrupt();//打开总中断
}

#pragma vector = TIMERA0_VECTOR
__interrupt void Timer_A0 (void)     //定时器A0中断服务程序
{
  TACCR0 = TACCR0 + 4;//******这里,这里***********//
  P4OUT ^= BIT1; 
}

#pragma vector = TIMERA1_VECTOR
__interrupt void Timer_A1 (void) //A1,A2,溢出中断都会进(共用)
{
  switch( TAIV )
  {
  case  TAIV_TACCR1://计数'  TACCR1 '的中断
             TACCR1 = TACCR1 + 6;
             P4OUT ^= BIT2; 
             break;
  }
}

荣耀彩票代理JIRANYOUYICHUZHONGDUANNEIMEZAIJIASHANGYICHUZHONGDUANBA

#include 'io430.h'

void main( void )
{
  // Stop watchdog timer to prevent time out reset
  WDTCTL = WDTPW + WDTHOLD;//关闭看门狗
  
  P4DIR |= BIT1+BIT2+BIT3; 
  
  TACTL |= TASSEL_0 + MC_2 + TAIE +TACLR;//外部引脚模式,,增计数模式

  TACCR0 = 4;//计数值4,TAR==TACCR0进入它的中断函数
  TACCTL0 = CCIE;//允许中断
  
  TACCR1 = 6;//计数值6,TAR==TACCR1进入它的中断函数
  TACCTL1 = CCIE;//允许中断
  
  __enable_interrupt();//打开总中断
}

#pragma vector = TIMERA0_VECTOR
__interrupt void Timer_A0 (void)     //定时器A0中断服务程序
{
  TACCR0 = TACCR0 + 4;//******这里,这里***********//
  P4OUT ^= BIT1; 
}

#pragma vector = TIMERA1_VECTOR
__interrupt void Timer_A1 (void) //A1,A2,溢出中断都会进(共用)
{
  switch( TAIV )
  {
  case  TAIV_TACCR1://计数'  TACCR1 '的中断
             TACCR1 = TACCR1 + 6;
             P4OUT ^= BIT2; 
             break;
  case  TAIV_TAIFG://溢出中断,,,,ffff变0时
             P4OUT ^= BIT3; 
             break;           
  }
}

XIAMIANSHILILUNZHISHIDEJIESHAO,,,KANLESHANGMIANZAIKANYIXIAXIAMIAN,,,,,

 

TONGSULAIJIANG,430F249YOUSANGEZHENDANGQI,LFXT1,,XT2,,DCO,

NEIBUDEZHUSHIZHONGMCLK,,ZIXITONGSHIZHONGSMCLKHEFUZHUSHIZHONGACLKSHIYOUZHEISANGEZHENDANGQILAIYUANTIGONGDE.

MCLK:ZHUSHIZHONG

荣耀彩票代理KEYIXUANZE3GEZHENDANGQI(LFXT1、XT2、DCO)ZHIYI,HUOTAMEN1/2/4/8FENPINHOUZUOWEIQIXINHAOYUAN;

SMCLK:ZIXITONGSHIZHONG

KEYIXUANZE2GEZHENDANGQI(XT2、DCO),HUOTAMEN1/2/4/8FENPINHOUZUOWEIQIXINHAOYUAN;

ACLK:FUZHUSHIZHONG

荣耀彩票代理ZHINENGYOULFXT1SHIZHONGXINHAOHUO1/2/4/8FENPINHOUZUOWEIQIXINHAOYUAN。

YOUSANGENI!!!ZHENDUO

 

荣耀彩票代理ZICONGBOKEKEYIFUZHIZHANTIETUPIAN,GANJUEZHENSHITAIFANGBIANLE

Tag标签:   
  • 专题推荐

About IT165 - 广告服务 - 隐私声明 - 版权申明 - 免责条款 - 网站地图 - 网友投稿 - 联系方式
本站内容来自于互联网,仅供用于网络技术学习,学习中请遵循相关法律法规