C8051F330 16*16点阵(SPI 、SMBus、I2C)PCF8563

发布者:水墨人生最新更新时间:2015-06-15 来源: 51hei关键字:C8051F330  16*16点阵  PCF8563 手机看文章 扫描二维码
随时随地手机看文章




#include   
#include            
#include              
#include
#include

#define SPEED 2000
#define TIME 1800
#define uint unsigned int
#define uchar unsigned char


#define BLKN 2   //用于点阵列扫描的595的个数
#define TOTAL 26  //待显示的字数
#define CONIO P1

uchar number;//d=0,
uchar control=0,choose,send;
uchar receive_number=3,send_number=0;

bit BUSY;
bit SMB_RW;

uchar hou=0;
uchar min=0;
uchar sec=0;

uchar sg;//时高位
uchar sd;//时低位

uchar fg;//分高位
uchar fd;//分低位

uchar mg;//秒高位
uchar md;//秒低位

sbit CLK=P1^7;  //输出脉冲
sbit scyx=P1^6;  //复位
sbit led=P0^7;
sbit pcf8563_scl=P0^5;//时钟频率
sbit pcf8563_sda=P0^4;//串行数据传输


uchar idata dispram[(BLKN/2)*32]={0};

uchar receive1[3]={0x00,0x00,0x00};//时、分、秒
uchar send1[4]={0x02,0x33,0x25,0x03};//时、分、秒、器件地址
/*********************************字模表***************************************/
uchar code Bmp[][32]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF0,0x1C,0x18,0x38,0x1C,0x38,0x0E,0x38,0x0E,
0x78,0x0E,0x38,0x0E,0x38,0x0E,0x38,0x1C,0x1C,0x18,0x07,0xF0,0x00,0x00,0x00,0x00},
/***数字0***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x0F,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,
0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x01,0xC0,0x0F,0xFC,0x00,0x00,0x00,0x00},
/***数字1***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x18,0x1C,0x38,0x1C,0x18,0x1C,0x00,0x38,
0x00,0x70,0x01,0xC0,0x07,0x00,0x0C,0x06,0x3F,0xFC,0x3F,0xFC,0x00,0x00,0x00,0x00},
/***数字2***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x38,0x38,0x38,0x1C,0x00,0x38,0x03,0xF0,
0x03,0xF0,0x00,0x1C,0x00,0x0E,0x38,0x1C,0x38,0x1C,0x0F,0xF0,0x00,0x00,0x00,0x00},
/***数字3***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0xF0,0x01,0xF0,0x03,0x70,0x0C,0x70,
0x18,0x70,0x30,0x70,0x3F,0xFE,0x00,0x70,0x00,0x70,0x03,0xFE,0x00,0x00,0x00,0x00},
/***数字4***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFC,0x18,0x00,0x18,0x00,0x18,0xC0,0x1F,0xF8,
0x18,0x1C,0x00,0x1E,0x10,0x0E,0x38,0x1C,0x38,0x18,0x0F,0xF0,0x00,0x00,0x00,0x00},
/***数字5***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x0C,0x3C,0x18,0x08,0x38,0x00,0x3F,0xF8,
0x7C,0x1C,0x78,0x0E,0x38,0x0E,0x38,0x0E,0x1C,0x1C,0x07,0xF0,0x00,0x00,0x00,0x00},
/***数字6***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFE,0x3C,0x0C,0x30,0x18,0x00,0x30,0x00,0x60,
0x00,0xC0,0x01,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x00,0x00,0x00,0x00},
/***数字7***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF8,0x38,0x0C,0x30,0x0E,0x3C,0x0C,0x1F,0xF8,
0x0F,0xF0,0x38,0x3C,0x30,0x0E,0x70,0x0E,0x38,0x0C,0x0F,0xF0,0x00,0x00,0x00,0x00},
/***数字8***/
{0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x38,0x18,0x30,0x0C,0x70,0x0E,0x30,0x0E,
0x38,0x3E,0x1F,0xEE,0x00,0x1C,0x18,0x18,0x3C,0x30,0x1F,0xE0,0x00,0x00,0x00,0x00},
/***数字9***/

