STC89C52RC模拟读写RC500时序?
时间:10-02
整理:3721RD
点击:
大侠们,我用STC89C52RC单片机,接22.1184MHz晶振,使用XBYTE指令读写RC500芯片正常,可我用IO模拟时序读RC500,总报1B错误,不只怎么回事?程序除XBYTE改写外,均为改变。下面为XBYTE的IO模拟程序,大家帮忙看看,谢啦!(想把该程序移植到其它单片机上)
void WriteRawIO(unsigned char Address,unsigned char value)
{
// XBYTE[Address]=value;
RC500WR=1;
RC500CS=0;
RC500RD=1;
RC500ALE=0;
RC500ALE=1;
P0=Address;
DelayuS(1);
RC500ALE=0;
RC500CS=0;
DelayuS(1);
P0=value;
RC500WR=0;
RC500WR=1;
}
unsigned char ReadRawIO(unsigned char Address)
{
// return XBYTE[Address];
unsigned char temp;
RC500WR=1;
RC500CS=0;
RC500RD=1;
RC500ALE=0;
RC500ALE=1;
P0=Address;
DelayuS(1);
RC500ALE=0;
RC500CS=0;
DelayuS(1);
temp=P0;
RC500RD=0;
RC500RD=1;
return temp;
}
void WriteRawIO(unsigned char Address,unsigned char value)
{
// XBYTE[Address]=value;
RC500WR=1;
RC500CS=0;
RC500RD=1;
RC500ALE=0;
RC500ALE=1;
P0=Address;
DelayuS(1);
RC500ALE=0;
RC500CS=0;
DelayuS(1);
P0=value;
RC500WR=0;
RC500WR=1;
}
unsigned char ReadRawIO(unsigned char Address)
{
// return XBYTE[Address];
unsigned char temp;
RC500WR=1;
RC500CS=0;
RC500RD=1;
RC500ALE=0;
RC500ALE=1;
P0=Address;
DelayuS(1);
RC500ALE=0;
RC500CS=0;
DelayuS(1);
temp=P0;
RC500RD=0;
RC500RD=1;
return temp;
}
我也遇到这个问题