找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

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

單片機自動打鈴系統(tǒng)程序 keil報錯

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:893765 發(fā)表于 2021-3-26 08:36 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
之前被大佬們臭罵一頓的缺東西都補上了 但又出現(xiàn)了新的句法問題 因為舊帖沒有人下載新代碼就再發(fā)一遍了
再次感謝大佬們的教誨

新打鈴.rar

3.96 KB, 下載次數(shù): 19

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

使用道具 舉報

沙發(fā)
ID:328014 發(fā)表于 2021-3-26 15:12 | 只看該作者
最好是截個圖或者直接貼程序,大家好多人都是用手機打開的論壇,無法看附件
回復(fù)

使用道具 舉報

板凳
ID:893765 發(fā)表于 2021-3-27 11:53 | 只看該作者
#include<reg51.h>
#include<absacc.h>
#define uchar unsigned char
#define uint unsigned int
sbit LCD_RST=P1^0;
sbit DI=P1^5;
sbit RW=P1^4;
sbit CS1=P1^2;
sbit CS2=P1^1;
sbit EN=P1^3;
sbit RDY=P0^7;
sfr LCD=0x80;
#define LCD_DISPON 0x3f
#define LCD_STARTROW 0xc0
#define LCD_ADDRSTRY 0xb8
#define LCD_ADDRSTRX 0x40
#define CS1 0
#define CS2        1
void LCD_WrCmd(bit port,uchar cmd)
{  EN=0;
   if(port)
       { CS2=1;
         CS1=0;
       }
   else
       {CS2=0;
        CS1=1;
       }
   DI=0;
   RW=0;
   EN=1;
   LCD=cmd;
   EN=0;
}

void LCD_WrDat(bit port,uchar wrdata)
{  EN=0;
   if(port)
       { CS2=1;
         CS1=0;
       }
   else
       {CS2=0;
        CS1=1;
       }
   DI=1;
   RW=0;
   EN=1;
   LCD=wrdata;
   EN=0;
}

