📄 text1.c
字号:
#include "lpc2103.h"
#include "config.h"
#include "I2CINT.c"
delay(int32 a)
{
while(a--);
}
main()
{ //uint8 b=0;
uint8 a[]={"78"};
PINSEL0=0x50;
IODIR=0xffffffff;
IOPIN=0X0;
I2CONCLR = 0x6C; /* 清除控制寄存器 */
I2SCLH = (11059200 / 100000 + 1) / 2; /* 设置高电平时间 */
I2SCLL = (11059200 / 100000) / 2;
VICIntSelect=0x20;
// VICDefVectAddr=(uint32)IRQ_I2C;
VICVectAddr15=(uint32)IRQ_I2C;
VICVectCntl15=0x29; //VICVectCntl0为第0级中断,VICVectCntl15为第15级中断,VICVectCntl必需与VICVectAddr对应
VICIntEnable |= 1<<9;
while(1)
{
I2C_WriteNByte(0xa0, 1, 0, a, 2);
delay(8000);
a[0]=0;
a[1]=0;
I2C_ReadNByte (0xa0, 1, 0, a, 2);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -