delay_ms(1000);
SCI0_send(Data_char[7]);
if(Decode_success) {
Head_start=0; Decode_over=0; Check_over=0;
Decode_cnt=0; //解码次数 // Decode_success=0; delay_ms(1000); delay_ms(1000); delay_ms(1000); // ECT0_Init(); // EnableInterrupts; }
if(Decode_success==10) {
Write_string(1,0,\;
Write_string(1,1,\; for(;;); // Wait for resetting 手动复位 } }
//数据校验子函数(算法有待改进)-----// void Data_check() {
if(Decode_over) {
//行校验// //---第1行//
s=Decode_data[0]; for(t=1;t<=4;t++) {
s=s^Decode_data[t]; }
switch(s) {
case 0:H_checkerror[0]=0;break; case 1:H_checkerror[0]=1;break; }
//---第2行//
s=Decode_data[5]; for(t=6;t<=9;t++) {
s=s^Decode_data[t]; } switch(s) {
case 0:H_checkerror[1]=0;break; case 1:H_checkerror[1]=1;break; } //---第3行//
s=Decode_data[10]; for(t=11;t<=14;t++) {
s=s^Decode_data[t]; } switch(s) {
case 0:H_checkerror[2]=0;break;
case 1:H_checkerror[2]=1;break; } //---第4行//
s=Decode_data[15]; for(t=16;t<=19;t++) {
s=s^Decode_data[t]; } switch(s) {
case 0:H_checkerror[3]=0;break; case 1:H_checkerror[3]=1;break; } //---第5行//
s=Decode_data[20]; for(t=21;t<=24;t++) {
s=s^Decode_data[t]; } switch(s) {
相关推荐: