Jump to content
43oh

lunix

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. Nevermind, got it to work, all I changed was to set up pin directions at the beginning. #include "msp430g2553.h" #include void transfer(char s) { while (!(IFG2 & UCB0TXIFG)); UCB0TXBUF = s; } void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= BIT0; P1OUT |= BIT0; P1SEL = BIT1 + BIT2 + BIT4 + BIT5 + BIT6 + BIT7; P1SEL2 = BIT1 + BIT2 + BIT4 + BIT5 + BIT6 + BIT7; UCA0CTL1 = UCSWRST; // **Put state machine in reset** UCA0CTL0 |= UCCKPL + UCMSB + UCSYNC; // 3-pin, 8-bit SPI slave UCA0CTL1 &= ~UCSWR
  2. Hi all, I'm trying to do a loopback code on the MSP430G2553 chip. It's supposed to turn the red light off whenever the SPI UCA0 receives the character "A" transmitted from the master SPI UCB0. #include "msp430g2553.h" #include void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= BIT0; P1OUT |= BIT0; P1SEL = BIT1 + BIT2 + BIT4; P1SEL2 = BIT1 + BIT2 + BIT4; UCA0CTL1 = UCSWRST; // **Put state machine in reset** UCA0CTL0 |= UCCKPL + UCMSB + UCSYNC; // 3-pin, 8-bit SPI slave UCA0CTL1 &= ~UCSWRST;
×
×
  • Create New...