项目开发日志及工程文件:
Gitee代码仓库:ChildSchoolBag: 儿童智能书包设计 (gitee.com)
int main(void)
{
int result1,result2;
int xingqiji=0;
int testcount;
delay_init(); //延时函数初始化
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级
uart_init(115200); //串口初始化为115200 抢占3,子3
LED_Init(); //初始化与LED连接的硬件接口
LCD_Init(); //初始化LCD
KEY_Init(); //按键初始化
AT24CXX_Init(); //IIC初始化
//RTC时钟启动
//usmart_dev.init(SystemCoreClock/1000000);
//RTC_Set(2024,4,8,11,32,00); //设置RTC时间
RTC_Init(); //RTC初始化
RTC_Set(2024,4,5,17,6,11); //设置RTC时间 , 模块的RTC电池没电了。每次下代码的时候都记得要更新电池
POINT_COLOR=RED;//设置LCD字体为红色
while(AT24CXX_Check())//检测不到24c02
{
LCD_ShowString(30,150,200,16,16,"24C02 Check Failed!");
delay_ms(500);
LED0=!LED0;//DS0闪烁
}
//AIRC780模块GPS初始化,避免等待搜星
uart3_init(115200);
result1 = esp8266_send_cmd("AT+CGNSPWR=1","ok",50);//第一个参数:内容,第二个参数:期望结果,第三个参数:延时时间(单位10ms)//打开GPS使能
if(result1==1)
{
printf("已发送开启GPS的AT指令\r\n");
}
result2 = esp8266_send_cmd("AT+CGNSAID=31,1,1,1","ok",50);//开始搜星
if(result2==1)
{
printf("已发送GPS搜星的AT指令\r\n");
}
POINT_COLOR=BLUE;//设置字体为蓝色
xingqiji = riqixianshi();
switch(xingqiji)//判断星期几
{
case 1:xingqiji = 87;duqukecheng(xingqiji);printf("星期一\r\n");break;
case 2:xingqiji = 111;duqukecheng(xingqiji);printf("星期二\r\n");break;
case 3:xingqiji = 135;duqukecheng(xingqiji);printf("星期三\r\n");break;
case 4:xingqiji = 159;duqukecheng(xingqiji);printf("星期四\r\n");break;
case 5:xingqiji = 183;duqukecheng(xingqiji);printf("星期五\r\n");break;
case 6:xingqiji = 207;duqukecheng(xingqiji);printf("星期六\r\n");break;
case 7:xingqiji = 231;duqukecheng(xingqiji);printf("星期日\r\n");break;
default:printf("无法获取日期\r\n");break;
}//判断星期几
//将今天的课程与刷卡模块相匹配
shuakaqidong();//初始化RC522
printf("准备进入课程匹配\r\n");
while(1)
{
IC_test();//开始刷卡,更新书籍信息
compareclass();//获取当日课程并比较,取得最后的class_total数组结果
LCD_ShowString(16+8,206,160,16,16,"These book you need:");
printf("结果数组的值是:");
for(testcount=0;testcount<10;testcount++)
{
printf(" %d",class_total[testcount]);
}
printf("\r\n");
printf("class0 : %d\r\n",class0);
printf("class1 : %d\r\n",class1);
printf("class2 : %d\r\n",class2);
printf("class3 : %d\r\n",class3);
printf("class4 : %d\r\n",class4);
printf("class5 : %d\r\n",class5);
printf("class6 : %d\r\n",class6);
printf("class7 : %d\r\n",class7);
printf("class8 : %d\r\n",class8);
printf("class9 : %d\r\n",class9);
if(class_total[1] == 0)//数学结果(没带书)//已查明未进判断条件,已经触发按键中断时会直接卡死程序(已查明是中断的原因)
{
//printf("显示数学缺少\r\n");//已验证可以动态变换数据,就是变量需要清零
LCD_ShowString(16,238,70,16,16,"Math");
}
else
{
LCD_Fill(16,238,86,254,WHITE);
}
if(class_total[2] == 0)//语文结果
{
LCD_ShowString(16+8+68,238,70,16,16,"Chinese");
}
else
{
LCD_Fill(16+6+68,238,162,254,WHITE);
}
if(class_total[3] == 0)//英语结果
{
LCD_ShowString(4+64+100,238,70,16,16,"English");
}
else
{
LCD_Fill(168,238,238,254,WHITE);
}
if(class_total[4] == 0)//物理结果
{
LCD_ShowString(6,268,70,16,16,"Physics");
}
else
{
LCD_Fill(6,268,76,284,WHITE);
}
if(class_total[5] == 0)//生物结果
{
LCD_ShowString(16+8+64,268,70,16,16,"Biology");
}
else
{
LCD_Fill(16+8+64,268,158,284,WHITE);
}
if(class_total[6] == 0)//化学结果
{
LCD_ShowString(8+64+100,268,70,16,16,"Chemistry");
}
else
{
LCD_Fill(172,268,242,284,WHITE);
}
if(class_total[7] == 0)//地理结果
{
LCD_ShowString(6,296,70,16,16,"Geography");
}
else
{
LCD_Fill(6,296,92,312,WHITE);
}
if(class_total[8] == 0)//政治结果
{
LCD_ShowString(18+10+68,296,70,16,16,"Politics");
}
else
{
LCD_Fill(96,296,166,312,WHITE);
}
if(class_total[9] == 0)//历史结果
{
LCD_ShowString(8+64+108,296,70,16,16,"History");
}
else
{
LCD_Fill(180,296,250,312,WHITE);
}
key = KEY_Scan(0);
if(key == WKUP_PRES)
{
shuakaguanbi();
printf("正在退出检查书的程序\r\n");
LCD_Clear(WHITE);
break;
}
}
//以上为系统自检部分
//以下为用户操作部分
while(1)
{
printf("进入主界面\r\n");
while(1)
{
xingqiji = riqixianshi();
LCD_ShowString(60+24+32,120,200,16,16,"-");
LCD_ShowString(60+24+54,120,200,16,16,"-");
LCD_ShowString(60+24+16,175,200,16,16,":");
LCD_ShowString(60+24+28+12,175,200,16,16,":");
LCD_ShowNum(60+24,120,calendar.w_year,4,16);
LCD_ShowNum(100+24,120,calendar.w_month,2,16);
LCD_ShowNum(124+24,120,calendar.w_date,2,16);
LCD_ShowNum(60+24,175,calendar.hour,2,16);
LCD_ShowNum(84+24,175,calendar.min,2,16);
LCD_ShowNum(108+24,175,calendar.sec,2,16);
key=KEY_Scan(0);
LCD_ShowString(16+6+64+6,64,70,16,16,"Welcome");
LCD_ShowString(16+60,222,100,16,16,"KEY0 - CHECK");
LCD_ShowString(16+60,238,100,16,16,"KEY1 - IPUT");
LCD_ShowString(16+60,254,100,16,16,"KEY_UP - GPS");
if(key==KEY1_PRES)//KEY1 进入课表输入
{
tp_dev.init();//初始化触摸屏控制器
TP_Adjust();//一定要写入,屏幕校准函数,正点原子的屏幕太弱了,必须每次开机都要校准,不然概率摸上去没反应
TP_Init();
lurukecheng();
}
else if(key==KEY0_PRES)//KEY0 进入课表查询
{
chakankecheng();
}
else if(key==WKUP_PRES)//已验证发送GPS和短信成功,GPS数据需要室外验证
{
LCD_ShowString(16+60,100,100,16,16,"SEND GPS.....");
hujiu(Jing,Wei);
LCD_Fill(16+60,100,176,116,WHITE);
}
//delay_ms(500);//消除频闪
}
}/
}
//以下为九种匹配转换函数///
void zhuanhuan0(u8 RX_BUFFER[])
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
LCD_ShowString(4+48+100,48,70,16,16,"NONE");
class0 = 1;
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
LCD_ShowString(4+48+100,48,70,16,16,"Math");
class1 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
LCD_ShowString(4+48+100,48,70,16,16,"Chinese");
class2 = 1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
LCD_ShowString(4+48+100,48,70,16,16,"English");
class3 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
LCD_ShowString(4+48+100,48,70,16,16,"Physics");
class4 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,48,70,16,16,"Biology");
class5 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
LCD_ShowString(4+48+100,48,70,16,16,"Chemistry");
class6 = 1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,48,70,16,16,"Geography");
class7 = 1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
LCD_ShowString(4+48+100,48,70,16,16,"Politics");
class8 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')
{
LCD_ShowString(4+48+100,48,70,16,16,"History");
class9 = 1;
}
else
{
printf("RX_BUFFER[0] IS %c RX_BUFFER[1] IS %c RX_BUFFER[2] IS %c\r\n",USART_RX_BUF[0],RX_BUFFER[1],RX_BUFFER[2]);
LCD_ShowString(16+6+64+8,200,70,16,16,"ERROR!!");
}
}
void zhuanhuan1(u8 RX_BUFFER[])
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
LCD_ShowString(4+48+100,64,70,16,16,"NONE");
class0 = 1;
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
LCD_ShowString(4+48+100,64,70,16,16,"Math");
class1 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
LCD_ShowString(4+48+100,64,70,16,16,"Chinese");
class2 = 1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
LCD_ShowString(4+48+100,64,70,16,16,"English");
class3 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
LCD_ShowString(4+48+100,64,70,16,16,"Physics");
class4 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,64,70,16,16,"Biology");
class5 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
LCD_ShowString(4+48+100,64,70,16,16,"Chemistry");
class6 = 1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,64,70,16,16,"Geography");
class7 = 1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
LCD_ShowString(4+48+100,64,70,16,16,"Politics");
class8 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')
{
LCD_ShowString(4+48+100,64,70,16,16,"History");
class9 = 1;
}
else
{
printf("RX_BUFFER[0] IS %c RX_BUFFER[1] IS %c RX_BUFFER[2] IS %c\r\n",USART_RX_BUF[0],RX_BUFFER[1],RX_BUFFER[2]);
LCD_ShowString(16+6+64+8,200,70,16,16,"ERROR!!");
}
}
void zhuanhuan2(u8 RX_BUFFER[])
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
LCD_ShowString(4+48+100,80,70,16,16,"NONE");
class0 = 1;
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
LCD_ShowString(4+48+100,80,70,16,16,"Math");
class1 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
LCD_ShowString(4+48+100,80,70,16,16,"Chinese");
class2 = 1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
LCD_ShowString(4+48+100,80,70,16,16,"English");
class3 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
LCD_ShowString(4+48+100,80,70,16,16,"Physics");
class4 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,80,70,16,16,"Biology");
class5 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
LCD_ShowString(4+48+100,80,70,16,16,"Chemistry");
class6 = 1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,80,70,16,16,"Geography");
class7 = 1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
LCD_ShowString(4+48+100,80,70,16,16,"Politics");
class8 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')
{
LCD_ShowString(4+48+100,80,70,16,16,"History");
class9 = 1;
}
else
{
printf("RX_BUFFER[0] IS %c RX_BUFFER[1] IS %c RX_BUFFER[2] IS %c\r\n",USART_RX_BUF[0],RX_BUFFER[1],RX_BUFFER[2]);
LCD_ShowString(16+6+64+8,200,70,16,16,"ERROR!!");
}
}
void zhuanhuan3(u8 RX_BUFFER[])
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
LCD_ShowString(4+48+100,96,70,16,16,"NONE");
class0 = 1;
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
LCD_ShowString(4+48+100,96,70,16,16,"Math");
class1 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
LCD_ShowString(4+48+100,96,70,16,16,"Chinese");
class2 = 1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
LCD_ShowString(4+48+100,96,70,16,16,"English");
class3 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
LCD_ShowString(4+48+100,96,70,16,16,"Physics");
class4 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,96,70,16,16,"Biology");
class5 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
LCD_ShowString(4+48+100,96,70,16,16,"Chemistry");
class6 = 1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,96,70,16,16,"Geography");
class7 = 1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
LCD_ShowString(4+48+100,96,70,16,16,"Politics");
class8 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')
{
LCD_ShowString(4+48+100,96,70,16,16,"History");
class9 = 1;
}
else
{
printf("RX_BUFFER[0] IS %c RX_BUFFER[1] IS %c RX_BUFFER[2] IS %c\r\n",USART_RX_BUF[0],RX_BUFFER[1],RX_BUFFER[2]);
LCD_ShowString(16+6+64+8,200,70,16,16,"ERROR!!");
}
}
void zhuanhuan4(u8 RX_BUFFER[])
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
LCD_ShowString(4+48+100,112,70,16,16,"NONE");
class0 = 1;
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
LCD_ShowString(4+48+100,112,70,16,16,"Math");
class1 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
LCD_ShowString(4+48+100,112,70,16,16,"Chinese");
class2 = 1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
LCD_ShowString(4+48+100,112,70,16,16,"English");
class3 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
LCD_ShowString(4+48+100,112,70,16,16,"Physics");
class4 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,112,70,16,16,"Biology");
class5 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
LCD_ShowString(4+48+100,112,70,16,16,"Chemistry");
class6 = 1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,112,70,16,16,"Geography");
class7 = 1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
LCD_ShowString(4+48+100,112,70,16,16,"Politics");
class8 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')
{
LCD_ShowString(4+48+100,112,70,16,16,"History");
class9 = 1;
}
else
{
printf("RX_BUFFER[0] IS %c RX_BUFFER[1] IS %c RX_BUFFER[2] IS %c\r\n",USART_RX_BUF[0],RX_BUFFER[1],RX_BUFFER[2]);
LCD_ShowString(16+6+64+8,200,70,16,16,"ERROR!!");
}
}
void zhuanhuan5(u8 RX_BUFFER[])
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
LCD_ShowString(4+48+100,128,70,16,16,"NONE");
class0 = 1;
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
LCD_ShowString(4+48+100,128,70,16,16,"Math");
class1 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
LCD_ShowString(4+48+100,128,70,16,16,"Chinese");
class2 = 1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
LCD_ShowString(4+48+100,128,70,16,16,"English");
class3 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
LCD_ShowString(4+48+100,128,70,16,16,"Physics");
class4 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,128,70,16,16,"Biology");
class5 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
LCD_ShowString(4+48+100,128,70,16,16,"Chemistry");
class6 = 1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,128,70,16,16,"Geography");
class7 = 1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
LCD_ShowString(4+48+100,128,70,16,16,"Politics");
class8 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')
{
LCD_ShowString(4+48+100,128,70,16,16,"History");
class9 = 1;
}
else
{
printf("RX_BUFFER[0] IS %c RX_BUFFER[1] IS %c RX_BUFFER[2] IS %c\r\n",USART_RX_BUF[0],RX_BUFFER[1],RX_BUFFER[2]);
LCD_ShowString(16+6+64+8,200,70,16,16,"ERROR!!");
}
}
void zhuanhuan6(u8 RX_BUFFER[])
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
LCD_ShowString(4+48+100,144,70,16,16,"NONE");
class0 = 1;
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
LCD_ShowString(4+48+100,144,70,16,16,"Math");
class1 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
LCD_ShowString(4+48+100,144,70,16,16,"Chinese");
class2 = 1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
LCD_ShowString(4+48+100,144,70,16,16,"English");
class3 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
LCD_ShowString(4+48+100,144,70,16,16,"Physics");
class4 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,144,70,16,16,"Biology");
class5 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
LCD_ShowString(4+48+100,144,70,16,16,"Chemistry");
class6 = 1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,144,70,16,16,"Geography");
class7 = 1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
LCD_ShowString(4+48+100,144,70,16,16,"Politics");
class8 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')
{
LCD_ShowString(4+48+100,144,70,16,16,"History");
class9 = 1;
}
else
{
printf("RX_BUFFER[0] IS %c RX_BUFFER[1] IS %c RX_BUFFER[2] IS %c\r\n",USART_RX_BUF[0],RX_BUFFER[1],RX_BUFFER[2]);
LCD_ShowString(16+6+64+8,200,70,16,16,"ERROR!!");
}
}
void zhuanhuan7(u8 RX_BUFFER[])
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
LCD_ShowString(4+48+100,160,70,16,16,"NONE");
class0 = 1;
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
LCD_ShowString(4+48+100,160,70,16,16,"Math");
class1 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
LCD_ShowString(4+48+100,160,70,16,16,"Chinese");
class2 = 1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
LCD_ShowString(4+48+100,160,70,16,16,"English");
class3 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
LCD_ShowString(4+48+100,160,70,16,16,"Physics");
class4 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,160,70,16,16,"Biology");
class5 = 1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
LCD_ShowString(4+48+100,160,70,16,16,"Chemistry");
class6 = 1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
LCD_ShowString(4+48+100,160,70,16,16,"Geography");
class7 = 1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
LCD_ShowString(4+48+100,160,70,16,16,"Politics");
class8 = 1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')//不判断首位(写入AT24C02特性问题)
{
LCD_ShowString(4+48+100,160,70,16,16,"History");
class9 = 1;
}
else
{
printf("RX_BUFFER[0] IS %c RX_BUFFER[1] IS %c RX_BUFFER[2] IS %c\r\n",USART_RX_BUF[0],RX_BUFFER[1],RX_BUFFER[2]);
LCD_ShowString(16+6+64+8,200,70,16,16,"ERROR!!");
}
}
void AT24C02duqukecheng(u8 RX_BUFFER[])//得到class0-9的数据,之后进行扫卡与运算即可
{
if(RX_BUFFER[1] == 'O' && RX_BUFFER[2] == 'N')
{
class0=1;//1表示有此类课程,注意每扫完一次全部清零即可
}
else if(RX_BUFFER[1] == 'a' && RX_BUFFER[2] == 't')
{
class1=1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'i')
{
class2=1;
}
else if(RX_BUFFER[1] == 'n' && RX_BUFFER[2] == 'g')
{
class3=1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'y')
{
class4=1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 'o')
{
class5=1;
}
else if(RX_BUFFER[1] == 'h' && RX_BUFFER[2] == 'e')
{
class6=1;
}
else if(RX_BUFFER[1] == 'e' && RX_BUFFER[2] == 'o')
{
class7=1;
}
else if(RX_BUFFER[1] == 'o' && RX_BUFFER[2] == 'l')
{
class8=1;
}
else if(RX_BUFFER[1] == 'i' && RX_BUFFER[2] == 's')//不判断首位(写入AT24C02特性问题)
{
class9=1;
}
}