中断使能
[mw_shl_code=applescript,true]void SPI1_Init(void)
{
....//SPI配置
SPI_Cmd(SPI1, ENABLE); //使能SPI外设
NVIC_InitStructure.NVIC_IRQChannel = SPI1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
[/mw_shl_code]
中断函数
[mw_shl_code=applescript,true]void SPI1_IRQHandler(void)
{
if(FlagTest == 0) FlagTest = 1;
if((SPI1->SR&1<<0)==1)
{
Slave_Temp = SPI1_ReadByte(0x00);
SPI1_ReadWriteByte(0xaa);
}
}
[/mw_shl_code]
程序就是不进入中断,求指导?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>