main.c 630 B

1234567891011121314151617181920212223242526272829
  1. #include <msp430g2553.h>
  2. void main(void) {
  3. WDTCTL = WDTPW + WDTHOLD; //desactiver le watchdog
  4. P1DIR |= 0x41; //passage de p1.0 et p1.6 en sortie
  5. P1OUT &= ~0x41; //on met les 2 sorties a 0
  6. P1REN |= BIT3;
  7. P1IE |= BIT3; //P1.3 activer interruption
  8. P1IFG &= ~BIT3; //P1.3 IFG cleared
  9. __enable_interrupt();
  10. }
  11. // Port 1 interrupt service routine
  12. #pragma vector=PORT1_VECTOR
  13. __interrupt void Port_1(void)
  14. {
  15. P1OUT ^= 0x41; // P1.0 = toggle
  16. P1IFG &= ~BIT3; // P1.3 IFG cleared
  17. P1IES ^= BIT3; // toggle the interrupt edge,
  18. // the interrupt vector will be called
  19. //when P1.3 goes from HitoLow as well as LowtoHigh
  20. }