用MSP430F5529硬件spi方式驱动一个spi的液晶,可以正常显示,但是按键却无法进入中断,我的相同程序在msp430f2553中是正常的,这是什么原因造成的?
经过排查问题,用模拟spi方式驱动就没有任何问题,我想知道根本的原因。
void initSPI()
{
//SPI Pins
P3SEL |= BIT3 + BIT4; // P3.3,4 option select
P2SEL |= BIT7; // P2.7 option select
//Clock Polarity: The inactive state is high
//MSB First, 8-bit, Master, 3-pin mode, Synchronous
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL0 |= UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master
// Clock polarity high, MSB
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 |= 0x02; // /2
UCA0BR1 = 0; //
UCA0MCTL = 0; // No modulation
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
P1OUT &= ~BIT2; // Now with SPI signals initialized,
__delay_cycles(100000);
P1OUT |= BIT2; // reset slave
__delay_cycles(100000); // Wait for slave to initialize
}
void SPI_WriteByte(uint8_t MST_Data)
{
UCA0TXBUF = MST_Data; // Transmit first character
while (!(UCA0IFG & UCTXIFG)); // USCI_A0 TX buffer ready?
// guochl:上面这句没有不行,放在传输之前也不行,不知道?
}