Part Number: MSP430G2553
I'm trying to use UCB0 to talk to an ADC, while also using UCA0 to communicate with a PC via UART, however I can't seem to get anything to come out of P1.7 (SPI Out) on my device, and I also can't get the transmit interrupt to fire.
I've stripped the code right back so I'm not even attempting to set up the UART as well, but still no luck. I've got nothing connected and P1.7 (UCB0SIMO from the datasheet) seems to be floating with no data ever coming out?
//#include <msp430.h>
#include "msp430g2553.h"
void portCfg()
{
P1SEL |= BIT7 + BIT6 + BIT5;
P1SEL2 |= BIT7 + BIT6 + BIT5;
P1DIR |= BIT4 + BIT0;
P2DIR |= BIT0;
P2OUT |= BIT0;
}
void spiInit()
{
UCB0CTL1 |= UCSWRST;
UCB0CTL1 |= 0x02;
UCB0CTL0 |= UCMSB + UCMST + UCSYNC;
UCB0BR0 |= 0x02;
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST;
IE2 |= UCB0TXIE;
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD;
portCfg();
spiInit();
UCB0TXBUF = 'U';
_BIS_SR(LPM0 + GIE);
}
#pragma vector = USCIAB0TX_VECTOR
__interrupt void TransmitInterrupt(void)
{
UCB0TXBUF = 'U';
}
-- Whilst I'm here, is there any definitive guide for using the peripherals, as in, which registers to set up, what they do, all the different codes for various functions and modes? Stitching together bits of example code and scratching my head for hours on end seems to be getting me nowhere, and the datasheet for the micro doesn't list all the registers and shorthand macros I need to use.