| ??? 05/24/03 04:45 Read: times |
#46518 - AT89Cx051 programming questions |
I have been working on my AT89Cx051 programming board, and a couple of questions have come up... I guess some of you here have some experience programming these (or other) chips.
First a short description of my board. P1 of the AT89Cx051 is connected to P1 of the 80c31 chip that's supposed to handle the programming. P3 (on the AT89Cx051) is connected to a 574 latch through a 07 buffer. The output of the buffer is pulled high through 4k7 resistors. And now the questions: What state should the various pins be in while the AT89Cx051 chip is inserted (or removed)? Vcc and Vpp (RST) are both at 0V, but what about the P1/P3 pins? Should they by pulled down or left floating (high)? If they float the Vcc LED lights dimly, so it looks like the chip draws current throgh the pull-up resistors. Is the XTAL1 pin (used to increment the address counter) supposed to draw current? When I set the XTAL1 pin high (controlled by a P3 pin on the 80c31), it doesn't get very high... I tried adding a 4k7 pullup, but it still only reaches 2.6V. According to the datasheet 3.5V is needed. I guess I have a bad chip, or that my experiments killed it - but of course I don't have any other chips for verifying... ;-) When I read the signature bytes the first one is ok (0x1e). The second byte is read as either 21, 23 or 255, but I guess that's caused by the XTAL1 problem mentioned above. I'll include the code I use for reading the signature bytes below, just in case someone hasn't got better things to do than read bad code ;-) If anyone spots errors I might as well fix them before I destroy more chips... Best regards, Mikkel C. Simonsen //Power-up sequence
//Set port 1 high
P1 = 0xff;
//Apply power (Vcc+Vpp)
portb = 0x4;
//Set RST and XTAL1 to GND
portb = 0x7;
DXTAL1 = 0;
//Set RST to H
portb = 0x4;
//Set P3.2 to H
DP32 = 1;
//Read signature byte
_nop_();
c = P1;
uln(10);
if (c == 0x1e) strcpy(chvendor, "Atmel");
else
{
strcpy(chvendor, "unknown ");
sprintf(str, "%i", (int)c);
strcat(chvendor, str);
}
udskrivs(" The chip is an ");
udskrivs(chvendor);
udskrivs(" ");
//Increment address counter
DXTAL1 = 1;
_nop_();
pause(1);
DXTAL1 = 0;
_nop_();
//Read signature byte
c = P1;
if (c == 0x41)
{
strcpy(chtype, "AT89C4051");
chsize = 4096;
}
else if (c == 0x21)
{
strcpy(chtype, "AT89C2051");
chsize = 2048;
}
else if (c == 0x12)
{
strcpy(chtype, "AT89C1051U");
chsize = 1024;
}
else if (c == 0x11)
{
strcpy(chtype, "AT89C1051");
chsize = 1024;
}
else
{
strcpy(chtype, "unknown ");
sprintf(str, "%i", (int)c);
strcat(chtype, str);
chsize = 4096;
}
udskrivs(chtype);
udskrivs("rn");
//Power down sequence
//Set XTAL1 to L
DXTAL1 = 0;
//Set RST to L
portb = 0x7;
//Turn Vcc power off
portb = 0x47;
//Set port 1 low
P1 = 0x00;
DP31 = 0;
DP32 = 0;
udskrivs("nn * * * Press any key to continue * * *");
uln(11);
while (! RI);
c = SBUF;
RI = 0;
|
| Topic | Author | Date |
| AT89Cx051 programming questions | 01/01/70 00:00 | |
| RE: AT89Cx051 programming questions | 01/01/70 00:00 | |
| RE: AT89Cx051 programming questions | 01/01/70 00:00 | |
| RE: AT89Cx051 programming questions | 01/01/70 00:00 | |
| RE: AT89Cx051 programming questions | 01/01/70 00:00 | |
| RE: AT89Cx051 programming questions | 01/01/70 00:00 | |
RE: AT89Cx051 programming questions | 01/01/70 00:00 |