uchar code  ASCII_TAB[480] =
    { 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x9e, 0x00, 0x00,
    0x00, 0x0e, 0x00, 0x0e, 0x00,
    0x28, 0xfe, 0x28, 0xfe, 0x28,
    0x48, 0x54, 0xfe, 0x54, 0x24,
    0x46, 0x26, 0x10, 0xc8, 0xc4,
    0x6c, 0x92, 0xaa, 0x44, 0xa0,
    0x00, 0x0a, 0x06, 0x00, 0x00,
    0x00, 0x38, 0x44, 0x82, 0x00,
    0x00, 0x82, 0x44, 0x38, 0x00,
    0x28, 0x10, 0x7c, 0x10, 0x28,
    0x10, 0x10, 0x7c, 0x10, 0x10,
    0x00, 0xa0, 0x60, 0x00, 0x00,
    0x10, 0x10, 0x10, 0x10, 0x10,
    0x00, 0xc0, 0xc0, 0x00, 0x00,
    0x40, 0x20, 0x10, 0x08, 0x04,
    0x7C, 0xA2, 0x92, 0x8A, 0x7C,  
    0x84, 0xC2, 0xA2, 0x92, 0x8C,  
    0x42, 0x82, 0x8A, 0x96, 0x62,  
    0x30, 0x28, 0x24, 0xFE, 0x20,
    0x4E, 0x8A, 0x8A, 0x8A, 0x72,  
    0x78, 0x94, 0x92, 0x92, 0x60,   
    0x02, 0xE2, 0x12, 0x0A, 0x06,   
    0x6C, 0x92, 0x92, 0x92, 0x6C,   
    0x0C, 0x92, 0x92, 0x52, 0x3C,   
    0x00, 0x6C, 0x6C, 0x00, 0x00,  
    0x00, 0xAC, 0x6C, 0x00, 0x00,   
    0x10, 0x28, 0x44, 0x82, 0x00,   
    0x28, 0x28, 0x28, 0x28, 0x28,   
    0x00, 0x82, 0x44, 0x28, 0x10,   
    0x04, 0x02, 0xA2, 0x12, 0x0C,
    0x64, 0x92, 0xF2, 0x82, 0x7C,  
    0xFC, 0x22, 0x22, 0x22, 0xFC,   
    0xFE, 0x92, 0x92, 0x92, 0x6C,   
    0x7C, 0x82, 0x82, 0x82, 0x44,   
    0xFE, 0x82, 0x82, 0x44, 0x38,  
    0xFE, 0x92, 0x92, 0x92, 0x82,  
    0xFE, 0x12, 0x12, 0x12, 0x02,   
    0x7C, 0x82, 0x92, 0x92, 0xF4,   
    0xFE, 0x10, 0x10, 0x10, 0xFE,  
    0x00, 0x82, 0xFE, 0x82, 0x00,  
    0x40, 0x80, 0x82, 0x7E, 0x02,   
    0xFE, 0x10, 0x28, 0x44, 0x82,   
    0xFE, 0x80, 0x80, 0x80, 0x80,  
    0xFE, 0x04, 0x18, 0x04, 0xFE,   
    0xFE, 0x08, 0x10, 0x20, 0xFE,   
    0x7C, 0x82, 0x82, 0x82, 0x7C,
    0xFE, 0x12, 0x12, 0x12, 0x0C,
    0x7C, 0x82, 0xA2, 0x42, 0xBC,
    0xFE, 0x12, 0x32, 0x52, 0x8C,  
    0x8C, 0x92, 0x92, 0x92, 0x62,
    0x02, 0x02, 0xFE, 0x02, 0x02,
    0x7E, 0x80, 0x80, 0x80, 0x7E,
    0x3E, 0x40, 0x80, 0x40, 0x3E,
    0x7E, 0x80, 0x70, 0x80, 0x7E,
    0xC6, 0x28, 0x10, 0x28, 0xC6,
    0x0E, 0x10, 0xE0, 0x10, 0x0E,
    0xC2, 0xA2, 0x92, 0x8A, 0x86,
    0x00, 0xFE, 0x82, 0x82, 0x00,
    0x04, 0x08, 0x10, 0x20, 0x40,
    0x00, 0x82, 0x82, 0xFE, 0x00,
    0x08, 0x04, 0x02, 0x04, 0x08,
    0x80, 0x80, 0x80, 0x80, 0x80,
    0x00, 0x02, 0x04, 0x08, 0x00,
    0x40, 0xA8, 0xA8, 0xA8, 0xF0,
    0xFE, 0x90, 0x88, 0x88, 0x70,
    0x70, 0x88, 0x88, 0x88, 0x40,
    0x70, 0x88, 0x88, 0x90, 0xFE,
    0x70, 0xA8, 0xA8, 0xA8, 0x30,
    0x10, 0xFC, 0x12, 0x02, 0x04,
    0x18, 0xA4, 0xA4, 0xA4, 0x7C,
    0xFE, 0x10, 0x08, 0x08, 0xF0,
    0x00, 0x88, 0xFA, 0x80, 0x00,
    0x40, 0x80, 0x88, 0x7A, 0x00,
    0xFE, 0x20, 0x50, 0x88, 0x00,
    0x00, 0x82, 0xFE, 0x80, 0x00,
    0xF8, 0x08, 0x30, 0x08, 0xF8,
    0xF8, 0x10, 0x08, 0x08, 0xF0,
    0x70, 0x88, 0x88, 0x88, 0x70,
    0xF8, 0x28, 0x28, 0x28, 0x10,
    0x10, 0x28, 0x28, 0x30, 0xF8,
    0xF8, 0x10, 0x08, 0x08, 0x10,
    0x90, 0xA8, 0xA8, 0xA8, 0x40,
    0x08, 0x7E, 0x88, 0x80, 0x40,
    0x78, 0x80, 0x80, 0x40, 0xF8,
    0x38, 0x40, 0x80, 0x40, 0x38,
    0x78, 0x80, 0x60, 0x80, 0x78,
    0x88, 0x50, 0x20, 0x50, 0x88,
    0x18, 0xA0, 0xA0, 0xA0, 0x78,
    0x88, 0xC8, 0xA8, 0x98, 0x88,
    0x00, 0x10, 0x6C, 0x82, 0x00,
    0x00, 0x00, 0xFE, 0x00, 0x00,
    0x00, 0x82, 0x6C, 0x10, 0x00,
    0x10, 0x10, 0x54, 0x38, 0x10,
    0x10, 0x38, 0x54, 0x10, 0x10};

