Beispiel #1
0
void CLevel23_Return(void)
{
	//switch(vCounter[1])
	switch(GetCounter2())
	{
        case 1://自检 返回 检测蜂鸣器标志是否已经打开 ,如果已经打开,则开启
			Led_Off();
				

//             if(GetSpeakerClick())
//             {
//                 SetAlarmFlag(0,1);
//             }
            //delay

            DelayMs(10);
            PWM1_Stop();
            PWM1_Set(0,0);
            DelayMs(10);
            BEEPOn();
            PWM1_Start();
            PWM1_Set( PWM_CYCLE, 0 );
            DelayMs(10);
            PWM1_Stop();
            PWM1_Set(0,0);

      
            SetZjFlag(0);//中断里打开喇叭响检测
				
            ClearScreen(0);
			Test_Menu(1);
//			SetSpeaker_Counter(0);
//			CLevel27_Sure();
			break;
		case 2:
			CSetIntenFlag(0);
			ClearScreen(0);
			Test_Menu(2);
			break;
		default:break;		
	}	
	SetCounter3(1);
 	//vCounter[2] = 1;
}
Beispiel #2
0
void alimentar(unsigned short tamanio) {
  PWM1_Start();                       // start PWM1
  PWM1_Set_Duty(90);
  Delay_ms(750);
  PWM1_Stop();
  if (tamanio == 'A'){
     Delay_ms(500);
   }
  else if (tamanio == 'B'){
     Delay_ms(1500);
   }
  else if (tamanio == 'C'){
     Delay_ms(2000);
   }
  else if (tamanio == 'D'){
     Delay_ms(2500);
   }
  PWM1_Start();
  PWM1_Set_Duty(30);
  Delay_ms(750);
  PWM1_Stop();
}
Beispiel #3
0
void alimentar(unsigned short tama) {
  PWM1_Set_Duty(70);
  PWM1_Start();                       // start PWM1
  Delay_ms(1000);
  PWM1_Stop();
  if (tama = 65){
     Delay_ms(100);
   }
  else if (tama = 66){
     Delay_ms(150);
   }
  else if (tama = 67){
     Delay_ms(200);
   }
  else if (tama = 68){
     Delay_ms(250);
   }
  PWM1_Set_Duty(50);
  PWM1_Start();
  Delay_ms(1000);
  PWM1_Stop();
}
Beispiel #4
0
/*level = 1~5, level = 0, close PWM*/
void PWM_level(kal_uint8 level)
{
   if (level > 5)
      ASSERT(0);
   
   PWM1_LEVEL_SAVE = level;
   if (level)
   {
      PWM1_Configure(PWM1_Level_Info[level-1][0],PWM1_Level_Info[level-1][1]);
      PWM1_Start();
   }
   else
   {
      PWM1_Stop();
   }
}
Beispiel #5
0
//################################################################################################################################
//--------------------------------------------------------------------------------------------------------------------------------
//函数名称:CLevel21_Sure()
//--------------------------------------------------------------------------------------------------------------------------------
//函数功能:确认键的第二层第3个任务
//--------------------------------------------------------------------------------------------------------------------------------
//输入参数:	tmp为第几个按键的值
//--------------------------------------------------------------------------------------------------------------------------------
//输出参数:	null
//--------------------------------------------------------------------------------------------------------------------------------
//说   明:
//--------------------------------------------------------------------------------------------------------------------------------
//################################################################################################################################
void CLevel23_Sure(uint8 tmp)//
{
	switch(tmp)
	{
        case 1://自检 喇叭响完就关闭了
			ClearScreen(0);
			UartCom(CMD_139W,2);	   //发送心跳命令

			SetZjFlag(1);
		//加声光
			Led_On();
								
            DelayMs(10);
			PWM1_Start();
			PWM1_Set( PWM_CYCLE, 0 );
				
		//delay
            DelayMs(10);
            PWM1_Stop();
            DelayMs(10);

            PWM1_Start();
            PWM1_Set( PWM_CYCLE, 0 );

            TestSelf_Menu();

				
				
				
				
// 		SetSpeaker_Counter(1);
// 		CLevel27_Sure();	
			break;
        case 2://部件信号强度
			ClearScreen(0);
			CompInten_Menu(0,0,0,0);
			CSetIntenFlag(1);
			break;
		default:break;
	}
}
Beispiel #6
0
void Interrupt(){

  if(INTF_bit){    //External Interrupt occurred
  INTCON = 0;      //Disable all interrupts
  PORTB.F2 = 0;
  PORTD = 0;
  PWM1_Stop();
  }

  if (TMR1IF_bit){        //Timer1 Interrupt occurred
    TMR1IF_bit = 0;
    TMR1H         = 0x6D;
    TMR1L         = 0x84;
  dt = ADC_Read(0);   //Read analog value

  if (dt != dt0) {
  dt0 = dt;
  dt0 = dt0 >> 2;
  PWM1_Set_Duty(dt0);
  PWM1_Start(); 

  }

 }
Beispiel #7
0
//################################################################################################################################
//--------------------------------------------------------------------------------------------------------------------------------
//函数名称:CLevel1_Sure()
//--------------------------------------------------------------------------------------------------------------------------------
//函数功能:确认键的第一层任务
//--------------------------------------------------------------------------------------------------------------------------------
//输入参数:	tmp为第几个按键的值
//--------------------------------------------------------------------------------------------------------------------------------
//输出参数:	null
//--------------------------------------------------------------------------------------------------------------------------------
//说   明:
//--------------------------------------------------------------------------------------------------------------------------------
//################################################################################################################################
void CLevel1_Sure(uint8 tmp)//第一层任务
{
	uint8 hz[]="请按确定删除";
	uint8 j=1,delflag=1;
	switch(tmp)
	{
        case 1://设置
			GetSetGrap(GetCounter2());
			SetAnnUartFlag(1);
			break;
        case 2://check
			GetCheckGrap(GetCounter2());		
			break;
        case 3://test
			GetTestGrap(GetCounter2());		
			break;
        case 4://reset
			ClearScreen(0);
// 			Waiting_menu();
			ClrCirAlarmData();
			ClrDatatoFlash();
// 			ClrHistoryList();
			
			UartCom(CMD_139W,2);	   //发送心跳命令
			UartCom(CMD_139W,2);
			Led_Fault_Off();
			Led_Fire_Off();
			Fire_Relay_Off();
			Fault_Relay_Off();
			SetAlarmFlag(0,0);
			PWM1_Stop();
// 			ClearScreen(0);
			SysReset_Menu();
			break;
        case 5://system reset
			while(FIO0PIN&(1 << 10))
			{
				if(j==1)
				{
					ClearScreen(0);
					j=0;
				}
				DisplayJBHZK(1,2,16,((hz[0]<<8)+hz[1]));
				DisplayJBHZK(1,2,32,((hz[2]<<8)+hz[3]));
				DisplayJBHZK(1,2,48,((hz[4]<<8)+hz[5]));
				DisplayJBHZK(2,2,0,((hz[6]<<8)+hz[7]));
				DisplayJBHZK(2,2,16,((hz[8]<<8)+hz[9]));
				DisplayJBHZK(2,2,32,((hz[10]<<8)+hz[11]));
				if(!(FIO0PIN&(1 << 25)))
				{
					delflag=0;
					j=1;
					SetMenuFlag(0);
					SubGrapCount();
					SetCounter1(1);
					break;
				}
			}
			if(delflag==1)
			{
				ClearScreen(0);
				Waiting_menu();
				EndInt(); 
				//M25P80_Bulk_Erase();
				M25P80_Section_Erase(0x00000);
				M25P80_Section_Erase(0x10000);
				M25P80_Section_Erase(0x20000);
				M25P80_Section_Erase(0x30000);
//				M25P80_Section_Erase(0x40000);
				M25P80_Section_Erase(0x50000);
				M25P80_Section_Erase(0x60000);
				M25P80_Section_Erase(0x70000);
//				M25P80_Section_Erase(0x80000);
				M25P80_Section_Erase(0x90000);
				M25P80_Section_Erase(0xa0000);
				M25P80_Section_Erase(0xb0000);
				M25P80_Section_Erase(0xc0000);
				M25P80_Section_Erase(0xd0000);
				M25P80_Section_Erase(0xe0000);
				M25P80_Section_Erase(0xf0000);		
				//延时10s
	// 			Delay1Ms(10000);
				StartInt();
				CPSNToFlashInit();
				SendToF_Init();
				MaskPSNInit();
				AlarmInfoInit();
				GetHistory();
	// 			HistConterInit();
				CirAlarmDataInit();
				SetCirAddrCurrent(0);
				ClrCirAlarmData();
				AnnCounterInit();
				InitHistPara();	
				ClearScreen(0);			
				Reset_OK();
			}			
			break;
//		case 6:
//			ClearScreen(0);
//			Waiting_menu();
//			EndInt();
//            M25P80_Section_Erase(0x60000);//地址代表啥
//			M25P80_Section_Erase(0x40000);
//			M25P80_Section_Erase(0x80000);
//			StartInt();
//			ClearScreen(0);
//			His_Reset();
//			break;
        case 6://set speaker
// 			ClearScreen(0);
// 			Speaker_Open_Close(0);
// 			PWM1_Stop();
// 			SetAlarmFlag(0,0);
			CLevel27_Sure();
			break;
		default:break;
	}
// 	vCounter[0] = 1;
}