#include "LPC11xx.h"#include "uart.h"#include "i2c.h"#include "type.h"extern volatile uint32_t UARTCount;extern volatile uint8_t UARTBuffer[BUFSIZE];extern volatile uint32_t I2CCount;extern volatile uint8_t I2CMasterBuffer[BUFSIZE];extern volatile uint32_t I2CMasterState;extern volatile uint32_t I2CReadLength, I2CWriteLength;uint32_t i;int main (void) { /* Basic chip initialization is taken care of in SystemInit() called * from the startup code. SystemInit() and chip settings are defined * in the CMSIS system_<part family>.c file. */ /* NVIC is installed inside UARTInit file. */ volatileuint8_t ch = 0; UARTInit(115200); LPC_UART->IER = IER_THRE | IER_RLS; // 设置中断使能寄存器// UARTSendByte('a');// UARTSendByte('b');// UARTSendByte('c'); while (1) { ch = UARTReceiveByte(); // 接收字符 if (ch != 0x00) { UARTSendByte(ch); // 发送接收数据 // switch(ch) //{ //case 'a': if ( I2CInit( (uint32_t)I2CMASTER ) == FALSE )/* 初始化I2c主模式 */ { while ( 1 );/* Fatal error */ } while(ch=='a') { //彩蛇 I2CWriteLength = 30; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x80;/*control register*/ I2CMasterBuffer[2] = 0x83;/* MODE1 */ //只开一个sub I2CMasterBuffer[3] = 0x0c;/* MODE2 */ I2CMasterBuffer[4] = 0xff;/* PWM0 */ I2CMasterBuffer[5] = 0xff;/* PWM1 */ I2CMasterBuffer[6] = 0xff;/* PWM2 */ I2CMasterBuffer[7] = 0xff;/* PWM3 */ I2CMasterBuffer[8] = 0xff;/* PWM4 */ I2CMasterBuffer[9] = 0xff;/* PWM5 */ I2CMasterBuffer[10] = 0xff;/* PWM6 */ I2CMasterBuffer[11] = 0xff;/* PWM7 */ I2CMasterBuffer[12] = 0xff;/* PWM8 */ I2CMasterBuffer[13] = 0xff;/* PWM9 */ I2CMasterBuffer[14] = 0xff;/* PWM10 */ I2CMasterBuffer[15] = 0xff;/* PWM11 */ I2CMasterBuffer[16] = 0xff;/* PWM12 */ I2CMasterBuffer[17] = 0xff;/* PWM13 */ I2CMasterBuffer[18] = 0xff;/* PWM14 */ I2CMasterBuffer[19] = 0xff;/* PWM15 */ I2CMasterBuffer[20] = 0x55;/* GRPPWM */ I2CMasterBuffer[21] = 0xee;/* GRPFREQ */ I2CMasterBuffer[22] = 0x57;/* LEDOUT0 */ I2CMasterBuffer[23] = 0x55;/* LEDOUT1 */ //01是关……NND... I2CMasterBuffer[24] = 0x55;/* LEDOUT2 */ I2CMasterBuffer[25] = 0x55;/* LEDOUT3 */ I2CMasterBuffer[26] = PCA9635_ADDR1;/* SUBADR1*/ I2CMasterBuffer[27] = PCA9635_ADDR2;/* SUBADR2 */ I2CMasterBuffer[28] = PCA9635_ADDR3;/* SUBADR3 */ I2CMasterBuffer[29] = 0xE0;/* ALLCALLADR */ I2CEngine(); //点红灯 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x17; //control I2CMasterBuffer[2] = 0x15; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x11; //control I2CMasterBuffer[2] = 0xaf; //pwm I2CEngine(); for(i=0;i<600000;i++); //开第2个led I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x14; //control I2CMasterBuffer[2] = 0x5f; I2CEngine(); for(i=0;i<300000;i++); //开第3个led I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x14; I2CMasterBuffer[2] = 0x7f; I2CEngine(); for(i=0;i<300000;i++); //开第4个led I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x14; I2CMasterBuffer[2] = 0xff; I2CEngine(); for(i=0;i<300000;i++); //开第8个led I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0xd5; I2CEngine(); for(i=0;i<300000;i++); //开第7个led I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0xf5; I2CEngine(); for(i=0;i<300000;i++); //开第6个led 关1 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0xfd; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x14; I2CMasterBuffer[2] = 0xfd; I2CEngine(); for(i=0;i<300000;i++); //开第5个led 关2 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0xff; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x14; I2CMasterBuffer[2] = 0xf5; I2CEngine(); for(i=0;i<300000;i++); //开第9个led,关3 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0x57; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x14; I2CMasterBuffer[2] = 0xd5; I2CEngine(); for(i=0;i<300000;i++); //开第10个led,关4 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0x5f; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x14; I2CMasterBuffer[2] = 0x55; I2CEngine(); for(i=0;i<300000;i++); //开第11个led,关8 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0x7f; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0x7f; I2CEngine(); for(i=0;i<300000;i++); //开第12个led,关7 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0xff; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0x5f; I2CEngine(); for(i=0;i<300000;i++); //关全呼叫D7 8 9 10 11 12,开子呼叫5 9 10 11 12 变成红色 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0x57; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0xff; I2CEngine(); for(i=0;i<300000;i++); //关子5,开子15 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x15; I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x17; I2CMasterBuffer[2] = 0xf5; I2CEngine(); for(i=0;i<300000;i++); //关9,开14 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0xfd; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x17; I2CMasterBuffer[2] = 0xfd; I2CEngine(); for(i=0;i<300000;i++); //关10,开13 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0xf5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x17; I2CMasterBuffer[2] = 0xff; I2CEngine(); for(i=0;i<300000;i++); //关11 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0xd5; I2CEngine(); for(i=0;i<300000;i++); //关12 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x16; I2CMasterBuffer[2] = 0x55; I2CEngine(); for(i=0;i<300000;i++); //关16 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x17; I2CMasterBuffer[2] = 0x7f; I2CEngine(); for(i=0;i<300000;i++); //关15 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x17; I2CMasterBuffer[2] = 0x5f; I2CEngine(); for(i=0;i<300000;i++); //关14 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x17; I2CMasterBuffer[2] = 0x57; I2CEngine(); for(i=0;i<300000;i++); //关13 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = PCA9635_ADDR1; I2CMasterBuffer[1] = 0x17; I2CMasterBuffer[2] = 0x55; I2CEngine(); for(i=0;i<300000;i++); } //break; //case 'b': // if ( I2CInit( (uint32_t)I2CMASTER ) == FALSE )/* 初始化I2c主模式 */ // { //while ( 1 );/* Fatal error */ // } while(ch=='b') { I2CWriteLength = 30; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x80;/*control register*/ I2CMasterBuffer[2] = 0x8f;/* MODE1 */ I2CMasterBuffer[3] = 0x2c;/* MODE2 */ I2CMasterBuffer[4] = 0xff;/* PWM0 */ I2CMasterBuffer[5] = 0xff;/* PWM1 */ I2CMasterBuffer[6] = 0xff;/* PWM2 */ I2CMasterBuffer[7] = 0xff;/* PWM3 */ I2CMasterBuffer[8] = 0xff;/* PWM4 */ I2CMasterBuffer[9] = 0xff;/* PWM5 */ I2CMasterBuffer[10] = 0xff;/* PWM6 */ I2CMasterBuffer[11] = 0xff;/* PWM7 */ I2CMasterBuffer[12] = 0xff;/* PWM8 */ I2CMasterBuffer[13] = 0xff;/* PWM9 */ I2CMasterBuffer[14] = 0xff;/* PWM10 */ I2CMasterBuffer[15] = 0xff;/* PWM11 */ I2CMasterBuffer[16] = 0xff;/* PWM12 */ I2CMasterBuffer[17] = 0xff;/* PWM13 */ I2CMasterBuffer[18] = 0xff;/* PWM14 */ I2CMasterBuffer[19] = 0xff;/* PWM15 */ I2CMasterBuffer[20] = 0x11;/* GRPPWM */ I2CMasterBuffer[21] = 0xee;/* GRPFREQ */ //慢点闪 I2CMasterBuffer[22] = 0xff;/* LEDOUT0 */ I2CMasterBuffer[23] = 0xd7;/* LEDOUT1 */ //01是关……NND... I2CMasterBuffer[24] = 0xd7;/* LEDOUT2 */ I2CMasterBuffer[25] = 0xff;/* LEDOUT3 */ I2CMasterBuffer[26] = PCA9635_ADDR1;/* SUBADR1*/ I2CMasterBuffer[27] = PCA9635_ADDR2;/* SUBADR2 */ I2CMasterBuffer[28] = PCA9635_ADDR3;/* SUBADR3 */ I2CMasterBuffer[29] = 0xE0;/* ALLCALLADR */ I2CEngine(); for(i=0;i<1500000;i++); I2CWriteLength = 30; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x80;/*control register*/ I2CMasterBuffer[2] = 0xef;/* MODE1 */ I2CMasterBuffer[3] = 0x3c;/* MODE2 */ I2CMasterBuffer[4] = 0xff;/* PWM0 */ I2CMasterBuffer[5] = 0xff;/* PWM1 */ I2CMasterBuffer[6] = 0xff;/* PWM2 */ I2CMasterBuffer[7] = 0xff;/* PWM3 */ I2CMasterBuffer[8] = 0xff;/* PWM4 */ I2CMasterBuffer[9] = 0xff;/* PWM5 */ I2CMasterBuffer[10] = 0xff;/* PWM6 */ I2CMasterBuffer[11] = 0xff;/* PWM7 */ I2CMasterBuffer[12] = 0xff;/* PWM8 */ I2CMasterBuffer[13] = 0xff;/* PWM9 */ I2CMasterBuffer[14] = 0xff;/* PWM10 */ I2CMasterBuffer[15] = 0xff;/* PWM11 */ I2CMasterBuffer[16] = 0xff;/* PWM12 */ I2CMasterBuffer[17] = 0xff;/* PWM13 */ I2CMasterBuffer[18] = 0xff;/* PWM14 */ I2CMasterBuffer[19] = 0xff;/* PWM15 */ I2CMasterBuffer[20] = 0x11;/* GRPPWM */ I2CMasterBuffer[21] = 0xee;/* GRPFREQ */ //慢点闪 I2CMasterBuffer[22] = 0xff;/* LEDOUT0 */ I2CMasterBuffer[23] = 0xd7;/* LEDOUT1 */ //01是关……NND... I2CMasterBuffer[24] = 0xd7;/* LEDOUT2 */ I2CMasterBuffer[25] = 0xff;/* LEDOUT3 */ I2CMasterBuffer[26] = PCA9635_ADDR1;/* SUBADR1*/ I2CMasterBuffer[27] = PCA9635_ADDR2;/* SUBADR2 */ I2CMasterBuffer[28] = PCA9635_ADDR3;/* SUBADR3 */ I2CMasterBuffer[29] = 0xE0;/* ALLCALLADR */ I2CEngine(); for(i=0;i<1500000;i++); } // break; //case 'c': // if ( I2CInit( (uint32_t)I2CMASTER ) == FALSE )/* 初始化I2c主模式 */ // { //while ( 1 );/* Fatal error */ // } //X大图样 while(ch=='c') { I2CWriteLength = 30; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x80;/*control register*/ I2CMasterBuffer[2] = 0x8f;/* MODE1 */ I2CMasterBuffer[3] = 0x0c;/* MODE2 */ I2CMasterBuffer[4] = 0xff;/* PWM0 */ I2CMasterBuffer[5] = 0xff;/* PWM1 */ I2CMasterBuffer[6] = 0xff;/* PWM2 */ I2CMasterBuffer[7] = 0xff;/* PWM3 */ I2CMasterBuffer[8] = 0xff;/* PWM4 */ I2CMasterBuffer[9] = 0xff;/* PWM5 */ I2CMasterBuffer[10] = 0xff;/* PWM6 */ I2CMasterBuffer[11] = 0xff;/* PWM7 */ I2CMasterBuffer[12] = 0xff;/* PWM8 */ I2CMasterBuffer[13] = 0xff;/* PWM9 */ I2CMasterBuffer[14] = 0xff;/* PWM10 */ I2CMasterBuffer[15] = 0xff;/* PWM11 */ I2CMasterBuffer[16] = 0xff;/* PWM12 */ I2CMasterBuffer[17] = 0xff;/* PWM13 */ I2CMasterBuffer[18] = 0xff;/* PWM14 */ I2CMasterBuffer[19] = 0xff;/* PWM15 */ I2CMasterBuffer[20] = 0x55;/* GRPPWM */ I2CMasterBuffer[21] = 0xff;/* GRPFREQ */ //慢点闪 I2CMasterBuffer[22] = 0x57;/* LEDOUT0 */ I2CMasterBuffer[23] = 0x55;/* LEDOUT1 */ //01是关……NND... I2CMasterBuffer[24] = 0x55;/* LEDOUT2 */ I2CMasterBuffer[25] = 0x57;/* LEDOUT3 */ I2CMasterBuffer[26] = PCA9635_ADDR1;/* SUBADR1*/ I2CMasterBuffer[27] = PCA9635_ADDR2;/* SUBADR2 */ I2CMasterBuffer[28] = PCA9635_ADDR3;/* SUBADR3 */ I2CMasterBuffer[29] = 0xE0;/* ALLCALLADR */ I2CEngine(); for(i=0;i<500000;i++); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0x5f; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0x57; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0x57; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0x5f; I2CEngine(); for(i=0;i<500000;i++); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0x7f; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0x5d; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0x5d; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0x7f; I2CEngine(); for(i=0;i<500000;i++); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0xfd; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0x75; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0x75; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0xfd; I2CEngine(); for(i=0;i<500000;i++); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0xf5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0xd5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0xd5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0xf5; I2CEngine(); for(i=0;i<500000;i++); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0xd5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0xd5; I2CEngine(); for(i=0;i<500000;i++); //全关4 16 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0x55; I2CEngine(); for(i=0;i<500000;i++); //大字: //开5 13 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0x57; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0x57; I2CEngine(); for(i=0;i<200000;i++); //1,5,6,9,14 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0x57; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0x5f; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0x57; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0x5d; I2CEngine(); for(i=0;i<200000;i++); //2,5,6,7,10,13,15 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0x5d; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0x7f; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0x5d; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0x77; I2CEngine(); for(i=0;i<200000;i++); //3,6,7,8,11,14,16 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0x75; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0xfd; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0x75; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0xdd; I2CEngine(); for(i=0;i<200000;i++); //4, 8,12,7,15 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; I2CMasterBuffer[2] = 0xd5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0xf5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0xd5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0x75; I2CEngine(); for(i=0;i<200000;i++); //8,16 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x94; /*control register*/ I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0xd5; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x96; /*control register*/ I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0xd5; I2CEngine(); for(i=0;i<200000;i++); //关8,16 I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x95; /*control register*/ I2CMasterBuffer[2] = 0x55; I2CEngine(); I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xe0; /* address */ I2CMasterBuffer[1] = 0x97; /*control register*/ I2CMasterBuffer[2] = 0x55; I2CEngine(); for(i=0;i<200000;i++); } //break; // default: //break; // } //end of switch } //if } //while(1) return 0 ;}//main#include "LPC11xx.h"#include "uart.h"# 你的当前访问异常,请进行认证后继续阅读剩余内容。 提交