コード例 #1
0
ファイル: main.c プロジェクト: S-Kyousuke/Project-4B
void LED_Update() {  
    if (RTCC_GetTime().hr > 0x18 || RTCC_GetTime().hr < 0x06) {        
        RELAY_LED = TURN_ON_LED;
    }
    else {
         //RELAY_LED = (ADC_GetLdrVolt() <= LDR_ACTIVE_VOLTAGE)? TURN_OFF_LED : TURN_ON_LED; 
    }
}
コード例 #2
0
ファイル: rtcc.c プロジェクト: Carowick122221/PinguinoIDE
void RTCC_SetCalibration(int cal)
{
	rtccTime t0;

	if (cal < -512)	cal = -512;
	if (cal >  511)	cal =  511;
	if (RTCCON & 0x8000)					// if RTCC is ON
	{
		t0 = RTCC_GetTime();
		if ((t0.seconds & 0xFF) == 00)			// we're at second 00, wait auto-adjust to be performed
			while(!(RTCCON & 0x2));			// wait until second half...
	}
	RTCC_SetWriteEnable();
	RTCCONCLR = 0x03FF0000;					// clear the calibration
	RTCCONbits.CAL = cal;
	RTCC_SetWriteDisable();
}