我正在使用 MSP430 Launchpad。更具体地说,我使用的是微控制器 MS430G2553。我试图编译一些为 MS430G2230 设计的代码,但问题是代码的某些部分与 MS430G2553 不匹配。这是代码
void USI_Init (void)
{
// configure SPI
USICTL0 |= USISWRST; // USI in reset
USICTL0 = USICTL0 | USILSB; // Least Significant Bit first
USICTL0 |= USIPE7 + USIPE6 + USIPE5 + USIMST + USIOE; // Port, SPI Master
USICTL1 |= USICKPH; // flag remains set
USICKCTL = USIDIV_1 + USISSEL_2; // /2 SMCLK
USICTL0 &= ~USISWRST; // USI released for operation
USICNT = USICNT | 0x50; // 16 bit mode; 16 bit to be transmitted/received
return;
}
这是第二个不起作用的例程
#pragma vector=WDT_VECTOR
__interrupt void Write_Matrix(void)
{
static unsigned char index=0;
P1OUT |= DATA_LATCH_PIN;
P1OUT &= ~DATA_LATCH_PIN;
USICTL1 &= ~USIIFG; // Clears the interrupt flag
USISRH = 1<<index; // Move the index of the column in the high bits of USISR
USISRL = Matrix[index]; // Move the index of the rows (value of Matrix[index]) in the low bits of USIRS
USICNT = USICNT | 0x10; // 16 bit format
index = (index+1) & 7;
return;
}
有任何想法吗?谢谢