#include<iom16.h>
#define uchar unsigned char
#define uint unsigned int
#define rs1 PORTB|=1
#define rs0 PORTB&=~1
#define rw1 PORTB|=2
#define rw0 PORTB&=~2
#define en1 PORTB|=4
#define en0 PORTB&=~4
//===================================
void delay(void)
{
uchar j;
for(j=0;j<120;j++);
}
void init(void)
{
DDRB=0XFF;
PORTB=0XFF;
}
void manglu(void)
{
uchar a;
do
{
rw1;
rs0;
en1;
DDRA=0X00;
a=PINA;
delay();
en0;
}while(a&0x80);
DDRA=0XFF;
}
void xiezhiling(uint x)
{
manglu();
rs0;
rw0;
en0;
PORTA=x;
en1;
delay();
en0;
}
void zhiling(void)
{
xiezhiling(0x38);
xiezhiling(0x0c);
xiezhiling(0x80);
}
void shuju(void)
{
manglu();
rs1;
rw0;
en1;
PORTA=0X41;
}
void main(void)
{
init();
zhiling();
shuju();
}
无法显示。 求错误
[
本帖最后由 wgla5883792 于 2011-8-1 16:04 编辑 ]