IAR+Proteus7.6 simulates MSP430 MCU PORT1 external interrupt function

Publisher:MoonlightStarLatest update time:2016-05-12 Source: eefocusKeywords:IAR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Proteus circuit
IAR+Proteus7.6 simulates MSP430 MCU PORT1 external interrupt function
 
2. msp430 program
#include
#define uint unsigned int
#define uchar unsigned char
/
Function: void delay_1ms(void) void delay_nms(uint n)
Function: Delay 1ms Delay Nms
*/
void Delay_1ms(void) //1ms delay function 

   uint i; 
   for (i=0;i<80;i++); 
}    
void Delay_Nms(uint n) //N ms delay function 

   uint i=0; 
   for (i=0;i    Delay_1ms(); 
}
/
Function: void P1_ISR(void)
Function: external interrupt service function
*/
#pragma vector=PORT1_VECTOR 
__interrupt void Port_1(void)
{   
  uchar i;
  for(i=0;i<10;i++)
   {
      P1OUT=0x01;
      Delay_Nms(1000);
      P1OUT=0x00;
      Delay_Nms(1000);
   }
  P1IFG = 0x00; //Clear interrupt flag
}
/
Function: void P1_INIT(void)
Function: PORT1 port initialization
*/
void P1_INIT(void)
{
  P1SEL = 0x00; //Set to normal I/O port
  P1DIR |= 0X01; //Set I/O direction
  P1IE = 0x80; //P1^7 interrupt enable
  P1IES = 0x00; //Rising edge sets the corresponding flag bit
  P1IFG = 0x00; //Clear interrupt flag
}
/
Function: void main(void)
Function: main function
*/
void main(void)
{
  WDTCTL = WDTPW + WDTHOLD; 
  P1_INIT();  
  _EINT(); //Open total interrupt
  while(1)
  {
    P1OUT=0x00;
  }
}
 

Keywords:IAR Reference address:IAR+Proteus7.6 simulates MSP430 MCU PORT1 external interrupt function

Previous article:Time base interrupt timing for Sunplus 16-bit microcontroller
Next article:Reference IAR + Proteus7.6 simulation MSP430 microcontroller setting method

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号