{0x00,0x40,0x40,0x40,0x30,0x40,0x10,0x40,0x00,0x48,0x00,0x7C,0xF0,0x40,0x10,0x40,
0x10,0x40,0x10,0x40,0x10,0x40,0x12,0x40,0x14,0x40,0x18,0x44,0x17,0xFE,0x00,0x00},//让

{0x00,0x08,0x3F,0xFC,0x21,0x08,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,
0x21,0x08,0x3F,0xF8,0x20,0x08,0x02,0x00,0x51,0x88,0x50,0x96,0x90,0x12,0x0F,0xF0},//思

{0x10,0x80,0x10,0xA0,0x20,0x94,0x21,0xFE,0x49,0x10,0xFB,0x10,0x15,0xFC,0x21,0x10,
0x41,0x10,0xFD,0xFC,0x01,0x10,0x01,0x10,0x1D,0x14,0xE1,0xFE,0x41,0x00,0x01,0x00},//维

{0x01,0x20,0x41,0x24,0x2F,0xFE,0x21,0x24,0x01,0x24,0x8F,0xFC,0x49,0x24,0x09,0x20,
0x1F,0xFE,0x29,0x22,0xE1,0x22,0x21,0x2A,0x22,0x24,0x22,0x20,0x24,0x20,0x28,0x20},//沸

{0x00,0x40,0x7A,0x48,0x49,0x50,0x4B,0xFC,0x48,0x80,0x7F,0xFE,0x49,0x10,0x4A,0x0E,
0x4D,0xF4,0x78,0x10,0x49,0x14,0x49,0xFE,0x48,0x04,0x4F,0xE4,0x88,0x14,0x18,0x08},//腾

{0x08,0x00,0x08,0x08,0x08,0xFC,0x7E,0x08,0x08,0x08,0x08,0x08,0xFE,0xF8,0x08,0x88,
0x28,0x80,0x2E,0x84,0x28,0x84,0x28,0x7C,0x28,0x00,0x58,0x06,0x8F,0xFC,0x00,0x00},//起

{0x01,0x00,0x01,0x00,0x01,0x08,0x7F,0xFC,0x01,0x00,0x21,0x10,0x19,0x30,0x09,0x44,
0xFF,0xFE,0x03,0x80,0x05,0x40,0x09,0x30,0x31,0x1E,0xC1,0x04,0x01,0x00,0x01,0x00},//来

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x0C,0x00,0x1E,0x00,0x1E,0x00,0x0C,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x00,0x00},//,

{0x00,0x40,0x40,0x40,0x30,0x40,0x10,0x40,0x00,0x48,0x00,0x7C,0xF0,0x40,0x10,0x40,
0x10,0x40,0x10,0x40,0x10,0x40,0x12,0x40,0x14,0x40,0x18,0x44,0x17,0xFE,0x00,0x00},//让

{0x20,0x00,0x22,0x04,0x3F,0x7E,0x48,0x44,0x08,0x44,0xFF,0xC4,0x10,0x44,0x14,0x7C,
0x22,0x44,0x42,0x10,0x9F,0xF8,0x10,0x10,0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10},//智

{0x08,0x20,0x7E,0xFC,0x08,0x20,0x3E,0xF8,0x08,0x20,0x7E,0xFC,0x08,0x20,0x3F,0xF8,
0x00,0x08,0xFF,0xFE,0x00,0x08,0x3F,0xF8,0x09,0x00,0x28,0xA8,0x48,0x24,0x07,0xE0},//慧

{0x08,0x08,0x0B,0xFC,0x10,0x00,0x20,0x00,0x40,0x00,0x08,0x04,0x17,0xFE,0x30,0x10,
0x50,0x10,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x10,0x20},//行

{0x00,0x40,0x08,0x40,0x7C,0x40,0x00,0x44,0x05,0xFE,0xFE,0x44,0x10,0x44,0x10,0x44,
0x20,0x44,0x24,0x44,0x42,0x84,0xFE,0x84,0x41,0x04,0x01,0x04,0x02,0x28,0x04,0x10},//动

