程序如下,设置断点发下程序执行到红色部分就不再往下执行了,不知道为什么。
int
main(void)
{
unsigned long ulDataTx[NUM_SSI_DATA];
unsigned long ulDataRx[NUM_SSI_DATA];
unsigned long ulindex;
//系统时钟
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
// Set up the serial console to use for displaying messages. This is
// just for this example program and is not needed for SSI operation.
InitConsole();
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA4_SSI0RX);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
// The pins are assigned as follows:
// PA5 - SSI0Tx
// PA4 - SSI0Rx
// PA3 - SSI0Fss
// PA2 - SSI0CLK
// TODO: change this to select the port/pin you are using.
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2);
//SSI配置
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
SSIEnable(SSI0_BASE);// 使能SSI0模块
for(int i=0;i<1;i++)
{
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3,0x01);//使能端置高电平
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3,0x00);//使能端置低电平
for(ulindex=0;ulindex<3;ulindex++)
{
//while(SSIBusy(SSI0_BASE));
SSIDataGet(SSI0_BASE, &ulDataRx[ulindex]);
//while(SSIBusy(SSI0_BASE));
ulDataRx[ulindex] &= 0x00FF;
}
cv=4.1*(float)(ulDataRx[0]&0x03<<14+ulDataRx[1]<<6+ulDataRx[2]>>2)/65535;
for(int j=0;j<10;j++);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3,0x01);//使能端置高电平
}
}
回复 楼主喜鹊王子 的帖子
应该是停在
//
// Wait until there is data to be read.
//
while(!(HWREG(ui32Base + SSI_O_SR) & SSI_SR_RNE))
{
}
换用 SSIDataGetNonBlocking 试试.