void LCD_DispFill(uchar filldata)
{  uchar x,y;
   LCD_WrCmd(CS1,LCD_STARTROW);
   LCD_WrCmd(CS2,LCD_STARTROW);
   for(y=0;y<8;y++)
   {   LCD_WrCmd(CS1,LCD_ADDRSTRY+y);
       LCD_WrCmd(CS1,LCD_ADDRSTRX);
       LCD_WrCmd(CS2,LCD_ADDRSTRY+y);
       LCD_WrCmd(CS2,LCD_ADDRSTRX);
       for(x=0;x<64;x++)
        { LCD_WrDat(CS1,filldata);
          LCD_WrDat(CS2,filldata);
        }
   }
}

void LCD_DispIni(void)
{  uint i;
   LCD_RST=0;
   for(i=0;i<500;i++);
   LCD_RST=1;
   LCD_WrCmd(CS1,LCD_DISPON);
   LCD_WrCmd(CS1,LCD_STARTROW);
   LCD_WrCmd(CS2,LCD_DISPON);
   LCD_WrCmd(CS2,LCD_STARTROW);
   LCD_DispFill(00);
   LCD_WrCmd(CS1,LCD_ADDRSTRY+0);
   LCD_WrCmd(CS1,LCD_ADDRSTRX+0);
   LCD_WrCmd(CS2,LCD_ADDRSTRY+0);
   LCD_WrCmd(CS2,LCD_ADDRSTRX+0);
}

void LCD_DispChar(bit color,uchar cy,uchar cx,char dispdata)
{   uchar  code *pch;
    uchar i;
    bit port;
  cy=cy&0x07;
  cx=cx&0x0f;
pch=&ASCII_TAB[(dispdata-0X20)*5];
if((cx&0x08)==0)
      {  port=CS1;
         i=cx<<3;
      }
else
    {  port=CS2;
      i=(cx&0x07)<<3;
    }
LCD_WrCmd(port,LCD_ADDRSTRX+i);
LCD_WrCmd(port,LCD_ADDRSTRY+cy);
for(i=0;i<5;i++);
if(color==0)
    LCD_WrDat(port,0x00);
else
    LCD_WrDat(port,0xff);
for(i=0;i<5;i++)
     {if(color==0)
         LCD_WrDat(port,*pch);
          else
      LCD_WrDat(port,~*pch);
      pch++;
     }
if(color==0)
     LCD_WrDat(port,0x00);
else
     LCD_WrDat(port,0xff);
     for(i=0;i<5;i++)
if(color==0)
     LCD_WrDat(port,0x00);
else
     LCD_WrDat(port,0xff);
}

void LCD_DispStr(bit color,uchar cy,uchar cx,char*disp_str)
{  while(*disp_str!='\0')
   { cy=cy&0x07;
     cx=cx&0x0f;
     LCD_DispChar(color,cy,cx,*disp_str)
     disp_str++;
     cx++;
     if(cx>15)cy++;
   }
}

void LCD_DispHZ(uchar cy,uchar cx,char dispdata);
{  uchar code*pdat;
   uchar i,s,page;
   bit port;
   cy=cy&0x03;
   cx=cx&0x07;
   pdat=&HZTAB[dispdata*32];
   if((cx&0x04)==0)
     { port=0;
       s=cx<<4;
     }
   else
     { port=1;
       s=(cx<<4)-64;
     }
   for(page=0;page<2;page++)
       { LCD_WrCmd(port,LCD_ADDSTRX+s);
         LCD_WrCmd(port,LCD_ADDSTRY+(cy<<1)+page);
         for(i=0;i<5;i++);
         for(i=0;i<16;i++)
             { LCD_WrDat(port,*pdat);
             pdat++;
             }
for(i=0;i<5;i++);
       }
}

void LCD_DispHZStr(uchar cy,uchar cx,char*disp_str);
{   while(*disp_str!=0xff)
    {  cy=cy&0x03;
       cx=cx&0x07;
       LCD_DispHZ(cy,cx,*disp_str);
       disp_str++;
       cx++;
       if(cx>7)
            {cy++;
             cx=0;
            }
    }
}

