main.c
来自「kei carm lpc2103 例子 好东西」· C语言 代码 · 共 39 行
C
39 行
#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 + =
减小字号Ctrl + -
显示快捷键?