Пример #1
0
Tanggal MakeTANGGAL(int h, int b,int t)
{
     Tanggal T;
     if (IsTanggalValid(h,b,t))
     {
//T.DD=h;T.MM=b;T.YY=t;
          SetDay(&T,h);SetMonth(&T,b);SetYear(&T,t);
          return T;
     } else return T=Reset();
}
Пример #2
0
    ///////////////////////////////////////////////////////////////////////
    // Function: SetDate
    //
    //   Author: $author$
    //     Date: 6/21/2009
    ///////////////////////////////////////////////////////////////////////
    virtual EvError SetDate
    (const EvDate& date,
     bool isLocal=false,
     const EvTimezone* timezone=0) 
    {
        EvError error = EV_ERROR_NONE;
        INT year=date.GetYear();
        INT month=date.GetMonth();
        INT day=date.GetDay();

        //DBT("() %d/%d/%d\n", year, month, day);
        SetYear(year);
        SetMonth(month);
        SetDay(day);
        return error;
    }
Пример #3
0
void CDate_std::SetToTime(const CTime& time, CDate::EPrecision prec)
{
    switch (prec) {
    case CDate::ePrecision_second:
        SetSecond(time.Second());
        SetMinute(time.Minute());
        SetHour  (time.Hour());
        // fall through
    case CDate::ePrecision_day:
        SetDay   (time.Day());
        SetMonth (time.Month());
        SetYear  (time.Year());
        break;
    default:
        break;
    }
}
Пример #4
0
//################################################################################################################################
//--------------------------------------------------------------------------------------------------------------------------------
//函数名称:CLevel21_Sure()
//--------------------------------------------------------------------------------------------------------------------------------
//函数功能:确认键的第二层第一个任务
//--------------------------------------------------------------------------------------------------------------------------------
//输入参数:	tmp为第几个按键的值
//--------------------------------------------------------------------------------------------------------------------------------
//输出参数:	null
//--------------------------------------------------------------------------------------------------------------------------------
//说   明:
//--------------------------------------------------------------------------------------------------------------------------------
//################################################################################################################################
void CLevel21_Sure(uint8 tmp)
{
// 	uint8 j;
	PCF8563_DATE    timeAndDate;
	switch(tmp)
	{
		case 1:
			ClearScreen(0);		
			SetLocalAddr(0,(GetSendToF(0)/100));
			SetLocalAddr(1,(GetSendToF(0)%100/10));
			SetLocalAddr(2,(GetSendToF(0)%10));
			SetLocalDepSum(GetSendToF(1));
			if((100*GetLocalAddr(0)+10*GetLocalAddr(1)+GetLocalAddr(2))>CIRCOUNT)
			{
				SetLocalAddr(0,0);
				SetLocalAddr(1,0);
				SetLocalAddr(2,0);
			}
		if(GetLocalDepSum()>DEPART)
			SetLocalDepSum(0);
			Local_Menu(GetLocalAddr(0),GetLocalAddr(1),GetLocalAddr(2),GetLocalDepSum(),1,0);
			break;
		case 2:
			ClearScreen(0);
// 			SetCompRegDep(SSP1_Read_1Byte(2));
// 			SetCompRegAddr(SSP1_Read_1Byte(13));
// 			GetRegNum(GetCompRegDep());
			if(GetCompRegDep()>DEPART)
				SetCompRegDep(0);
			if(GetCompRegNum()>DEPARTCOM)
				SetCompRegDep(0);
			if(GetCompRegAddr()>CIRADDRESS)
				SetCompRegAddr(0);
			CompReg_menu(GetCompRegDep(),GetCompRegNum(),0,GetCompRegAddr(),1,0);
// 			CompReg_menu(GetCompRegDep(),GetCompRegNum(),0,GetCompRegDep(),1,0);
			SetComRegFlag(1);
			NVIC_DisableIRQ(EINT3_IRQn); 
			break;
		case 3:
			ClearScreen(0);
			CompSet_Menu(GetCompSetDep(),GetCompSetNum(),GetComSetSelSet(),1,0);
			break;
		case 4:
			PCF8563_Read(&timeAndDate);    
			SetYear(timeAndDate.year);
			SetMonth(timeAndDate.month);
			SetDay(timeAndDate.day);
			SetHour(timeAndDate.hour);
			SetMintue(timeAndDate.minute);
			SetSecond(timeAndDate.second);
			ClearScreen(0);
			DateMod_Menu(GetYear(),GetMonth(),GetDay(),GetHour(),GetMintue(),GetSecond(),1,0);
			break;
// 		case 5:
// 			ClearScreen(0);
// 			Annotate_Menu(GetAnnDep(),GetAnnCompNum(),1);
// 			SetAnnUartFlag(1);
// 			break;
		case 5:
			ClearScreen(0);
			Waiting_menu();
			EndInt(); 
			SendDataToFlash();
			CSendPSNToFlash();
			SaveMaskPSN();
			CSaveAnn();
			StartInt();		
			ClearScreen(0);		
			CSaveInfo();
			break;
// 		case 7:
// 			
// 			break;
		default:break;
	}
}
Пример #5
0
// This runs once during program startup
void Controller::setup()
{
	// Setup code here
    LGSerial::init();
    LGSerial::put("Hello World!");

	DDRC |= 1 << DDC2;//trigger
	DDRC |= 1 << DDC3;//pc3 pin 26 for output
	DDRC |= 1 << DDC4;
	DDRC |= 1 << DDC5;
	DDRD |= 1 << DDD0;

	PORTD &= ~(1 << PD0);
	PORTC &= ~(1 << PC2);
	PORTC &= ~(1 << PC3);
	_delay_ms(500);

	ClockInit();


	SetSecond(1);
	SetMinute(33);
	SetHour(8);
	SetAmPm(1);///0 for AM, 1 for PM
	SetDay(3);
	SetDate(23);
	SetMonth(4);
	SetYear(13);

	char Time[12];	//hh:mm:ss AM/PM

	while(0)
	{
		//Get the Current Time as a String
		if(!GetTimeString(Time))//modifies time
		{
			/*
			 If return value is false then some error has occured

			 Check
			 ->DS1307 Installed Properly
			 ->DIP Switch 1,2 are in on position
			 */
			while(1);//halt
		}
		_delay_ms(500);
	}

	uint8_t second = GetSecond();
	uint8_t minute = GetMinute();
	uint8_t hour = GetHour();
	uint8_t AmPm = GetAmPm();
	uint8_t day = GetDate();
	uint8_t date = GetDate();
	uint8_t month = GetMonth();
	uint8_t year = GetYear();


	LGSerial::print(second);
	LGSerial::print(minute);
	LGSerial::print(hour);
	LGSerial::print(AmPm);
	LGSerial::print(day);
	LGSerial::print(date);
	LGSerial::print(month);
	LGSerial::print(year);

	_delay_ms(20000);
	second = GetSecond();
	minute = GetMinute();
	LGSerial::print(second);
	LGSerial::print(minute);

	_delay_ms(20000);
	second = GetSecond();
	minute = GetMinute();
	LGSerial::print(second);
	LGSerial::print(minute);



	//uint8_t minute = GetMinute();
//uint8_t minute = 0xAA;
//	bool min[8];
/*
	min[0] = minute & 0x01;
	min[1] = minute & 0x02;
	min[2] = minute & 0x04;
	min[3] = minute & 0x08;
	min[4] = minute & 0x10;
	min[5] = minute & 0x20;
	min[6] = minute & 0x40;
	min[7] = minute & 0x80;
*/

	/*
	 min[0] = 0;
	 min[1] = 1;
	 min[2] = 0;
	 min[3] = 1;
	 min[4] = 0;
	 min[5] = 1;
	 min[6] = 0;
	 min[7] = 1;
	 */

	/*

	int i = 0;

	while(1){
		//make pc2 trigger
		PORTC |= 1 << PC2;
		PORTC &= ~(1 << PC2);

		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);
		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);
		PORTC |= 1 << PC3;
		PORTC &= ~(1 << PC3);

		for (i=0;i<8;i++){
			if (min[i] == 1){	//if that bit of min is 1
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);

				PORTC &= ~(1 << PC3);
				PORTC |= 1 << PC3;
				PORTC &= ~(1 << PC3);


			}
			else {//if (min[i] == 0){	//if that bit of min is 0
				PORTD |= 1 << PD0;
				PORTD &= ~(1 << PD0);

				PORTC |= 1 << PC3;
				PORTC &= ~(1 << PC3);
				PORTC |= 1 << PC3;

			}
		}

	}
	*/
}
Пример #6
0
void CDate::SetDate(int year, int month, int day)
{
	SetYear(year);
	SetMonth(month);
	SetDay(day);
}
Пример #7
0
CDate::CDate(int year, int month, int day) : m_year(1988), m_month(1), m_day(15)
{
	SetYear(year);
	SetMonth(month);
	SetDay(day);
}
Пример #8
0
void cDate::Set(uint8_t month, uint8_t day, uint16_t year)
{
	SetDay(day);
	SetMonth(month);
	SetYear(year);
}