标题: MSP430F5299控制IO口断电源程序 [打印本页]

作者: hello_richard    时间: 2019-11-2 19:51
标题: MSP430F5299控制IO口断电源程序
MSP430F5299控制IO口断电

单片机源程序如下:
  1. #include "include.h"

  2. __interrupt void TIMER_TB0_A0_IRQ_Handler()
  3. {
  4.   while(1)
  5.   {
  6.   LED_Off (LED1);              //指示灯闪烁
  7. GPIO_SetBits  (PORT1,GPIO_Pin_2);
  8.   }
  9. }
  10. void main()
  11. {
  12.   DisableInterrupts();          //禁止总中断
  13.   
  14.   LED_Init(LED_ALL);              //LED灯初始化
  15.   Set_Vector_Handler(VECTOR_TIMER0_B0,TIMER_TB0_A0_IRQ_Handler);    //设置中断向量,最好先设置中断向量,在开启中断
  16.   TIMER_Interval_Ms(TIMER_B0,5000);                    //初始化一个60s的定时中断
  17.   TIMER_ITConfig (TIMER_B0,TIMER_CCR0_IRQn,ENABLE);              //使能TIMER的某一个中断
  18.   EnableInterrupts();
  19.   while(1)
  20.   {  
  21.    LED_Turn(LED1) ;                 //延时500MS,这里用的软件延时,在DELAY。h里可以设为用定时器延时
  22.   }
  23. }
复制代码

所有资料51hei提供下载:
工程模板.7z (4.38 MB, 下载次数: 3)






欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1