⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.c

📁 单片机程序代码,经过很详细的测试.呵呵,硬件相关.
💻 C
📖 第 1 页 / 共 5 页
字号:
			if (!GetMcpRdyTbl(5)){
				temp1 = rx_buf[i][0xA]-0x30;
				temp2 = rx_buf[i][0xB]-0x30;
				cmd_para_save.clock_source = temp1;
				cmd_para_save.clock_prio = temp2;
				SetMcpRdyTbl(5);
			}
			break;
		case 0x433133:				//command:"C13"
		case 0x633133:				//command:"c13"
			if (!GetMcpRdyTbl(6)){
				SetMcpRdyTbl(6);
			}
			break;
		case 0x433134:				//command:"C14"
		case 0x633134:				//command:"c14"
			if (!GetMcpRdyTbl(7)){
				temp1 = rx_buf[i][0xA]-0x30;
				cmd_para_save.clock_state_num = temp1;
				SetMcpRdyTbl(7);
			}
			break;
		case 0x433230:				//command:"C20"
		case 0x633230:				//command:"c20"
			if (!GetMcpRdyTbl(8)){
				cmd_para_save.ohget_board = rx_buf[i][0xA]-0x30;
				temp1 = rx_buf[i][0xC]-0x30;
				temp2 = rx_buf[i][0xD]-0x30;
				cmd_para_save.ohget_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE]-0x30;
				temp2 = rx_buf[i][0xF]-0x30;
				cmd_para_save.ohget_slot = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0x10];
				temp2 = rx_buf[i][0x11];
				cmd_para_save.ohget_name = (unsigned int)temp1 << 8 | temp2;
				SetMcpRdyTbl(8);
			}
			break;
		case 0x433231:				//command:"C21"
		case 0x633231:				//command:"c21"
			if (!GetMcpRdyTbl(9)){
				cmd_para_save.ohset_board = rx_buf[i][0xA]-0x30;
				temp1 = rx_buf[i][0xC]-0x30;
				temp2 = rx_buf[i][0xD]-0x30;
				cmd_para_save.ohset_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE]-0x30;
				temp2 = rx_buf[i][0xF]-0x30;
				cmd_para_save.ohset_slot = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0x10];
				temp2 = rx_buf[i][0x11];
				cmd_para_save.ohset_name = (unsigned int)temp1 << 8 | temp2;
				temp1 = AsciiToHex(rx_buf[i][0x12]);
				temp2 = AsciiToHex(rx_buf[i][0x13]);
				cmd_para_save.ohset_value = temp1 << 4 | temp2;
				SetMcpRdyTbl(9);
			}
			break;
		case 0x433232:				//command:"C22"
		case 0x633232:				//command:"c22"
			if (!GetMcpRdyTbl(18)){
				cmd_para_save.ohjget_board = rx_buf[i][0xA]-0x30;
				temp1 = rx_buf[i][0xC]-0x30;
				temp2 = rx_buf[i][0xD]-0x30;
				cmd_para_save.ohjget_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE]-0x30;
				temp2 = rx_buf[i][0xF]-0x30;
				cmd_para_save.ohjget_slot = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0x10];
				temp2 = rx_buf[i][0x11];
				cmd_para_save.ohjget_name = (unsigned int)temp1 << 8 | temp2;
				SetMcpRdyTbl(18);
			}
			break;
		case 0x433233:				//command:"C23"
		case 0x633233:				//command:"c23"
			if (!GetMcpRdyTbl(19)){
				cmd_para_save.ohjset_board = rx_buf[i][0xA]-0x30;
				temp1 = rx_buf[i][0xC]-0x30;
				temp2 = rx_buf[i][0xD]-0x30;
				cmd_para_save.ohjset_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE]-0x30;
				temp2 = rx_buf[i][0xF]-0x30;
				cmd_para_save.ohjset_slot = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0x10];
				temp2 = rx_buf[i][0x11];
				cmd_para_save.ohjset_name = (unsigned int)temp1 << 8 | temp2;
				for (temp = 0; temp <= 14; temp++){
					temp1 = AsciiToHex(rx_buf[i][2 * temp + 0x12]);
					temp2 = AsciiToHex(rx_buf[i][2 * temp + 0x13]);
					j_tx[temp] = temp1 << 4 | temp2;
				}
				SetMcpRdyTbl(19);
			}
			break;
		case 0x433330:				//command:"C30"
		case 0x633330:				//command:"c30"
			if (!GetMcpRdyTbl(10)){
				cmd_para_save.board_num = rx_buf[i][0xA]-0x30;
				SetMcpRdyTbl(10);
			}
			break;
		case 0x433331:				//command:"C31"
		case 0x633331:				//command:"c31"
			if (!GetMcpRdyTbl(11)){
				cmd_para_save.board_num = rx_buf[i][0xA]-0x30;
				SetMcpRdyTbl(11);
			}
			break;
		case 0x433430:				//command:"C40"
		case 0x633430:				//command:"c40"
			if (!GetMcpRdyTbl(12)){
				cmd_para_save.lpget_stat_board = rx_buf[i][0xA]-0x30;
				temp1 = rx_buf[i][0xC]-0x30;
				temp2 = rx_buf[i][0xD]-0x30;
				cmd_para_save.lpget_stat_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE]-0x30;
				temp2 = rx_buf[i][0xF]-0x30;
				cmd_para_save.lpget_stat_slot = temp1 * 10 + temp2;
				SetMcpRdyTbl(12);
			}
			break;
		case 0x433431:				//command:"C41"
		case 0x633431:				//command:"c41"
			if (!GetMcpRdyTbl(13)){
				cmd_para_save.lpset_stat_board = rx_buf[i][0xA]-0x30;
				cmd_para_save.lpset_stat_board_type = rx_buf[i][0xB]-0x30;
				temp1 = rx_buf[i][0xC]-0x30;
				temp2 = rx_buf[i][0xD]-0x30;
				cmd_para_save.lpset_stat_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE]-0x30;
				temp2 = rx_buf[i][0xF]-0x30;
				cmd_para_save.lpset_stat_slot = temp1 * 10 + temp2;
				cmd_para_save.lpset_stat_type = rx_buf[i][0x10]-0x30;
				SetMcpRdyTbl(13);
			}
			break;
		case 0x433530:				//command:"C50"
		case 0x633530:				//command:"c50"
			if (!GetMcpRdyTbl(14)){
				cmd_para_save.path_table_swget_board = rx_buf[i][0xA]-0x30;
				temp1 = rx_buf[i][0xC]-0x30;
				temp2 = rx_buf[i][0xD]-0x30;
				cmd_para_save.path_table_swget_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE]-0x30;
				temp2 = rx_buf[i][0xF]-0x30;
				cmd_para_save.path_table_swget_slot = temp1 * 10 + temp2;
				SetMcpRdyTbl(14);
			}
			break;
		case 0x433531:				//command:"C51"
		case 0x633531:				//command:"c51"
			if (!GetMcpRdyTbl(15)){
				cmd_para_save.path_table_swset_board = rx_buf[i][0xA] - 0x30;
				temp1 = rx_buf[i][0xC] - 0x30;
				temp2 = rx_buf[i][0xD] - 0x30;
				cmd_para_save.path_table_swset_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE] - 0x30;
				temp2 = rx_buf[i][0xF] - 0x30;
				cmd_para_save.path_table_swset_slot = temp1 * 10 + temp2;

				cmd_para_save.path_table_swset_Bboard = (rx_buf[i][0x10]) - 0x30;
				temp1 = (rx_buf[i][0x12]) - 0x30;
				temp2 = (rx_buf[i][0x13]) - 0x30;
				cmd_para_save.path_table_swset_Bport = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0x14]) - 0x30;
				temp2 = (rx_buf[i][0x15]) - 0x30;
				cmd_para_save.path_table_swset_Bslot = temp1 * 10 + temp2;

				cmd_para_save.path_table_swset_Bboard2 = (rx_buf[i][0x16]) - 0x30;
				temp1 = (rx_buf[i][0x18]) - 0x30;
				temp2 = (rx_buf[i][0x19]) - 0x30;
				cmd_para_save.path_table_swset_Bport2 = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0x1A]) - 0x30;
				temp2 = (rx_buf[i][0x1B]) - 0x30;
				cmd_para_save.path_table_swset_Bslot2 = temp1 * 10 + temp2;				
				SetMcpRdyTbl(15);
			}
			break;
		case 0x433532:				//command:"C52"
		case 0x633532:				//command:"c52"
			if (!GetMcpRdyTbl(16)){
				cmd_para_save.path_swset_board = (rx_buf[i][0xA]) - 0x30;
				temp1 = (rx_buf[i][0xC]) - 0x30;
				temp2 = (rx_buf[i][0xD]) - 0x30;
				cmd_para_save.path_swset_port = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0xE]) - 0x30;
				temp2 = (rx_buf[i][0xF]) - 0x30;
				cmd_para_save.path_swset_slot = temp1 * 10 + temp2;
				cmd_para_save.path_stset_board = (rx_buf[i][0x10]) - 0x30;
				temp1 = (rx_buf[i][0x12]) - 0x30;
				temp2 = (rx_buf[i][0x13]) - 0x30;
				cmd_para_save.path_stset_port = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0x14]) - 0x30;
				temp2 = (rx_buf[i][0x15]) - 0x30;
				cmd_para_save.path_stset_slot = temp1 * 10 + temp2;
				cmd_para_save.path_swset_mode = (rx_buf[i][0x16]) - 0x30;
				SetMcpRdyTbl(16);
			}
			break;
		case 0x433533:				//command:"C53"
		case 0x633533:				//command:"c53"
			if (!GetMcpRdyTbl(17)){
				cmd_para_save.path_stat_swget_board = (rx_buf[i][0xA]) - 0x30;
				temp1 = (rx_buf[i][0xC])-0x30;
				temp2 = (rx_buf[i][0xD])-0x30;
				cmd_para_save.path_stat_swget_port = temp1 * 10 + temp2;
				temp1 = rx_buf[i][0xE]-0x30;
				temp2 = (rx_buf[i][0xF])-0x30;
				cmd_para_save.path_stat_swget_slot = temp1 * 10 + temp2;
				SetMcpRdyTbl(17);
			}
			break;
		case 0x433636:				//command:"C66"
		case 0x633636:				//command:"c66"
			cmd_para_save.alarm_led_value = (rx_buf[i][0xA]) - 0x30;
			SetMcpRdyTbl(30);
			break;
		case 0x433730:				//command:"C73"
		case 0x633730:				//command:"c73"
			if (!GetMcpRdyTbl(18)){
				SetMcpRdyTbl(18);
			}
			break;
		case 0x433731:				//command:"C71"
		case 0x633731:				//command:"c71"
			if (!GetMcpRdyTbl(19)){
				SetMcpRdyTbl(19);
			}
			break;
		case 0x433830:				//command:"C80"
		case 0x633830:				//command:"c80"
			if (!GetMcpRdyTbl(20)){
				SetMcpRdyTbl(20);
			}
			break;
		case 0x433831:				//command:"C81"
		case 0x633831:				//command:"c81"