{0x08,0x00,0x08,0x08,0x08,0xFC,0x7E,0x08,0x08,0x08,0x08,0x08,0xFE,0xF8,0x08,0x88,
0x28,0x80,0x2E,0x84,0x28,0x84,0x28,0x7C,0x28,0x00,0x58,0x06,0x8F,0xFC,0x00,0x00},//起

{0x01,0x00,0x01,0x00,0x01,0x08,0x7F,0xFC,0x01,0x00,0x21,0x10,0x19,0x30,0x09,0x44,
0xFF,0xFE,0x03,0x80,0x05,0x40,0x09,0x30,0x31,0x1E,0xC1,0x04,0x01,0x00,0x01,0x00},//来

{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x3C,0x00,0x66,0x00,0x66,0x00,0x66,0x00,0x3C,0x00,0x00,0x00},//.};

uchar code Bmp1[][32]={
{0x01,0x00,0x11,0x00,0x11,0x00,0x11,0x08,0x3F,0xFC,0x21,0x00,0x41,0x00,0x41,0x00,
0x81,0x10,0x3F,0xF8,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0xFF,0xFE,0x00,0x00},

{0x00,0x10,0x1F,0xF8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0xF0,0x10,0x10,0x00,0x00},

{0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x88,0x5B,0xFC,0x54,0x88,0x50,0x88,0x90,0x88,
0x10,0x88,0x1F,0xFE,0x10,0x80,0x11,0x40,0x11,0x20,0x12,0x10,0x14,0x0E,0x18,0x04},

{0x00,0x20,0x00,0xF0,0x1F,0x00,0x10,0x00,0x11,0x00,0x11,0x00,0x21,0x04,0x7F,0xFE,
0x01,0x00,0x01,0x00,0x09,0x20,0x09,0x10,0x11,0x08,0x21,0x0C,0x45,0x04,0x02,0x00},

{0x00,0x00,0x38,0x1C,0x44,0x22,0x54,0x2A,0x44,0x22,0x37,0xEC,0x08,0x10,0x10,0x08,
0x2E,0x74,0x20,0x04,0x21,0x84,0x24,0x24,0x13,0xC8,0x08,0x10,0x07,0xE0,0x00,0x00}
};
/*********************************字模表***************************************/

 


/************系统函数的配置***********/
void sysclk_int(void)    //内部晶振
{
   OSCICL=0x83;
   OSCICN=0xc3; //不分频
   CLKSEL=0x00; 
}

/*
void delay1(uchar n)  //延时程序
{
 uchar j;
    for(j=0;j   {
  _nop_();
  _nop_();
  _nop_();
  _nop_();
   }
}
*/

void delay(uint i) //毫秒延时
{
 register uchar j;//
for(;i;i--)
 for(j=0;j<255;j++);
}

[page]

void SPI_INT(void)  //SPI初始化
  {
 SPI0CFG=0x40;
 SPI0CN=0x01; //0000 0001最后一位是SPI使能位 SPI工作在三线主方式
 SPI0CKR=0x0f; //SPI 时钟频率设置为100kHz 0x63

 IE &= 0xbf;  //关闭SPI中断
  }

void SMB_INT(void)  //SMB初始化
  {
 SMB0CF=0x5f; //使能SMB 允许时间扩充 定时器2低字节溢出时钟源

 SMB0CF|=0x80;
  }


void TIME01_INT(void)  //定时器初始化
{
 TCON=0x10;   //定时器0允许
 TMOD=0x01;   //定时器0在16位工作方式
 CKCON &= 0xf8;
 CKCON |= 0x01;  //定时器0使用系统4分频

 TL0=0x03;   
 TH0=0x03;  

 IE|=0x02;
}


void TIME2_INT(void)  //定时器2用于配置SMB的时钟频率
{
 TMR2CN=0x00;
 CKCON |= 0x00;

 TMR2RLL = 0xef;
 TMR2RLH = 0xff;
 TMR2L = 0xef;
 TMR2H = 0xff;

 TMR2CN |= 0x0c;
}