LCD12864IO.C(22): error C213: left side of asn-op not an lvalue
LCD12864IO.C(227): error C141: syntax error near 'disp_str'
LCD12864IO.C(234): error C141: syntax error near '{'
LCD12864IO.C(237): error C247: non-address/-constant initializer
LCD12864IO.C(238): error C247: non-address/-constant initializer
LCD12864IO.C(239): error C231: 'pdat': redefinition
LCD12864IO.C(239): error C202: 'dispdata': undefined identifier
LCD12864IO.C(240): error C141: syntax error near 'if'
LCD12864IO.C(240): error C141: syntax error near '&', expected ')'
LCD12864IO.C(241): error C231: 'port': redefinition
LCD12864IO.C(242): error C231: 's': redefinition
LCD12864IO.C(242): error C247: non-address/-constant initializer
LCD12864IO.C(243): error C141: syntax error near '}'
LCD12864IO.C(245): error C279: 'port': multiple initialization
LCD12864IO.C(246): error C279: 's': multiple initialization
LCD12864IO.C(246): error C247: non-address/-constant initializer
LCD12864IO.C(247): error C141: syntax error near '}'
LCD12864IO.C(248): error C141: syntax error near '=', expected ')'
LCD12864IO.C(248): error C129: missing ';' before '<'
回復(fù)

使用道具 舉報

地板
ID:392485 發(fā)表于 2021-3-27 12:54 | 只看該作者
你的這個好多是語法上的錯誤,你再檢查一下,比如漏掉了“;” 或者是多寫了“;”等,還有變量名字錯誤的。
回復(fù)

使用道具 舉報

5#
ID:893765 發(fā)表于 2021-3-27 13:43 | 只看該作者
sync763 發(fā)表于 2021-3-27 12:54
你的這個好多是語法上的錯誤,你再檢查一下,比如漏掉了“;” 或者是多寫了“;”等,還有變量名字錯誤的 ...

真不知道問題在哪里
回復(fù)

使用道具 舉報

6#
ID:893765 發(fā)表于 2021-3-27 14:25 | 只看該作者
sync763 發(fā)表于 2021-3-27 12:54
你的這個好多是語法上的錯誤,你再檢查一下,比如漏掉了“;” 或者是多寫了“;”等,還有變量名字錯誤的 ...

#include<reg51.h>
#include<absacc.h>
#define uchar unsigned char
#define uint unsigned int
sbit LCD_RST=P1^0;
sbit DI=P1^5;
sbit RW=P1^4;
sbit CS1=P1^2;
sbit CS2=P1^1;
sbit EN=P1^3;
sbit RDY=P0^7;
sfr LCD=0x80;
#define LCD_DISPON 0x3f
#define LCD_STARTROW 0xc0
#define LCD_ADDRSTRY 0xb8
#define LCD_ADDRSTRX 0x40
#define CS1 0
#define CS2        1
void LCD_WrCmd(bit port,uchar cmd)
{  EN=0;
   if(port)
       { CS2=1;
         CS1=0;
       }
   else
       {CS2=0;
        CS1=1;
       }
   DI=0;
   RW=0;
   EN=1;
   LCD=cmd;
   EN=0;
}

void LCD_WrDat(bit port,uchar wrdata)
{  EN=0;
   if(port)
       { CS2=1;
         CS1=0;
       }
   else
       {CS2=0;
        CS1=1;
       }
   DI=1;
   RW=0;
   EN=1;
   LCD=wrdata;
   EN=0;
}

