Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include "msp430x14x.h"
  2. typedef unsigned char byte;
  3. #define P4IN *((byte *)0x1C)
  4. #define P4OUT *((byte *)0x1D)
  5. #define P4DIR *((byte *)0x1E)
  6.  
  7. #define P2IN *((byte *)0x28)
  8. #define P2OUT *((byte *)0x29)
  9. #define P2DIR *((byte *)0x2A)
  10.  
  11. int main (void){
  12.  
  13. WDTCTL = WDTPW + WDTHOLD;
  14. P4DIR |= 0x00;
  15. P4DIR |= 0x04;
  16. P2DIR |= 0x02;
  17.  
  18.  
  19. //P2OUT = P2OUT | 0x02;
  20.  
  21.  
  22. while(1==1)
  23. {
  24.   if((P4IN & 0x10) != 0)
  25.   {
  26.     P2OUT = P2OUT | 0x02;
  27.   }else{
  28.     P2OUT ^= 0x02;
  29.   }
  30.  
  31. }
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement