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

📄 main.c

📁 功能强大的拨号器
💻 C
📖 第 1 页 / 共 2 页
字号:
									if(!remote_rs_flg)
										{
											remote_rs_flg=1;
											remote_key=KEY_A;
											LED=0;
											
										}
									else
										{
											remote_rs_flg=0;
											remote_key=KEY_C;
											LED=1;
											
										}
								}
								else
									remote_key=0xff;
								
							}
						
						if(!off_hook_out)
							{
								RUN_STATE=READY;
								split=1;
								line_hook=1;
								drop_count=0;
								program_flg=0;
								dial=1;
								first_key=0;
								remote_get_flg=1;
								start_flg=0;
								key_get_js=0;
								for(m=0;m<16;m++)
									drop_buf[m]=0xff;
								send_count_buf=0;
								
							}
					break;
	/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/					
					case LOCAL_CALL:
						
						line_hook=1;
						tx_time=150;
						while(tx_time);
						line_hook=0;
						tx_time=150;
						while(tx_time);
						time_out_flg=0;
						r_prom(DTMF_TIME_ON,&dtmf_on_time,1);
						r_prom(DTMF_INTER_DIGIT,&dtmf_off_time,1);
						if(dtmf_on_time==0xff)
							dtmf_on_time=16;
						if(dtmf_off_time==0xff)
							dtmf_off_time=14;
						if(program_flg)
							{
								program_flg=0;
							//	for(m=0;m<drop_count-1;m++)
							//		Send_byte(drop_buf[m]);
								
								for(m=0;m<drop_count-1;m++)
									{
										dial_dtmf(drop_buf[m],dtmf_on_time, dtmf_off_time);
									}
							}
						else
							{
								time_out_flg=0;
							//	for(m=0;m<drop_count;m++)
							//		Send_byte(drop_buf[m]);
							
								for(m=0;m<drop_count;m++)
									{
										dial_dtmf(drop_buf[m],dtmf_on_time, dtmf_off_time);
									}


							}
						tx_time=100;
						while(tx_time);
						split=1;
						line_hook=1;
						RUN_STATE=RUN;
						
					break;

	/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/					
					case IDD_CALL:

						
						switch(ACTION_TAB)
							{
							
							case DIAL_SERVER:
								
								
								line_hook=1;
								tx_time=150;
								while(tx_time);
								split=0;
								line_hook=0;
								dial=0;
									
								tt_time=300;
								while(tt_time);
								r_prom(DTMF_TIME_ON,&dtmf_on_time,1);
								r_prom(DTMF_INTER_DIGIT,&dtmf_off_time,1);
								if(dtmf_on_time==0xff)
									{
										dtmf_on_time=16;
										w_prom(DTMF_TIME_ON,&dtmf_on_time,1);
									}
								if(dtmf_off_time==0xff)
									{
										dtmf_off_time=14;
										w_prom(DTMF_INTER_DIGIT,&dtmf_off_time,1);
									}
									
								r_prom(SEVER_SELECT, &sever_number_select, 1);
										
								if(sever_number_select>1)
									{
										sever_number_select=0;
										w_prom(SEVER_SELECT, &sever_number_select, 1);

									}

								//---------------------Getway number-------------------------------
								dial_num(GETWAY_NUMBER);
							//	for(m=0;m<8;m++)
							//		dial_dtmf(server_number[sever_number_select][m],dtmf_on_time,dtmf_off_time);
							//	for(m=0;m<13;m++)
							//		dial_dtmf(digit_Germ[m],dtmf_on_time,dtmf_off_time);
							//	for(m=0;m<12;m++)
							//		dial_dtmf(digit_Chongqi[m],dtmf_on_time,dtmf_off_time);
								//--------------------------------------------------------
								sys_2sec_js=200;			//delay 1S
								sys_2sec_flg=0;
								time_counter=0;
										
								ACTION_TAB=DIAL_CAR_BIN;
							
							break;

							case DIAL_CAR_BIN:
								
								if(sys_2sec_flg)
									{
										time_counter++;
										sys_2sec_flg=0;
										if(time_counter>=2)		// 3
											{
												time_counter=0;
												if(drop_buf[send_count_buf]<0x0b||!car_select_flg)
													{
													dial_dtmf(1,dtmf_on_time, dtmf_off_time);

													//tt_time=800;
													tt_time=500;
													while(tt_time);
													}
									
												if(car_select_flg)
													{
														
													//	car_select_flg=0;
													//	dial_num(CAR_BIN+drop_buf[send_count_buf]*0x100+drop_buf[send_count_buf+1]*0X10);
													if(drop_buf[send_count_buf]<0x0b)
														{
															dial_num(CAR_BIN+drop_buf[send_count_buf]*0x10);
															dial_dtmf(0x0c,dtmf_on_time, dtmf_off_time);
															sys_2sec_js=0;
															sys_2sec_flg=0;
															time_counter=0;
														}
													else
														{
															sys_2sec_flg=1;
															time_counter=4;
														}
													}
												else
													{
														dial_num(CAR_BIN);
														dial_dtmf(0x0c,dtmf_on_time, dtmf_off_time);
														sys_2sec_js=0;
														sys_2sec_flg=0;
														time_counter=0;
													}
												
												
												ACTION_TAB=DIAL_DEST; 
										
											}
									}
							break;

							case DIAL_DEST:
								if(sys_2sec_flg)
									{
										time_counter++;
										sys_2sec_flg=0;
										if(time_counter>=1)		// 2
											{	
												time_counter=0;
												if(program_flg)
													{
														program_flg=0;	
														if(car_select_flg)					//select the car bin
															{
															car_select_flg=0;
															for(m=match_num;m<send_count_buf-1;m++)		
																{
																

																	dial_dtmf(drop_buf[m],dtmf_on_time, dtmf_off_time);
																
																}
															}
														else
															{
															for(m=match_num;m<drop_count-1;m++)			//direct dial #
																{
																	dial_dtmf(drop_buf[m],dtmf_on_time, dtmf_off_time);
																}
															}
													}
												
												else
													{
														if(!time_out_flg)
															{
														
															
															for(m=match_num;m<drop_count-1;m++)
																{
																	dial_dtmf(drop_buf[m],dtmf_on_time, dtmf_off_time);
																}
															}
														else
															{
																time_out_flg=0;																
																for(m=match_num;m<drop_count;m++)
																{
																	dial_dtmf(drop_buf[m],dtmf_on_time, dtmf_off_time);
																}
															}
																
													}
										
												sys_2sec_js=0;
												sys_2sec_flg=0;
												time_counter=0;
												sys_2sec_flg=1;
												ACTION_TAB=DIAL_END;
												//car_bin_flg=0;
											}
									}

							break;

							case DIAL_END:
								if(sys_2sec_flg)
									{
										time_counter++;
										sys_2sec_flg=0;
									//	if(time_counter>=2)
									//		{	
												sys_2sec_js=0;
												sys_2sec_flg=0;
												time_counter=0;
												dial_dtmf(0x0c,dtmf_on_time, dtmf_off_time);
												split=1;
												//drop_buf[0]=0xff;
												ACTION_TAB=NULL_ACT;
												program_flg=0;
												RUN_STATE=RUN;
												car_bin_flg=0;
								//			}
									}
							break;
							
							case NULL_ACT:
								
							break;

							
							default:
							break;
						}

					if(!off_hook_out)
						{
							RUN_STATE=READY;
							split=1;
							line_hook=1;
							drop_count=0;
							program_flg=0;
							dial=1;
							first_key=0;
							remote_get_flg=1;
							start_flg=0;
							key_get_js=0;
							time_out_flg=0;
							send_count_buf=0;
							for(m=0;m<16;m++)
								drop_buf[m]=0xff;
								
						}


					break;
	/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/					
					case ESRASE:
						if(program_flg)
							{
							//	password_check_flg=0;
								program_flg=0;
								for(m=0;m<6;m++)
									{
										if(drop_buf[m+2]!=sever_password[m])
											{
												m=0;
												break;
											}
									}
								if(m)
									{
										ack_ok();
										RUN_STATE=SE_SELECT;
										drop_count=0;
									}
								
								else if(drop_buf[2]==0x0b&&drop_buf[3]==0x0b)
									{
										drop_buf[0]=0xff;
										
									//	for(addr=0x800;addr<0xb00;)
									//		{
									//			w_prom(addr,&E_flash, 16);
									//			addr+=0x10;
												
									//		}
									sector_addr=0x8000;
									for(m=0;m<8;m++)
										{
										erasure_sector(sector_addr);
										sector_addr+=0x0200;
									//	red_led=!red_led;
										}
									
										ack_ok();
									}
								
								else
									{
										ack_err();
										
									}
								
							}

					if(!off_hook_out)
						{
							RUN_STATE=READY;
							split=1;
							line_hook=1;
							drop_count=0;
							program_flg=0;
							dial=1;
							first_key=0;
							remote_get_flg=1;
							start_flg=0;
							key_get_js=0;
							time_out_flg=0;
							for(m=0;m<16;m++)
								drop_buf[m]=0xff;
							send_count_buf=0;
								
						}


					break;
					
	/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/					
					case SE_SELECT:
						if(program_flg)
							{
								program_flg=0;
								if(drop_buf[0]==1)
									{
										sever_number_select=0;		
										w_prom(SEVER_SELECT, &sever_number_select, 1);
									}
								else if(drop_buf[0]==2)		
									{
										sever_number_select=1;
										w_prom(SEVER_SELECT, &sever_number_select, 1);
										
									}
								ack_ok();
								drop_count=0;
									
							}
						
						if(!off_hook_out)
						{
							RUN_STATE=READY;
							split=1;
							line_hook=1;
							drop_count=0;
							program_flg=0;
							dial=1;
							first_key=0;
							remote_get_flg=1;
							start_flg=0;
							key_get_js=0;
							time_out_flg=0;
							for(m=0;m<16;m++)
								drop_buf[m]=0xff;
							send_count_buf=0;
								
						}
					break;
					default: break;
				}

		}

}

⌨️ 快捷键说明

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