uchar code  ASCII_TAB[480] =
    { 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x9e, 0x00, 0x00,
    0x00, 0x0e, 0x00, 0x0e, 0x00,
    0x28, 0xfe, 0x28, 0xfe, 0x28,
    0x48, 0x54, 0xfe, 0x54, 0x24,
    0x46, 0x26, 0x10, 0xc8, 0xc4,
    0x6c, 0x92, 0xaa, 0x44, 0xa0,
    0x00, 0x0a, 0x06, 0x00, 0x00,
    0x00, 0x38, 0x44, 0x82, 0x00,
    0x00, 0x82, 0x44, 0x38, 0x00,
    0x28, 0x10, 0x7c, 0x10, 0x28,
    0x10, 0x10, 0x7c, 0x10, 0x10,
    0x00, 0xa0, 0x60, 0x00, 0x00,
    0x10, 0x10, 0x10, 0x10, 0x10,
    0x00, 0xc0, 0xc0, 0x00, 0x00,
    0x40, 0x20, 0x10, 0x08, 0x04,
    0x7C, 0xA2, 0x92, 0x8A, 0x7C,  
    0x84, 0xC2, 0xA2, 0x92, 0x8C,  
    0x42, 0x82, 0x8A, 0x96, 0x62,  
    0x30, 0x28, 0x24, 0xFE, 0x20,
    0x4E, 0x8A, 0x8A, 0x8A, 0x72,  
    0x78, 0x94, 0x92, 0x92, 0x60,   
    0x02, 0xE2, 0x12, 0x0A, 0x06,   
    0x6C, 0x92, 0x92, 0x92, 0x6C,   
    0x0C, 0x92, 0x92, 0x52, 0x3C,   
    0x00, 0x6C, 0x6C, 0x00, 0x00,  
    0x00, 0xAC, 0x6C, 0x00, 0x00,   
    0x10, 0x28, 0x44, 0x82, 0x00,   
    0x28, 0x28, 0x28, 0x28, 0x28,   
    0x00, 0x82, 0x44, 0x28, 0x10,   
    0x04, 0x02, 0xA2, 0x12, 0x0C,
    0x64, 0x92, 0xF2, 0x82, 0x7C,  
    0xFC, 0x22, 0x22, 0x22, 0xFC,   
    0xFE, 0x92, 0x92, 0x92, 0x6C,   
    0x7C, 0x82, 0x82, 0x82, 0x44,   
    0xFE, 0x82, 0x82, 0x44, 0x38,  
    0xFE, 0x92, 0x92, 0x92, 0x82,  
    0xFE, 0x12, 0x12, 0x12, 0x02,   
    0x7C, 0x82, 0x92, 0x92, 0xF4,   
    0xFE, 0x10, 0x10, 0x10, 0xFE,  
    0x00, 0x82, 0xFE, 0x82, 0x00,  
    0x40, 0x80, 0x82, 0x7E, 0x02,   
    0xFE, 0x10, 0x28, 0x44, 0x82,   
    0xFE, 0x80, 0x80, 0x80, 0x80,  
    0xFE, 0x04, 0x18, 0x04, 0xFE,   
    0xFE, 0x08, 0x10, 0x20, 0xFE,   
    0x7C, 0x82, 0x82, 0x82, 0x7C,
    0xFE, 0x12, 0x12, 0x12, 0x0C,
    0x7C, 0x82, 0xA2, 0x42, 0xBC,
    0xFE, 0x12, 0x32, 0x52, 0x8C,  
    0x8C, 0x92, 0x92, 0x92, 0x62,
    0x02, 0x02, 0xFE, 0x02, 0x02,
    0x7E, 0x80, 0x80, 0x80, 0x7E,
    0x3E, 0x40, 0x80, 0x40, 0x3E,
    0x7E, 0x80, 0x70, 0x80, 0x7E,
    0xC6, 0x28, 0x10, 0x28, 0xC6,
    0x0E, 0x10, 0xE0, 0x10, 0x0E,
    0xC2, 0xA2, 0x92, 0x8A, 0x86,
    0x00, 0xFE, 0x82, 0x82, 0x00,
    0x04, 0x08, 0x10, 0x20, 0x40,
    0x00, 0x82, 0x82, 0xFE, 0x00,
    0x08, 0x04, 0x02, 0x04, 0x08,
    0x80, 0x80, 0x80, 0x80, 0x80,
    0x00, 0x02, 0x04, 0x08, 0x00,
    0x40, 0xA8, 0xA8, 0xA8, 0xF0,
    0xFE, 0x90, 0x88, 0x88, 0x70,
    0x70, 0x88, 0x88, 0x88, 0x40,
    0x70, 0x88, 0x88, 0x90, 0xFE,
    0x70, 0xA8, 0xA8, 0xA8, 0x30,
    0x10, 0xFC, 0x12, 0x02, 0x04,
    0x18, 0xA4, 0xA4, 0xA4, 0x7C,
    0xFE, 0x10, 0x08, 0x08, 0xF0,
    0x00, 0x88, 0xFA, 0x80, 0x00,
    0x40, 0x80, 0x88, 0x7A, 0x00,
    0xFE, 0x20, 0x50, 0x88, 0x00,
    0x00, 0x82, 0xFE, 0x80, 0x00,
    0xF8, 0x08, 0x30, 0x08, 0xF8,
    0xF8, 0x10, 0x08, 0x08, 0xF0,
    0x70, 0x88, 0x88, 0x88, 0x70,
    0xF8, 0x28, 0x28, 0x28, 0x10,
    0x10, 0x28, 0x28, 0x30, 0xF8,
    0xF8, 0x10, 0x08, 0x08, 0x10,
    0x90, 0xA8, 0xA8, 0xA8, 0x40,
    0x08, 0x7E, 0x88, 0x80, 0x40,
    0x78, 0x80, 0x80, 0x40, 0xF8,
    0x38, 0x40, 0x80, 0x40, 0x38,
    0x78, 0x80, 0x60, 0x80, 0x78,
    0x88, 0x50, 0x20, 0x50, 0x88,
    0x18, 0xA0, 0xA0, 0xA0, 0x78,
    0x88, 0xC8, 0xA8, 0x98, 0x88,
    0x00, 0x10, 0x6C, 0x82, 0x00,
    0x00, 0x00, 0xFE, 0x00, 0x00,
    0x00, 0x82, 0x6C, 0x10, 0x00,
    0x10, 0x10, 0x54, 0x38, 0x10,
    0x10, 0x38, 0x54, 0x10, 0x10};