void TIME3_INT(void)//用于I2C的超时检测
{
 TMR3CN = 0x00;  //定时器3为16位自动重载
 CKCON &= ~0x40;

 TMR3RLL = 0xaf;
 TMR3RLH = 0x57;
 TMR3L = 0xaf;
 TMR3H = 0x57;
 
 EIE1|=0x00;
 TMR3CN |= 0x04;
}

void pio_int(void)     // 端口配置
{
 XBR0=0x06;
 XBR1=0x40;

 P0MDIN=0xff;    //禁止模拟输入,0为模拟,1为数字
 P0MDOUT=0x0d;   //0为开漏,1为推挽(ff)
 P0SKIP=0x08; 
  
 P1MDIN=0xff; 
 P1MDOUT=0xff; //低四位用于138
 P1SKIP=0x00;

 P0=0xff;
 P1=0xff;

}


/*************呈现各种显示效果的函数集****************/
//void Jump_Word(uchar a) 立即跳显示一个字或一张图案
//void M_Word(uchar a)     卷帘出显示一个字或一张图案
//void M_Words(number)     显示几个交换的字
//void UP_Run(number)     向上滚屏n个字
//void L_Removeout(number) 右入左出n个字
//void M_Black(void)  黑屏
//void R_Removeout(number) 左入右出n个字
/*****************************************************/

