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

📄 rtlclk.c

📁 c8051f020 实时时钟模块程序 内含IIC模块程序/********************** SYSTEM CLOCK 8M********************************/
💻 C
字号:
#include "c8051f020.h"
#include "RTLCLK.H"
#include "iic.h"

void Current_Time ( )
{
		unsigned char temp1=0,temp2=0;

		SmbRec(0xA2,0x00, 16, currenttime);    // read pcf8563 
		
		
			temp1=currenttime[7]&0x10;			// convert data format
			temp2=currenttime[7]&0x0f;
			currenttime[7]=temp1+temp2;
		
			currenttime[6]=currenttime[6]&0x07;
			
			temp1=currenttime[5]&0x30;
			temp2=currenttime[5]&0x0f;
			currenttime[5]=10*(temp1>>4)+temp2;

		
			temp1=currenttime[4]&0x30;
			temp2=currenttime[4]&0x0f;
			currenttime[4]=10*(temp1>>4)+temp2;
			
			temp1=currenttime[3]&0x70;
			temp2=currenttime[3]&0x0f;
			currenttime[3]=10*(temp1>>4)+temp2;
			
			temp1=currenttime[2]&0x70;
			temp2=currenttime[2]&0x0f;
			currenttime[2]=10*(temp1>>4)+temp2;
			
}

void Set_Time ( )
{
	
	SmbSend(0xa2,0x00,16, settime );
}
  
/*
main(){
		    
			IIC_Config(); 
			Set_Time();
			Current_Time ();
          
			 while(1);
			
		

}*/

⌨️ 快捷键说明

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