void LCD_DispFill(uchar filldata)
{  uchar x,y;
   LCD_WrCmd(CS1,LCD_STARTROW);
   LCD_WrCmd(CS2,LCD_STARTROW);
   for(y=0;y<8;y++)
   {   LCD_WrCmd(CS1,LCD_ADDRSTRY+y);
       LCD_WrCmd(CS1,LCD_ADDRSTRX);
       LCD_WrCmd(CS2,LCD_ADDRSTRY+y);
       LCD_WrCmd(CS2,LCD_ADDRSTRX);
       for(x=0;x<64;x++)
        { LCD_WrDat(CS1,filldata);
          LCD_WrDat(CS2,filldata);
        }
   }
}

void LCD_DispIni(void)
{  uint i;
   LCD_RST=0;
   for(i=0;i<500;i++);
   LCD_RST=1;
   LCD_WrCmd(CS1,LCD_DISPON);
   LCD_WrCmd(CS1,LCD_STARTROW);
   LCD_WrCmd(CS2,LCD_DISPON);
   LCD_WrCmd(CS2,LCD_STARTROW);
   LCD_DispFill(00);
   LCD_WrCmd(CS1,LCD_ADDRSTRY+0);
   LCD_WrCmd(CS1,LCD_ADDRSTRX+0);
   LCD_WrCmd(CS2,LCD_ADDRSTRY+0);
   LCD_WrCmd(CS2,LCD_ADDRSTRX+0);
}

void LCD_DispChar(bit color,uchar cy,uchar cx,char dispdata)
{   uchar  code *pch;
    uchar i;
    bit port;
  cy=cy&0x07;
  cx=cx&0x0f;
pch=&ASCII_TAB[(dispdata-0X20)*5];
if((cx&0x08)==0)
      {  port=CS1;
         i=cx<<3;
      }
else
    {  port=CS2;
      i=(cx&0x07)<<3;
    }
LCD_WrCmd(port,LCD_ADDRSTRX+i);
LCD_WrCmd(port,LCD_ADDRSTRY+cy);
for(i=0;i<5;i++);
if(color==0)
    LCD_WrDat(port,0x00);
else
    LCD_WrDat(port,0xff);
for(i=0;i<5;i++)
     {if(color==0)
         LCD_WrDat(port,*pch);
          else
      LCD_WrDat(port,~*pch);
      pch++;
     }
if(color==0)
     LCD_WrDat(port,0x00);
else
     LCD_WrDat(port,0xff);
     for(i=0;i<5;i++)
if(color==0)
     LCD_WrDat(port,0x00);
else
     LCD_WrDat(port,0xff);
}

void LCD_DispStr(bit color,uchar cy,uchar cx,char*disp_str)
{  while(*disp_str!='\0')
   { cy=cy&0x07;
     cx=cx&0x0f;
     LCD_DispChar(color,cy,cx,*disp_str)
     *disp_str++;
     cx++;
     if(cx>15)cy++;
   }
}

