Hi All,
I am trying to debug the following code. I am sending an array to the "UCB0TXBUF " . I setup a break point to see the values of UCB0TXBUF. But I am unable to see the values. The variable "i" increments fine. Any advise! jess
int main(void)
{
int i =0;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
unsigned char command[] = {0xFF, 0xFE,0x05, 0x01,0x80,0xFE,0x01,0x00,0x7B};
P1OUT |= 0x02; // Set P1.0 for LED
// Set P1.1 for slave reset
P1DIR |= 0x03; // Set P1.0-2 to output direction
P3SEL |= 0xFF; // P3.5,4,0 option select
UCB0CTL1 |= UCSWRST; // **Put state machine in reset**
UCB0CTL0 |= UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master
// Clock polarity high, MSB
UCB0CTL1 |= UCSSEL_1; // SMCLK
UCB0BR0 = 0x02; // /2
UCB0BR1 = 0; //
// UCB0MCTL = 0; // No modulation
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCB0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
P1OUT &= ~0x02; // Now with SPI signals initialized,
P1OUT |= 0x02; // reset slave
__delay_cycles(100); // Wait for slave to initialize
MST_Data = 0xAA; // Initialize data values
SLV_Data = 0xAA; //
while (!(UCB0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
while (i != 9)
{
UCB0TXBUF = command[i];
i++;
__delay_cycles(40);
}
__bis_SR_register(LPM0_bits + GIE); // CPU off, enable interrupts
}