//			if (!GetMcpRdyTbl()){
//				cmd_para_save.board_init = (rx_buf[i][0xA])-0x30;
//				SetMcpRdyTbl();
//			}
			break;
		case 0x433832:				//command:"C82"
		case 0x633832:				//command:"c82"
			if (!GetMcpRdyTbl(21)){
				SetMcpRdyTbl(21);
			}
			break;
		case 0x433833:				//command:"C83"
		case 0x633833:				//command:"c83"
			if (!GetMcpRdyTbl(31)){
				SetMcpRdyTbl(28);
			}
			break;
		case 0x433930:				//command:"C90"
		case 0x633930:				//command:"c90"
				cmd_para_save.reset_EOS_board = (rx_buf[i][0x0A]) - 0x30;
				cmd_para_save.reset_EOS_value = (rx_buf[i][0x10]) - 0x30;
				SetMcpRdyTbl(31);
			break;
		case 0x433931:				//command:"C91"
		case 0x633931:				//command:"c91"
				cmd_para_save.set_address_board = (rx_buf[i][0x0A]) - 0x30;
				cmd_para_save.set_address_type  = (rx_buf[i][0x10]) - 0x30;
				temp1 = AsciiToHex(rx_buf[i][0x11]);
				temp2 = AsciiToHex(rx_buf[i][0x12]);
				cmd_para_save.set_address_value = (temp1 << 4) | temp2;
				SetMcpRdyTbl(32);
			break;
		case 0x433932:				//command:"C92"
		case 0x633932:				//command:"c92"
				cmd_para_save.get_address_board = (rx_buf[i][0x0A]) - 0x30;
				cmd_para_save.get_address_type  = (rx_buf[i][0x10]) - 0x30;
				SetMcpRdyTbl(33);
			break;
		case 0x433933:				//command:"C93"
		case 0x633933:				//command:"c93"
				cmd_para_save.set_search_board = (rx_buf[i][0x0A]) - 0x30;
				cmd_para_save.set_search_locate = (rx_buf[i][0x10]) - 0x30;
				SetMcpRdyTbl(34);
			break;
		case 0x433934:				//command:"C94"
		case 0x633934:				//command:"c94"
				cmd_para_save.get_search_board = (rx_buf[i][0x0A]) - 0x30;
				SetMcpRdyTbl(35);
			break;
		case 0x433935:				//command:"C95"
		case 0x633935:				//command:"c95"
				cmd_para_save.set_work_state_board = (rx_buf[i][0x0A]) - 0x30;
				cmd_para_save.set_work_state_value = (rx_buf[i][0x10]) - 0x30;
				SetMcpRdyTbl(36);
			break;
		case 0x433936:				//command:"C96"
		case 0x633936:				//command:"c96"
				cmd_para_save.get_work_state_board = (rx_buf[i][0x0A]) - 0x30;
				SetMcpRdyTbl(37);
			break;
		case 0x433937:				//command:"C97"
		case 0x633937:				//command:"c97"
				cmd_para_save.set_EOS_num_board = (rx_buf[i][0x0A]) - 0x30;
				cmd_para_save.set_EOS_num_value = (rx_buf[i][0x10]) - 0x30;
				SetMcpRdyTbl(38);
			break;
		case 0x433938:				//command:"C98"
		case 0x633938:				//command:"c98"
				cmd_para_save.get_EOS_num_board = (rx_buf[i][0x0A]) - 0x30;
				SetMcpRdyTbl(39);
			break;
		case 0x4D3031:				//command:"M01"
		case 0x6D3031:				//command:"m01"
			if (!GetMcpRdyTbl(22)){
				cmd_para_save.single_board_reset = (rx_buf[i][0xA]) - 0x30;;
				SetMcpRdyTbl(22);
			}
			break;
		case 0x503030:				//command:"P00"
		case 0x703030:				//command:"p00"
			if (!GetMcpRdyTbl(23)){
				SetMcpRdyTbl(23);
			}
			break;
		case 0x503031:				//command:"P01"
		case 0x703031:				//command:"p01"
			if (!GetMcpRdyTbl(24)){
				cmd_para_save.perfor_reset_board_15min = (rx_buf[i][0xA])-0x30;
				temp1 = (rx_buf[i][0xC])-0x30;
				temp2 = (rx_buf[i][0xD])-0x30;
				cmd_para_save.perfor_reset_port_15min = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0xE])-0x30;
				temp2 = (rx_buf[i][0xF])-0x30;
				cmd_para_save.perfor_reset_slot_15min = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0x10]) - 0x30;
				temp2 = (rx_buf[i][0x11]) - 0x30;
				cmd_para_save.perfor_reset_code_15min = temp1 * 10 + temp2;
				SetMcpRdyTbl(24);
			}
			break;
		case 0x503032:				//command:"P02"
		case 0x703032:				//command:"p02"
			if (!GetMcpRdyTbl(25)){
				SetMcpRdyTbl(25);
			}
			break;
		case 0x503033:				//command:"P03"
		case 0x703033:				//command:"p03"
			if (!GetMcpRdyTbl(26)){
				cmd_para_save.perfor_instant_get_board = (rx_buf[i][0xA])-0x30;
				temp1 = (rx_buf[i][0xC])-0x30;
				temp2 = (rx_buf[i][0xD])-0x30;
				cmd_para_save.perfor_instant_get_port = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0xE])-0x30;
				temp2 = (rx_buf[i][0xF])-0x30;
				cmd_para_save.perfor_instant_get_slot = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0x10]) - 0x30;
				temp2 = (rx_buf[i][0x11]) - 0x30;
				cmd_para_save.perfor_instant_get_code = temp1 * 10 + temp2;
				SetMcpRdyTbl(26);
			}
			break;
		case 0x503034:				//command:"P04"
		case 0x703034:				//command:"p04"
			if (!GetMcpRdyTbl(27)){
				cmd_para_save.perfor_threshold_set_board = (rx_buf[i][0xA])-0x30;
				temp1 = (rx_buf[i][0xC])-0x30;
				temp2 = (rx_buf[i][0xD])-0x30;
				cmd_para_save.perfor_threshold_set_port = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0xE])-0x30;
				temp2 = (rx_buf[i][0xF])-0x30;
				cmd_para_save.perfor_threshold_set_slot = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0x10]) - 0x30;
				temp2 = (rx_buf[i][0x11]) - 0x30;
				cmd_para_save.perfor_threshold_set_code = temp1 * 10 + temp2;
				per_threshold1 = (unsigned long int)AsciiToHex(rx_buf[i][0x12]);
				per_threshold2 = (unsigned long int)AsciiToHex(rx_buf[i][0x13]);
				per_threshold3 = (unsigned long int)AsciiToHex(rx_buf[i][0x14]);
				per_threshold4 = (unsigned long int)AsciiToHex(rx_buf[i][0x15]);
				per_threshold5 = (unsigned long int)AsciiToHex(rx_buf[i][0x16]);
				per_threshold6 = (unsigned long int)AsciiToHex(rx_buf[i][0x17]);
				per_threshold7 = (unsigned long int)AsciiToHex(rx_buf[i][0x18]);
				per_threshold8 = (unsigned long int)AsciiToHex(rx_buf[i][0x19]);
				cmd_para_save.perfor_threshold_set_value = per_threshold1 <<  28| per_threshold2 << 24 | per_threshold3 << 20 | per_threshold4 << 16 | per_threshold5 << 12 | per_threshold6 << 8 | per_threshold7 << 4 | per_threshold8;
				SetMcpRdyTbl(27);
			}
			break;
		case 0x503035:				//command:"P05"
		case 0x703035:				//command:"p05"
			if (!GetMcpRdyTbl(28)){
				cmd_para_save.perfor_sended = AsciiToHex(rx_buf[i][0xA]);
				SetMcpRdyTbl(28);
			}
			break;
		case 0x503037:				//command:"P07"
		case 0x703037:				//command:"p07"
			if (!GetMcpRdyTbl(29)){
				cmd_para_save.perfor_reset_board = (rx_buf[i][0xA])-0x30;
				temp1 = (rx_buf[i][0xC])-0x30;
				temp2 = (rx_buf[i][0xD])-0x30;
				cmd_para_save.perfor_reset_port = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0xE])-0x30;
				temp2 = (rx_buf[i][0xF])-0x30;
				cmd_para_save.perfor_reset_slot = temp1 * 10 + temp2;
				temp1 = (rx_buf[i][0x10]) - 0x30;
				temp2 = (rx_buf[i][0x11]) - 0x30;
				cmd_para_save.perfor_reset_code = temp1 * 10 + temp2;
				SetMcpRdyTbl(29);
			}
			break;
		case 0x563030:				//command"V00" MCP取MCU软件版本号
		case 0x763030:				//command"v00"
			if (!GetMcpRdyTbl(50)){
				SetMcpRdyTbl(50);
			}
			break;
		case 0x563031:				//command"V01" MCP取MCU硬件版本号
		case 0x763031:				//command"v01"
			if (!GetMcpRdyTbl(51)){
				SetMcpRdyTbl(51);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -