AT89S52 + SST39SF020,代码与电路如下,读取ChipID一直错误,到底是我电路有问题,还是代码有问题?
正确ID应该是B 6BF,我读出的却是 02 1C
电路图中有处错误,WR与RD应该对换下。
(原文件名:无标题.jpg)
sbit LED = P1^0;
sbit A16 = P3^4;
sbit A17 = P3^5;
sbit CE = P1^1;
void main(void)
{
unsigned int i;
char c;
UART_Init();
UART_Puts("uart is ready!
");
A16 = 0;
A17 = 0;
while(1)
{ LED ^= 1;
CE = 0;
XBYTE[0x5555] = 0xAA;
XBYTE[0x2AAA] = 0x55;
XBYTE[0x5555] = 0x90;
c = XBYTE[0x0001];
UART_Putc(c);
c = XBYTE[0x0000];
UART_Putc(c);
XBYTE[0x5555] = 0xAA;
XBYTE[0x2AAA] = 0x55;
XBYTE[0x5555] = 0xF0;
CE = 1;
for(i=10000;i>0;i--);
}
}
一周热门 更多>