搜索
bottom↓
回复: 9

12864不亮怎么回事

[复制链接]

出0入0汤圆

发表于 2013-5-19 10:53:39 | 显示全部楼层 |阅读模式
#include<avr/io.h>
#include <macros.h>
#define uchar unsigned char
#define uint  unsigned int
#define uchar unsigned char
#define uint  unsigned int
#define RS_0  PORTC &= ~(1 << PC0)         //RS为0
#define RS_1  PORTC |= (1 << PC0)                //RS为1
#define RW_0  PORTC &= ~(1 << PC1)        //RW为0
#define RW_1  PORTC |= (1 << PC1)        //RW为1
#define EN_0  PORTC &= ~(1 << PC2)        //EN为0
#define EN_1  PORTC |= (1 << PC2)                //EN为1
#define PSB_0  PORTC &= ~(1 << PC3)        //PSB为0
#define PSB_1  PORTC |= (1 << PC3)        //PSB为1
//串/并方式控制,高电平为并行方式,低电平为串行方式
#define RST_0  PORTC &= ~(1 << PC5)        //RST为0
#define RST_1  PORTC |= (1 << PC5)        //RST为1
uchar Line1_data[]={"wwww"};
uchar Line2_data[]={"wwww"};
uchar Line3_data[]={"wwww"};
uchar Line4_data[]={"wwww"};
void delay_us(unsigned int n)
{
if(n == 0)
return ;
while(--n);
}
void Delay_ms(uint xms)
{
int i,j;
for(i =0;i<xms;i++)
   {
      for(j=0;j<1140;j++);
   }
}
uchar lcd_busy()
{
uchar result;
DDRA = 0x00;
RS_0;
RW_1;
EN_1;
delay_us(40);
result=PIND&0x80;
EN_0;
return result;
}
void lcd_wcmd(uchar cmd)
{
DDRA=0XFF;
RS_0;
RW_0;
EN_0;
PORTA=cmd;
delay_us(40);
EN_1;
delay_us(40);
EN_0;
}
void lcd_wdat(dat)
{
DDRA=0XFF;
RS_1;
RW_0;
EN_0;
PORTA=dat;
delay_us(40);
EN_1;
delay_us(40);
EN_0;
}
void lcd_clr()
{
lcd_wcmd(0x01);
Delay_ms(5);
}
void lcd_init()
{
PSB_1;
RST_0;
Delay_ms(3);
RST_1;
Delay_ms(3);
lcd_wcmd(0x34);
Delay_ms(5);
lcd_wcmd(0x30);
  Delay_ms(5);
  lcd_wcmd(0x0c);
   Delay_ms(5);
   lcd_wcmd(0x01);
    Delay_ms(5);

}
void LocateXY(uchar x,uchar y)
{
if(y==0){lcd_wcmd(0x80 + x);}
else if(y==1){lcd_wcmd(0x90 + x);}
else if(y==2){lcd_wcmd(0x88 + x);}
else if(y==3){lcd_wcmd(0x98 + x);}
}
void LCD_write_str(uchar x, uchar y,uchar *s)
{
  LocateXY(x,y);
   while(*s)
    {
      lcd_wdat(*s);
       s++;
    }
}
void port_init(void)
{
PORTA = 0XFF;
DDRA = 0XFF;
PORTC=0XFF;
DDRC =0XFF;

}
void main()
{
uchar i;
uchar Line1_data[]={"wwww"};
uchar Line2_data[]={"wwww"};
uchar Line3_data[]={"wwww"};
uchar Line4_data[]={"wwww"};
port_init();
Delay_ms(100);
lcd_init();
while(1)

{
LocateXY(0,0);
   for(i=0;i<16;i++)
   {
    lcd_wdat(Linel_data[i]);
        Delay_ms(100);
   }
LocateXY(0,1);
   for(i=0;i<16;i++)
   {
    lcd_wdat(Line2_data[i]);
        Delay_ms(100);
   }
LocateXY(0,2);
   for(i=0;i<16;i++)
   {
    lcd_wdat(Line3_data[i]);
        Delay_ms(100);
   }
LocateXY(0,3);
   for(i=0;i<16;i++)
   {
    lcd_wdat(Line4_data[i]);
        Delay_ms(100);
       
   }
lcd_clr();  
}
}
main.c:134: error: 'Linel_data' undeclared (first use in this function)
main.c:134: error: (Each undeclared identifier is reported only once
main.c:134: error: for each function it appears in.)
不知道怎么回事
帮帮忙啊

阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……

出0入0汤圆

 楼主| 发表于 2013-5-19 11:02:11 | 显示全部楼层
帮忙啊

出0入0汤圆

 楼主| 发表于 2013-5-19 11:25:42 | 显示全部楼层
自己顶

出0入0汤圆

发表于 2013-5-19 11:34:11 | 显示全部楼层
帮顶

出0入0汤圆

发表于 2013-5-19 11:35:38 | 显示全部楼层
Linel_data' undeclared,没定义,line1_data.

出0入0汤圆

 楼主| 发表于 2013-5-19 11:54:07 | 显示全部楼层
电路图在这帮忙看看哪不对吧感谢

出0入0汤圆

 楼主| 发表于 2013-5-19 11:55:38 | 显示全部楼层
[img][/img]

出0入0汤圆

 楼主| 发表于 2013-5-19 11:56:46 | 显示全部楼层

出0入0汤圆

发表于 2013-5-20 09:35:28 | 显示全部楼层
电路有没有问题??

出0入0汤圆

 楼主| 发表于 2013-5-21 16:22:17 | 显示全部楼层
lr120363092 发表于 2013-5-20 09:35
电路有没有问题??

木有   程序不知对不

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-26 22:12

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表