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

📄 main.c

📁 at91sam9263 for rtc,其中rtc是npx公司的pcf8563
💻 C
字号:
//*----------------------------------------------------------------------------
//*         ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : main.c
//* Object              : main application written in C
//* Creation            : ODi   06/26/2002
//*
//*----------------------------------------------------------------------------


#include "bsp.h"

int main(void)
{
	struct rtc_time t;
	int i;
	
	AT91F_TWI_Init();
	
	t.tm_year = 2009;
	t.tm_mon =  1;
	t.tm_mday = 25;
	t.tm_wday = 20;
	t.tm_hour = 9;
	t.tm_min  = 32;
	
	RTC_Set(&t);
	
	while(1)
	{
		RTC_Get(&t);
		
		putk("Get DATE: %4d-%02d-%02d (wday=%d)  \
		          TIME: %2d:%02d:%02d\n\r",  
			  t.tm_year, 
			  t.tm_mon, 
			  t.tm_mday, 
			  t.tm_wday,
			  t.tm_hour, 
			  t.tm_min, 
			  t.tm_sec);
		
		
		for(i=0; i<200000; i++);
	}
}

⌨️ 快捷键说明

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