📄 main.c
字号:
#include <LPC21xx.H>
void SPI_ISR (void) __irq;
void main (void)
{
unsigned int result;
PINSEL0 = 0x00005500; //enable SPI0 pins
S0SPCCR = 0x000000C8; //Set bit timing
S0SPCR = 0x000000A0; //Master interrupts enabled
VICVectCntl0 = 0x0000002A; //select a priority slot for a given interrupt
VICVectAddr0 = (unsigned)SPI_ISR; //pass the address of the IRQ into the VIC slot
VICIntEnable = 0x00000400; //enable interrupt
result = S0SPSR; //clear the status register prior to transmission
S0SPDR = 0x00000055; //write some data
while (1)
{
;
}
}
void SPI_ISR (void) __irq
{
unsigned int result;
result = S0SPSR; //read and clear the status flags
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -