0
\$\begingroup\$

As you see in the figure, programming the 8051 through serial port DB9 connector should be a fairly easy task Connect the two pins of 8051 to max 232 and then to DB9

So the programming circuit of 8051 should contain no more than 1 chip,some power sources,crystals,capacitors and one connector port. But when you search online for 8051 programmer circuit, they contain many chip like 89c2051 and whatnot.

Then why cant we program the 8051 using this simple circuit?

By 8051 i mean AT89S51/52. 8051 picture

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Fresh from the box these processors don't come with a bootloader so it doesn't 'know' anything about standard serial ports per se but it does have a serial programming mode. It is expecting an external shift clock (SCK) to move serial data to the input pin (MOSI) or to read data from the output pin (MISO).

To quote from the data sheet.

"Serial Programming Algorithm

To program and verify the AT89S51 in the serial programming mode, the following sequence is recommended:

  1. Power-up sequence:

    a. Apply power between VCC and GND pins.

    b. Set RST pin to “H”.

    If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHz clock to XTAL1 pin and wait for at least 10 milliseconds.

  2. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock at XTAL1 divided by 16.
  3. The Code array is programmed one byte at a time in either the Byte or Page mode. The write cycle is self-timed and typically takes less than 0.5 ms at 5V.
  4. Any memory location can be verified by using the Read instruction that returns the content at the selected address at serial output MISO/P1.6.15

  5. At the end of a programming session, RST can be set low to commence normal device operation.

Power-off sequence (if needed):

  1. Set XTAL1 to “L” (if a crystal is not used).
  2. Set RST to “L”.
  3. Turn VCC power off.

Data Polling:

The Data Polling feature is also available in the serial mode. In this mode, during a write cycle an attempted read of the last byte written will result in the complement of the MSB of the serial output byte on MISO."

\$\endgroup\$
6
  • \$\begingroup\$ It means the AT89s52 can be programmed out of the box? I mean just like those phillips 89v51, which contains bootloader code?The 89s52 also contains bootloader code too? \$\endgroup\$
    – Santosh
    Jul 15, 2013 at 14:00
  • \$\begingroup\$ @HS Yes - if you have a programmer for it. Most processors have both serial and parallel programming modes. Without them you wouldn't be able to write/store your own programs - it would be totally useless if it didn't. Some are One Time Programmable (OTP) but most allow you to reprogram many times. The large, more recent controllers usually have a USB style bootloader. The internal program tells it how to respond to the external programming signals and can directly connect with your computer using a standard USB port. Unfortunately the 89s52 isn't one of them. \$\endgroup\$ Jul 15, 2013 at 14:46
  • \$\begingroup\$ Yes thats what I was asking. Today I asked the electronic store guy,he said the 89s52 need to have bootloader inside it to program it, and I have seen many people using AT89c2051 along with max 232 when programing 89sXX . SO I came to conclusion that 89c2051 contains the bootloader, and it transfers the code to 89s52 serially....correct me if I am wrong...I am very confused... \$\endgroup\$
    – Santosh
    Jul 15, 2013 at 15:19
  • \$\begingroup\$ @HS Have a look at ebay.com/itm/… \$\endgroup\$ Jul 16, 2013 at 5:58
  • \$\begingroup\$ oh wow! You can program both the 89s52 and c2051! So I will have to load the code in C2051 such that it passes the code to 89s52. Does it mean that like 89s52, I will have to initialize the c2051 in serial mode, then make it such that whatever code it gets in one pin is sent to 89s52? \$\endgroup\$
    – Santosh
    Jul 16, 2013 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.