/****************立即跳显示一个字或一张图案***************/
void Jump_Word(uchar a)
{register uchar i,q;
for(i=0;i<32;i++)
 {
 for(q=0;q   {dispram[i+q*32]=Bmp[a][i];}
  //if(i%2)delay(SPEED);
 }
}
/****************卷帘出显示一个字或一张图案***************/
void M_Word(uchar a)
{register uchar i,q;
for(i=0;i<32;i++)
 {
 for(q=0;q   {dispram[i+q*32]=Bmp1[a][i];}
  if(i%2)delay(SPEED);
 }
}

/****************卷帘出显示number个字***************/
void M_Words(number) 
{register uchar i,q,w;
for(w=0;w  {
 for(i=0;i<32;i++)
  {
  for(q=0;q    if(i%2)delay(SPEED);
  }
 delay(TIME);
 }
}

/****************向上滚屏number个字***************/
void UP_Run(number)
{register uchar i,j,k,q;
for(i=0;i  {
 for(j=0;j<16;j++)
  {
  for(k=0;k<15;k++)
   {
   for(q=0;q     {
    dispram[k*2+q*32]=dispram[(k+1)*2+q*32];
    dispram[k*2+1+q*32]=dispram[(k+1)*2+1+q*32];
    }
   }
  for(q=0;q    {
   dispram[30+q*32]=Bmp[q+i*BLKN/2][j*2];
   dispram[31+q*32]=Bmp[q+i*BLKN/2][j*2+1];
   }
  delay(2*SPEED);
  }
 delay(2*TIME);
 }
}

/****************左移出显示number个字*******************/
void L_Removeout(number)
{register uchar i,j,k,l,q;
for(i=0;i  {
 for(j=0;j<2;j++)
  for(k=0;k<8;k++)
   {
   for(l=0;l<16;l++)
    {
    for(q=0;q      {
     dispram[l*2+q*32]=dispram[l*2+q*32]<<1|dispram[l*2+1+q*32]>>7;
     if(q==BLKN/2-1)
      dispram[l*2+1+q*32]=dispram[l*2+1+q*32]<<1|Bmp[i][l*2+j]>>(7-k);
     else
      dispram[l*2+1+q*32]=dispram[l*2+1+q*32]<<1|dispram[l*2+(q+1)*32]>>7;
     }
    }
   delay(2*SPEED);
   }
 }
}

/****************卷帘出黑屏***************/
void M_Black(void)
{register uchar i,q;
for(i=0;i<32;i++)
 {
 for(q=0;q   {dispram[i+q*32]=0x00;}
 if(i%2)delay(SPEED);
 }
}
/****************右移出显示number个字*******************/
void R_Removeout(number)
{register uchar i,j,k,l,q;
for(i=0;i  {
 for(j=2;j>0;j--)
  for(k=0;k<8;k++)
   {
   for(l=0;l<16;l++)
    {
    for(q=0;q      {
     dispram[l*2+1+q*32]=dispram[l*2+1+q*32]>>1|dispram[l*2+q*32]<<7;
     if(q==0)
      dispram[l*2+q*32]=dispram[l*2+q*32]>>1|Bmp[i][l*2+j-1]<<(7-k);
     else
      dispram[l*2+q*32]=dispram[l*2+q*32]>>1|dispram[l*2+1+(q-1)*32]<<7;
     }
    }
   delay(2*SPEED);
   }
 }
}


/*************用于时钟芯片操作的函数集****************/
//void write_pcf8563(void)写时钟芯片
//void read_pcf8563(void)读时钟芯片
/*****************************************************/
void write_pcf8563(void)

 SPI0CN &=~0x01; //暂时关掉SPI通讯

 send =0xa2;  //送子器件地址
 while(BUSY);
 BUSY=1;
 SMB_RW=0;control=5;
 STA=1;   //开始传送

 while(BUSY);
 SPI0CN |=0x01; //重新开启SPI
}

void read_pcf8563(void)   //读当时的时,分,钞
{

 SPI0CN &=~0x01;
 send =0xa2;     //送子器件地址
 while(BUSY);
 BUSY=1;
 SMB_RW=0;
 STA=1;

 send=0x02;
 while(!SI);
 BUSY=1;
 
 send=0xa2;
 while(BUSY);
 BUSY=1;
 SMB_RW=1;
 STA=1;
 
 
 while(BUSY);    
 BUSY=1;
 sec=receive1[2]&0x7f;//读秒
 min=receive1[1]&0x7f;//读分
 hou=receive1[0]&0x3f;//读时
 
 SPI0CN |=0x01;
}

void spit_time(void)//分别计算时、分、秒的各位数字
{
 sg=(int)hou/16;
 sd=(int)hou%16;

 fg=(int)min/16;
 fd=(int)min%16;

 mg=(int)sec/16;
 md=(int)sec%16;
}

void dat_int(void) //数据初始化
{
 scyx=1;
 CLK=0;
}

 

void sysclk_int(void);
void delay(unsigned n);
void pio_int(void);
void SPI_INT(void);
void SMB_INT(void);
void dat_int(void);
void TIME01_INT(void);
void TIME2_INT(void);
void TIME3_INT(void);
void write_pcf8563(void);
void read_pcf8563(void);
void spit_time(void);

/**************主函数**************/
void main(void)   //主程序
{
 register uchar i;
 PCA0MD &= ~0x40;// 关闭看门狗
 sysclk_int();
 OSCICN |= 0x02;

/****************初始化检测pcf8563****************/
   while(!pcf8563_sda)
   {
      XBR1 = 0x40;
      pcf8563_scl = 0;
      for(i = 0; i < 255; i++);
      pcf8563_scl = 1;
      while(!pcf8563_scl);
                                     
      for(i = 0; i < 10; i++);        
     XBR1 = 0x00;                    
  }[page]
/****************初始化检测pcf8563****************/

 pio_int();
 TIME01_INT();
 TIME2_INT();
 TIME3_INT();
 SPI_INT();   //SPI0DAT是SPI的数据寄存
 SMB_INT();
 spit_time();
 EIE1|=0x01;
 EA=1;
 dat_int();
 
 led=0;

TR0=0;
delay(1000);
write_pcf8563();

while(1)
{
TR0=0;
BUSY=0;
read_pcf8563();
spit_time();
TR0=1;


//Jump_Word(sg);
//Jump_Word(sd);
//Jump_Word(fg);
//Jump_Word(fd);
//Jump_Word(md);
//M_Word(md);
M_Word(4);
delay(10*TIME);

M_Words(TOTAL);

UP_Run(TOTAL);

M_Black();
delay(10*TIME);

L_Removeout(TOTAL);
delay(3*TIME);

M_Black();
delay(10*TIME);


R_Removeout(TOTAL);
delay(3*TIME);

 

}//总while循环的结束
}//main函数的结束

 

void t0(void) interrupt 1 //定时器0的中断服务程序
{
register uchar m,n=BLKN;
TH0 = 0xfc;
TL0 = 0x18;
m = CONIO;
m = (++m)&0x0f;
for(n=0;n {
 SPI0DAT = dispram[30-m*2+n];//dispram[((BLKN-)n/2+1)*30-m*2-(n/2)*30+n]
 while(!SPIF);
 SPIF=0;
 }
CONIO &= 0xf0;
CLK = 1;
CONIO |= m;
CLK = 0;
scyx=1;

}

 

void SMBus_ISR (void) interrupt 7
{
   bit FAIL = 0;                      
 
   if (ARBLOST == 0)   //如果赢得总线
   {
      switch (SMB0CN & 0xF0)  //确定中断来源       
      {
         case 0xe0:    //主发送方式下产生开始条件
            SMB0DAT = send;       
            SMB0DAT &= 0xFE;          
            SMB0DAT |= SMB_RW;  //对发送的数据进行处理      
            STA = 0;
            break;
       

         case 0xc0:    //主方式下发送
            if (ACK)
            {
               if (SMB_RW == 0)
               {
    if(send_number<=3)
      {
     if(control==0)
       {
      SMB0DAT = send;
      send_number+=5;
       }
     else
       {
        SMB0DAT = send1[send_number];
      send_number++;
       }
      }
    else
     {
     send_number=0;control=0;
     STO = 1;
     BUSY = 0;
     }    
               }
               else {;} //BUSY=0              
            }
            else                   
            {
               STO = 1;              
               STA = 1;       
            }
            break;

        
         case 0x80:    //主方式下接收
      if (receive_number-1>0)   //控制接收3个数据就结束
               {
                  receive1[receive_number-1] = SMB0DAT;
                  ACK = 1;
     receive_number--;                  
               }
               else
               {
                 receive1[receive_number-1] = SMB0DAT;
                 receive_number=3;                                      
                 BUSY = 0;          
                 ACK = 0;               
                 STO = 1;               
               }
    break;

         default:
            FAIL = 1;               
            break;
      }
   }

   else       //输掉总线
   {
      FAIL = 1;
   }


if (FAIL)      //SMBUS通讯失败后的处理 
   {
      SMB0CF &= ~0x80;
      SMB0CF |= 0x80;
      STA = 0;
      STO = 0;
      ACK = 0;
      BUSY = 0;
      FAIL = 0;
  
   }
  
SI = 0;
}


void T3_ISR() interrupt 14 //定时器3中断服务程序 用于检测SMBus是否超时
{
 SMB0CF &= ~0x80;
 SMB0CF |= 0x80;
 TMR3CN &=~0x80;

 STA = 0;
 BUSY = 0;
 pcf8563_scl=1;
}

关键字:C8051F330  16*16点阵  PCF8563 引用地址:C8051F330 16*16点阵(SPI 、SMBus、I2C)PCF8563

上一篇:51单片机的ds18b20驱动程序
下一篇:基于89S51的实时数字温度计(DS1302 18B20)

推荐阅读最新更新时间:2024-03-16 14:03

PCF8563实时时钟/日历芯片介绍
概述 PCF8563是一款低功耗的CMOS实时时钟/日历芯片,它提供一个可编程时钟输出,一个中断输出和掉电检测器,所有的地址和数据通过I2C总线接口串行传递。最大总线速度为400Kbits/s,每次读写数据后,内嵌的字地址寄存器会自动增加。 特性 低工作电流:典型值为0.25μA(VDD=3.0V,Tamb=25 ℃时); 世纪标志; 大工作电压范围:1.0~5.5V; 低休眠电流;典型值为0.25μA (VDD=3.0V, Tamb=25 ℃); 400KHz 的I2C总线接口(VDD=1.8~5.5V 时); 可编程时钟输出频率为:32.768KHz,1024Hz,32Hz,1Hz; 报警和定时器; 掉电
[单片机]
<font color='red'>PCF8563</font>实时时钟/日历芯片介绍
基于单片机的16x64点阵LED显示屏的设计
  LED点阵显示屏是一种简单的汉字显示器,具有价廉、易于控制、使用寿命长等特点,可广泛应用于各种公共场合,如车站、码头、银行、学校、火车、公共汽车显示等。本文详细介绍了一种低廉的16x64点阵LED显示屏的设计过程。   1 硬件系统设计   本系统采用AT89C52单片机作控制器,整个电路主要由单片机控制及其接口电路、驱动显示电路、电源电路等部分组成。为了简化显示屏电路,降低成本,本系统在单片机部分不加字库存储器。而在PC机上编辑汉字和字符显示信息,并将其转换为相应的点阵显示数据,然后通过串口(采用RS-232通信标准)送给单片机存储并进行显示处理。图1所示为其硬件系统原理图。   1.1 单片机控制电路
[电源管理]
基于单片机的<font color='red'>16</font>x64<font color='red'>点阵</font>LED显示屏的设计
PIC单片机上实时时钟PCF8563测试程序
..............................PCF8563测试程序主函数............................ ............................................................................... ............................................................................... #include #include pcf8563.h #include IIC.h __CONFIG(FOSC_INTOSC&WDTE_OFF&MCLRE_OFF)
[单片机]
51单片机 16X192点阵程序动态显示汉字
程序参考源代码如下: #include AT89X52.H sbit ST=P3^5; sbit E1=P3^4; sbit MR=P3^7; char cashe ; char code wd ={undefined {0xFF,0xC0,0xFE,0xFE,0xFE,0xFE,0x80,0xFE,0xFD,0xFD,0xFB,0xF7,0xEF,0xDF,0x3F,0xFF}, {0xFF,0x03,0xFF,0xFF,0xFF,0xFF,0x01,0x7F,0x7F,0x7F,0x7F,0x7F,0x7D,0x7D,0x81,0xFF},/“无”,0/ /* (16 X 16 , 宋体 )*/ {0xDF,
[单片机]
51单片机 <font color='red'>16</font>X192<font color='red'>点阵</font>程序动态显示汉字
基于C8051F330便携式生理参数监测仪设计
随着人们生活水平的提高,越来越多的人希望通过简便的方式了解身体基本状况。因此人体生理监护仪开始出现并呈不断增多的趋势,已经由过去的单一测试仪发展为现在的多参数监护仪。 在实际生活中,生理参数监测仪多是基于PC机平台的多参数测量、价格昂贵、体积庞大、不便于移动。现在多数生理参数监测仪无法准确的实时测量人体运动时的生理参数,导致有些人特别是老年人运动强度过大,对身体造成较大伤害。而教练员因无法准确掌握运动员运动时生理参数变化,而不能“因材施教”,有针对性的制定训练方案,所以运动员训练方式都是大众化训练。综上所述,开发一种体积小、价格低,基于嵌入式系统的便携式生理参数监测仪就具有重要的意义。 1 系统方案 本系统采用C8051
[单片机]
基于<font color='red'>C8051F330</font>便携式生理参数监测仪设计
基于PCF8563的数字时钟设计
  一、概述   PCF8563是PHILIPS公司推出的一款工业级、内含I2C总线接口功能,且具有极低功耗的多功能时钟/日历芯片,还具有多种报警功能、定时器功能、时钟输出功能,以及中断输出功能等,能完成各种复杂的定时服务,甚室可为单片机提供看门狗功能。内含时钟电路、振荡电路、低电压检测电路以及两线制PC总线通讯方式。   二、硬件连接   应用PCF8563制作数字时钟可靠实用,配合其超低维持功耗(典型值为0.25uA,Vdd=3.0V,Tamb=25℃)∶只要有—维持电池就可以长时问掉电保持实时时间计时,笔者选用3.6V锂电池。利用其第③脚的中断输出触发单片机中断。当计数完60次后去读取PCF8563中的时间寄存器
[单片机]
小广播
添点儿料...
无论热点新闻、行业分析、技术干货……
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件
随便看看
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved