Пример #1
0
void init_cc(void) {
	unsigned char Cnt;
	unsigned char Buffer[64];
	InitRTCC();								//Initialize MCP79410,Produce 1Hz square wave on MFP
		Rtcctimedate.Day = 6;					//Write Monday as a day to RTCC
		Rtcctimedate.Date = 0x31;				//Write Date as 1 to RTCC
		Rtcctimedate.Month = 0x12;				//Write 0x11 as month to RTCC
		Rtcctimedate.Year = 0x11;				//Write 0x11 as year to RTCC
		Rtcctimedate.Hour =0x23;				//Write 0x23 as hour to RTCC
		Rtcctimedate.Min = 0x59;				//Write 0x59 as minute to RTCC
		Rtcctimedate.Sec = 0x59;				//Write 0x59 as second to RTCC

		WriteRTCCTimeDate(&Rtcctimedate);		//Update RTCC with new time stamp stored in Rtcctimedate

		for(Cnt = 0; Cnt < 64; Cnt++)
		{
			Buffer[Cnt] = Cnt;
		}
		WriteSRAMBlock(&Buffer[0]);				//Write SRAM with values stored in Buffer variable
		__no_operation();
		__no_operation();
		__no_operation();
		for(Cnt = 0; Cnt < 64; Cnt++)
		{
			Buffer[Cnt] = 0;					//Clear Buffer
		}
		__no_operation();
		__no_operation();
		__no_operation();
		ReadSRAMBlock(&Buffer[0]);				//Read SRAM in Buffer
}
Пример #2
0
int main(void)
{
  uint16_t i;
  FRESULT rc;

  map_io();
  init_port();

  InitRTCC();

  uart2_init();
  xdev_out(uart2_put);
  xdev_in(uart2_get);

  dbg_printf("$" PROJECT_NAME "\n");
  dbg_printf("$" __DATE__ " " __TIME__ "\n");

  rc = f_mount(&fatfs, "", 1);
  dbg_printf("$FF,f_mount,%s\n", get_rc(rc));

  OpenTimer1(T1_PS_1_256 & T1_GATE_OFF & T1_SOURCE_INT & T1_IDLE_CON &
    T1_ON & T1_SYNC_EXT_OFF, 0xFFFF);
  ConfigIntTimer1(T1_INT_ON & T1_INT_PRIOR_1);
  OpenCapture1(IC_IDLE_STOP & IC_TIMER1_SRC & IC_INT_1CAPTURE & IC_EVERY_RISE_EDGE,
    IC_CASCADE_DISABLE & IC_TRIGGER_ENABLE & IC_UNTRIGGER_TIMER & IC_SYNC_TRIG_IN_DISABLE);
  ConfigIntCapture1(IC_INT_ON & IC_INT_PRIOR_5);
  _IC1IF = 0;
  

  while (1) {
    while (_RTCSYNC == 0);
    while (_RTCSYNC == 1);
    if (gps_pr > 0) {
      _T1IE = 0;
      float f = (float) TMR1 / gps_pr;
      _T1IE = 1;
      xprintf("%u\n", (uint16_t) (f * 1000));
    }
    if (ngpslines > 0) {
      ngpslines--;
      if (xgets(gps_line, 128)) {
        xprintf("$GPS%s\n", gps_line);
      }
    }
  }

  while (0) {
    while (_RTCSYNC == 0);
    while (_RTCSYNC == 1);
    if (gps_pr > 0) {
      _T1IE = 0;
      float f = (float) TMR1 / gps_pr;
      _T1IE = 1;
      xprintf("%u\n", (uint16_t) (f * 1000));
    }
  }

  return (EXIT_SUCCESS);
}
Пример #3
0
void main(void)
{


//	InitI2C();
//	d = READ_I2C(0x6F,0x10);
//	WRITE_I2C(0x6F, 0x10, 0xFF);
//	d = READ_I2C(0x6F,0x10);
//	data[0] = 1;
//	data[1] = 2;
//	data[2] = 3;
//	data[3] = 4;
//	data[4] = 5;
//	WriteI2CMultipleByte(0x6F,0x00,5,data);
//	ReadI2CMultipleByte(0x6F,0x00,5,data);
//	__no_operation();
//	while(1);


	unsigned char Cnt;
	unsigned char Buffer[64];
	InitRTCC();								//Initialize MCP79410,Produce 1Hz square wave on MFP
	Rtcctimedate.Day = 6;					//Write Monday as a day to RTCC
	Rtcctimedate.Date = 0x31;				//Write Date as 1 to RTCC
	Rtcctimedate.Month = 0x12;				//Write 0x11 as month to RTCC
	Rtcctimedate.Year = 0x11;				//Write 0x11 as year to RTCC
	Rtcctimedate.Hour =0x23;				//Write 0x23 as hour to RTCC
	Rtcctimedate.Min = 0x59;				//Write 0x59 as minute to RTCC
	Rtcctimedate.Sec = 0x59;				//Write 0x59 as second to RTCC

	WriteRTCCTimeDate(&Rtcctimedate);		//Update RTCC with new time stamp stored in Rtcctimedate

	for(Cnt = 0; Cnt < 64; Cnt++)
	{
		Buffer[Cnt] = Cnt;
	}
	WriteSRAMBlock(&Buffer[0]);				//Write SRAM with values stored in Buffer variable
	__no_operation();
	__no_operation();
	__no_operation();
	for(Cnt = 0; Cnt < 64; Cnt++)
	{
		Buffer[Cnt] = 0;					//Clear Buffer
	}
	__no_operation();
	__no_operation();
	__no_operation();
	ReadSRAMBlock(&Buffer[0]);				//Read SRAM in Buffer
	while(1)
	{
		__no_operation();
		__no_operation();
		__no_operation();
		ReadRTCCTimeDate(&Rtcctimedate);

	}//while
}