Hitler1992 发表于 2013-3-26 00:37:39

mega16写1602程序,第二行不显示

为什么第二行不显示,代码没错啊
跪求大神指导!!!
#include<iom16v.h>
#include<macros.h>
#define uint unsigned int
#define uchar unsigned char
#pragma data:code
const uchar table1[]={"I LOVE AVR MCU!!"};
const uchar table2[]={"I LOVE STM MCU!!"};
void delay(uint z)
{
       uint x,y;
       for(x=z;x>0;x--)
               for(y=1141;y>0;y--);
}
void write_com(uchar com)
{
       PORTA=0x3f;
       PORTC=com;
       PORTA=0x40;
       delay(5);
       PORTA=0xdf;        
}
void write_dat(uchar dat)
{
       PORTA=0xbf;
       PORTC=dat;
       PORTA=0x40;
       delay(5);
       PORTA=0xdf;       
}
void main()
{
       uint i;
       DDRC=0XFF;
       DDRA=0xe0;
       PORTA=0x40;
       write_com(0x38);
       delay(5);
       write_com(0x01);
       delay(5);
       write_com(0x0c);
       delay(5);
       write_com(0x06);
       delay(5);
       while(1)
       {
       write_com(0x80);
       for(i=0;i<16;i++)
       {
                  write_dat(table1);
                delay(5);                          
       }
   write_com(0X80+0x40);
       for(i=0;i<16;i++)
       {
                  write_dat(table2);
                delay(5);                          
       }
       }
       while(1);
}
页: [1]
查看完整版本: mega16写1602程序,第二行不显示