uchar code HZTAB[192]=
{0x00,0x00,0x00,0xF8,0x88,0x8C,0x8A,0x89,
0x88,0x88,0x88,0xF8,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xFF,0x44,0x44,0x44,0x44,
0x44,0x44,0x44,0xFF,0x00,0x00,0x00,0x00,

0x40,0x44,0xC4,0x44,0x44,0x44,0x40,0x10,
0x10,0xFF,0x10,0x10,0x10,0xF0,0x00,0x00,
0x10,0x3C,0x13,0x10,0x14,0xB8,0x40,0x30,
0x0E,0x01,0x40,0x80,0x40,0x3F,0x00,0x00,

0x10,0x10,0x10,0xFF,0x10,0x90,0x04,0x04,
0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x00,
0x04,0x44,0x82,0x7F,0x01,0x00,0x00,0x00,
0x40,0x80,0x7F,0x00,0x00,0x00,0x00,0x00,

0x40,0x30,0xEF,0x24,0x24,0x40,0x20,0x10,
0x0C,0x23,0xCC,0x10,0x20,0x40,0x40,0x00,
0x01,0x01,0x7F,0x21,0x11,0x00,0x01,0x09,
0x11,0x21,0xD1,0x0D,0x03,0x00,0x00,0x00,

0x00,0x00,0x22,0x32,0x2A,0xA6,0xA2,0x62,
0x21,0x11,0x09,0x81,0x01,0x00,0x00,0x00,
0x00,0x42,0x22,0x13,0x0B,0x42,0x82,0x7E,
0x02,0x02,0x0A,0x12,0x23,0x46,0x00,0x00,

0x20,0x30,0xAC,0x63,0x30,0x00,0x88,0xC8,
0xA8,0x99,0x8E,0x88,0xA8,0xC8,0x88,0x00,
0x22,0x67,0x22,0x12,0x12,0x80,0x40,0x30,
0x0F,0x00,0x00,0x3F,0x40,0x40,0x71,0x00,
};

void LCD_DispHZ(uchar cy,uchar cx,uchar dispdata)
{  uchar code *pdat;
   uchar i,s,page;
   bit port;
   cy=cy&0x00;
   cx=cx&0x00;
   pdat=&HZTAB[dispdata*32];
   if((cx&0x01)==0)
     { port=0;
       s=cx<<4;
     }
   else
     { port=1;
       s=(cx<<4)-64;
     }
   for(page=0;page<2;page++)
       { LCD_WrCmd(port,LCD_ADDRSTRX+s);
         LCD_WrCmd(port,LCD_ADDRSTRY+(cy<<1)+page);
         for(i=0;i<5;i++);
         for(i=0;i<16;i++)
             { LCD_WrDat(port,*pdat);
             pdat++;
             }
for(i=0;i<5;i++);
       }
}

void LCD_DispHZStr(uchar cy,uchar cx,uchar*disp_str)
{   while(*disp_str!=0xff)
    {  cy=cy&0x00;
       cx=cx&0x00;
       LCD_DispHZ(cy,cx,*disp_str);
       disp_str++;
       cx++;
       if(cx>7)
            {cy++;
             cx=0;
            }
    }
}

已修改 只剩一個LCD12864IO.C(22): error C213: left side of asn-op not an lvalue

評分

參與人數(shù) 1黑幣 +20 收起 理由
admin + 20 回帖助人的獎勵!

查看全部評分

回復(fù)

使用道具 舉報

7#
ID:392485 發(fā)表于 2021-3-27 16:22 | 只看該作者
本帖最后由 sync763 于 2021-3-27 16:24 編輯

#define CS1 0
#define CS2        1
void LCD_WrCmd(bit port,uchar cmd)
{  EN=0;
   if(port)
       { CS2=1;
         CS1=0;
       }
   else
       {CS2=0;
        CS1=1;
       }
你把CS1 CS2定義成常量了,不能被再次賦值。
回復(fù)

使用道具 舉報

8#
ID:392485 發(fā)表于 2021-3-27 16:23 | 只看該作者
#define CS1 0
#define CS2        1
void LCD_WrCmd(bit port,uchar cmd)
{  EN=0;
   if(port)
       { CS2=1;
         CS1=0;
       }
   else
       {CS2=0;
        CS1=1;
       }
你把CS1  CS2定義為常量了,常量是不能被賦值的。

評分

參與人數(shù) 1黑幣 +20 收起 理由
admin + 20 回帖助人的獎勵!

查看全部評分

回復(fù)

使用道具 舉報

9#
ID:893765 發(fā)表于 2021-3-27 16:33 | 只看該作者
sync763 發(fā)表于 2021-3-27 16:23
#define CS1 0
#define CS2        1
void LCD_WrCmd(bit port,uchar cmd)

謝謝您
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

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

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

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