#include "1602.h"
#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
#define delay() _nop_();_nop_();_nop_();_nop_();_nop_()
sbit scl=P2^6;
sbit sda=P2^7;
uchar l[]={0x63,3,4,5,6,7,8,9};
uint k[8];
void start()
{
sda=1;
scl=1;
delay();
sda=0;
delay();
scl=0;
}
void stop()
{
sda=0;
scl=1;
delay();
sda=1;
delay();
}
void ack()
{
scl=1;
sda=1;
while(sda);
scl=0;
delay();
}
void PC_ack()
{
scl=1;
sda=1;
sda=0;
delay();
scl=0;
delay();
}
void write_byte(uchar d)
{ uchar i;
for(i=0;i<8;i++)
{
sda=(bit)((d<<i)&0x80);
scl=1;
scl=0;
}
}
void write_one(uchar e,uchar f)
{
start();
write_byte(0xa0);
ack();
write_byte(e);
ack();
write_byte(f);
ack();
stop();
}
uint read_byte()
{ uchar i;
uint b;
for(i=0;i<8;i++)
{
b<<=1;
scl=0;
b|=(sda)?0x01:0x00;
scl=1;
}
return b;
}
uchar read_one(uchar m)
{
uchar b;
start();
write_byte(0xa0);
ack();
write_byte(m);
ack();
start();
write_byte(0xa1);
ack();
b=read_byte();
delay();
stop();
return b;
}
void write_page(uchar e,uchar *q)
{
start();
write_byte(0xa0);
ack();
write_byte(e);
ack();
while(*q)
{
write_byte(*(q++));
ack();
}
stop();
}
uint read_page(uchar h,uchar m)
{
uint *v;
uchar i;
start();
write_byte(0xa0);
ack();
write_byte(h);
ack();
start();
write_byte(0xa1);
ack();
for(i=0;i<m;i++)
{
k=read_byte();
PC_ack();
}
stop();
v=&k[0];
return *v;
}
void main()
{
uint **w;
uchar i;
write_page(0x00,l);
LCD_init();
while(1)
{
for(i=0;i<8;i++)
{
w=read_page(0x00,8);
zl(0x80+i*2);
sj((**w>>4)%10+0x30);
sj((**w&0x0f)%10+0x30);
}
}
}
为什么在主函数中的
w=read_page(0x00,8);
会出现 illegal pointer conversion 的语句?哪位大神能告诉我,谢谢