找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 5537|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

不知道問題出在哪里, 向高手請(qǐng)教

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:17382 發(fā)表于 2009-9-19 23:54 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式

由于剛學(xué)C語(yǔ)言編程,沒學(xué)匯編,對(duì)硬件不是太了解。這是用1302編時(shí)鐘程序;用Proteus仿真。我不知道問題出在哪里??向高手請(qǐng)教;
郁悶不知道怎么插入圖片。
void main()    
{
 init();  //初始化
 displayda();   //初始化 顯示;
// testdate();
 while(1)
 {
  displayda1();    //液晶顯示;
   keyTimeSet();   //鍵盤掃描;
  a=read_2401add(1);     //  加這句就出錯(cuò),液晶顯示不能做到一秒走一步;??????去掉正常;
                                     //讀出2401地址碼1的數(shù)據(jù);
   k2=!k2;        //正常;P1^0口;
 }
}
uchar read_2401add(uchar address)//測(cè)試過讀取正常;
{
 uchar date2401;
 start();
 write_byte(0xa0);
 respons();
 write_byte(address);
 respons();
 start();
 write_byte(0xa1);
 respons();
 date2401=read_byte();
 stop(); 
 return date2401; 
}

void  displayda1()    液晶顯示;

{
  second = read1302(0x80);
  timestring[6] = (second&0xf0)>>4;
  timestring[7] = second&0x0f;
  lcddisplay_com(0x80+0x4b);  
  lcddisplay_date(timestring[6]+0x30);
  lcddisplay_date(timestring[7]+0x30);
   if(second==0)
   {
    minute = read1302(0x82);
     timestring[3] = (minute&0xf0)>>4;
     timestring[4] = minute&0x0f;
    lcddisplay_com(0x80+0x48);
   lcddisplay_date(timestring[3]+0x30);
   lcddisplay_date(timestring[4]+0x30);
  if(minute==0)
    {
     hour  = read1302(0x84);
         timestring[0] = (hour&0xf0)>>4;
      timestring[1] = hour&0x0f;
     lcddisplay_com(0x80+0x45);
    lcddisplay_date(timestring[0]+0x30);
    lcddisplay_date(timestring[1]+0x30);
   if(hour==0)
     {
          day  = read1302(0x86);
    week = read1302(0x8a);
    datestring[6] = (day&0xf0)>>4;
     datestring[7] = day&0x0f;
    lcddisplay_com(0x80+0x0a);
    lcddisplay_date(datestring[6]+0x30);
     lcddisplay_date(datestring[7]+0x30);
    lcddisplay_com(0x80+0x09+0x04);
    week=week&0x07;
    displayweek(week);
    if(day==1)
       {
         month  = read1302(0x88);
      datestring[3] = (month&0xf0)>>4;
        datestring[4] = month&0x0f;
      lcddisplay_com(0x80+0x07);
      lcddisplay_date(datestring[3]+0x30);
      lcddisplay_date(datestring[4]+0x30);
      if(month==1)
       {
        year  = read1302(0x8c);
        datestring[0] = (year&0xf0)>>4;
          datestring[1] = year&0x0f;
        lcddisplay_com(0x80+0x04);
        lcddisplay_date(datestring[0]+0x30);
        lcddisplay_date(datestring[1]+0x30);
       }
       }
     }
    }
   }
}


 

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表