Introduction: ARDUINO AS a 8051 PROGRAMMER - CHEAPEST PROGRAMMER IN THE WORLD

Picture of ARDUINO AS a 8051 PROGRAMMER - CHEAPEST PROGRAMMER IN THE WORLD

ITS TO HARD TO FIND 8051 PROGRAMMER WITH USB CONNECTIVITY.
YOU WILL FIND SO MANY CIRCUITS FOR 8051 PROGRAMMING BY MAX232 BUT IT WILL NOT WORK IF ITS NOT ICSP OR THE BOOTLOADER IS NOT INSTALLED ON CHIP.

BUT IF YOU HAVE ARDUINO YOU CAN USE IT AS PROGRAMMER FOR 89S52(ATMEGA89S52).

I HAVE CREATED ARDUINO SHIELD.

THIS IS THE CHEAPEST PROGRAMMER IN THE WORLD

COST WILL BE VERY LOW IF YOU HAVE ARDUINIO ALREADY.

Step 1: WHAT YOU NEED?

Picture of WHAT YOU NEED?

ARDUINO UNO (ANY ARDUINO)
AT89S52
IC STAND
PCB
22PF CAPACITOR 2 NO.
CRYSTAL 12Mhz(8Mhz to 16Mhz can work)
MALE PIN HEADER
USB CABLE
10K OHM RESISTOR
10uF capacitor

Step 2: TOTAL PRICE

CURRENCY IN INDIAN Rs.
IC STAND:- 5Rs
CRYSTAL:- 10Rs
CAPACITOR:- 3Rs
PCB:- 10Rs
MALE PIN
HEADER:- 5Rs
AT89S52 40Rs



TOTAL ONLY:-70Rs.

Step 3: Circuit Diagram and Software

Picture of Circuit Diagram  and Software


upload at89s52program skatch to arduino
connect the circuit as per diagram
open 89s52programmer.exe
select com port of your arduino
click open hex file, and browse it ..
then click on identify chip you will see the message at bottom of the window (chip detected)

then click on upload hex
wait for a moment and message to diplay(finished writting).

now enjoy....

Step 4: Here Is Program for Arduino

#define dummyData 0xAA

#define RDY 75 #define NRDY 76

const int _MISO = 4; const int _MOSI = 5; const int _CLK = 3; const int RST = 2;

/* Variable definition block */

byte data; byte AL,AH; // 16-bit address byte lockByte; // embed lock bits here byte SigH,SigL; // Signature Bytes

void setup() { pinMode(_MISO, INPUT); pinMode(_MOSI, OUTPUT); pinMode(_CLK, OUTPUT); pinMode(RST, OUTPUT); Serial.begin(115200); // depends on the setting of the host PC

}

void loop() { while (!Serial.available()); // wait for character if (Serial.available() > 0) switch (Serial.read()) { case 'p': Serial.write(progEnable()); break; case 'r': readProgmem(); Serial.write(data); break; case 'a': while(!Serial.available()); AL = Serial.read(); break; case 'A': while(!Serial.available()); AH = Serial.read(); break; case 'd': while(!Serial.available()); data = Serial.read(); break; case 'S': AH = 0; AL = 0; SigH = readSign(); Serial.write(SigH); break; case 's': AH = 2; AL = 0; SigL = readSign(); Serial.write(SigL); AH = 1; AL = 0; SigL = readSign(); Serial.write(SigL); break; // read SigL case 'o': digitalWrite(RST,1);break; case 'c': digitalWrite(RST,0);break; case 'e': eraseChip(); Serial.write(RDY); break; case 'j': break; case 'w': writeProgmem(); break; }

}

unsigned char SendSPI(unsigned char data) { uint8_t retval = 0; uint8_t intData = data; int t; for (int ctr = 0; ctr < 7; ctr++) { if (intData & 0x80) digitalWrite(_MOSI,1); else digitalWrite(_MOSI,0);

digitalWrite(_CLK,1); delayMicroseconds(1);

t = digitalRead(_MISO); digitalWrite(_CLK,0);

if (t) retval |= 1; else retval &= 0xFE; retval<<=1; intData<<= 1; delayMicroseconds(1); }

if (intData & 0x80) digitalWrite(_MOSI,1); else digitalWrite(_MOSI,0); digitalWrite(_CLK,1); delayMicroseconds(1);

t = digitalRead(_MISO); digitalWrite(_CLK,0); if (t) retval |= 1; else retval &= 0xFE;

return retval; }

byte progEnable() { SendSPI(0xAC); SendSPI(0x53); SendSPI(dummyData); return SendSPI(dummyData); }

void eraseChip() { SendSPI(0xAC); SendSPI(0x9F); SendSPI(dummyData); SendSPI(dummyData); delay(520); }

void readProgmem() {

SendSPI(0x20); SendSPI(AH); SendSPI(AL); data = SendSPI(dummyData); }

void writeProgmem() { SendSPI(0x40); SendSPI(AH); SendSPI(AL); SendSPI(data); }

void writeLockBits() { SendSPI(0xAC); SendSPI(lockByte); SendSPI(dummyData); SendSPI(dummyData); }

void readLockBits() { SendSPI(0x24); SendSPI(dummyData); SendSPI(dummyData); lockByte = SendSPI(dummyData); }

byte readSign() { SendSPI(0x28); SendSPI(AH); SendSPI(AL); return SendSPI(dummyData); }

Step 5: Refrence

http://tiktakx.wordpress.com/2014/04/19/programmin...
and
www.facebook.com/SparkingElectronics
like this page for more projects like this.
how to generate hex file and make shield like this will be updated soon .. keep visiting..

Comments

ZAEEM6549 (author)2015-04-12

@tapan mojidra, great work bro, i have following questions,

1- did u try this circuit yourself, by uploading simple program?

2- suppose i want to make a program for blinking led,

can i make the led blinking program in arduino language?

in other words can we upload arduino sketch to 89s52?

Waiting for your valuable reply....

TAPAN MOJIDRA (author)ZAEEM65492015-04-12

i have try this circuit myself and

you cant use arduino lenguage to program 89s52 chip.

this is just only a programmer for 8051 you have to generate hex file for that separately. you can upload hex file using this programmer.

the arduino chip will behave like as a isp programmer for 89s52 .
and 89s52 can be programmed with this programmer.

I have a doubt. How to dump the hex file to 8051 using arduino. Am I supposed to copy the hex file content and paste in the serial monitor in the arduino. Please clearly explain the steps you have followed one by one.

Thanks

we cant upload arduino sketch to 89s52 chip.
i have use kail simmulater to make program for 89s52 chip...

TAPAN MOJIDRA (author)ZAEEM65492015-04-12

i have try and successfully completed the projects on 16*2 LCD programming and works perfectly.

SudarshanH3 (author)2017-09-18

Hello!
Will this work for AT89C51?
Thank you.

KshitijK22 (author)2017-05-03

How to check whether if the program is get uploaded or not ?

Puplics Dani (author)2017-03-17

Hello! AT89S52 is AT89S52-24PU? if they are the same: The program says Port open. then i click identify and nothing. Can somebody help me?

KshitijK22 (author)Puplics Dani2017-05-03

Same here bro!!

sowais672 (author)2017-01-24

compiling is done but error is occurring during uploading..
what to do??

veera123 (author)2016-12-02

i got an error while compiling arduino code..

'lockByte' was not declared i this scope.. can you help me??

getabyte (author)veera1232017-01-16

reorganize the code, and then will be ok. Since the first few lines of code are comment out, fix that will be fine.

mujahidabdullah (author)2016-11-12

can I program 89c51?

No you can not

ZeeshanR3 (author)2016-10-08

i am using AT89C51 BUT programmer is NOT Working,can u help?

pedrobneto (author)2016-07-26

Fantastic! It also works on linux under wine!!

AbinashD3 (author)pedrobneto2016-09-30

Not working on linux under wine. Is there anything I'm missing?

AbinashD3 (author)2016-09-30

Works fine on Windows!!! good tutorial. I used a ready-made dev. board, with 12mhz xtal ,caps and reset circuit. only connected the required VCC,GND,MISO,MOSI and reset to Arduino and uploaded hex files.

However, it's not working on linux under Wine. Is there anything i need to do to make it work on linux(I'm on Xubuntu 16.04)?

NishantK27 (author)2016-06-17

Working well.......nice work....don't modify arduino program and it will work fine.....i am using 8 mhz crystal...

HarrisH2 (author)2016-04-15

where is the hex file found?

De alon (author)2016-04-13

hoping a solution soon

De alon (author)2016-04-13

does not work.

an error occur when 8051 spi programmer software is opened. comport3 continuous blink and display error massage(see in image below).

I use 64-bit laptop, windows10

akshaya ladwa (author)2016-04-12

I am not able to upload the hex code using that software which u have suggested :-(

double check the connection..
can you detect the chip?

MichałC4 (author)2016-03-24

Great project! I used an AT89S51 with 11,059k Crystal, and works fine.

MANIAH1 (author)2016-03-12

as u mention in code baud rate is 115200 but generally, it is 9600 or not? for our PC, it's 9600 or not? waiting for ur valuable reply...

sumanmajhi (author)2016-02-05

hello bro,it's really working with my AT89S52,now i need my ATMEGA16A to work upon,so can you please help me out?...

addwarj (author)2015-12-20

If we click on identify there will show anything at the bottom of the window?
when I click there no message. could you help me :-(

huyn22 (author)2015-12-06

can you add programer avr in code ?

EdnoJ (author)2015-05-26

Just a question. How do you parse the hex file and send it over to the arduino?

llaaaatt[dd...]cc

If this is the format of a hex file, for every line you get the 'aaaa', and then assigns it to AH and AL in the sketch as i see.

But what about data? do you get all the [dd..] and assigns every byte of it to data, and then send it to the 8051 Microcontroller? I mean, If dd is a byte of data, do you get each dd and send it over to arduino? And then, in the next line, do you do it all over again? Thanks

TAPAN MOJIDRA (author)EdnoJ2015-10-01

the program here acts for arduino to perform it as a programmer for 89$52 chip and the hex file for the 89$52 need to be generate separately.

Jian WeiW (author)2015-09-09

i tried to use this method, but it seem like the 89s52programmer.exe not writting any thing to my mcu even it show finish writting. Can you give me a help?

TAPAN MOJIDRA (author)Jian WeiW2015-10-01

Double check the connection or use some handy ic socket like ZIF socket
first read the signature byte by detecting the chip from programmer and then hit upload hex by selecting proper hex file.

DanielH80 (author)2015-09-16

Hi, is it possible to read existing programs from the at89s52 with your programmer?

techno man (author)2015-04-12

tanx 4 this Tapan bro

TAPAN MOJIDRA (author)techno man2015-04-12

Wlcm..

ZAEEM6549 (author)2015-04-12

thanks 4 reply,

does it only works with 89s52 only?

what about other 89 series chips?

TAPAN MOJIDRA (author)ZAEEM65492015-04-12

This works only for 89s52.
no provision for other any chips...

Neel92 (author)2015-04-09

It dsnt wrk..... :(

TAPAN MOJIDRA (author)Neel922015-04-09

What is your crystal frequency? i have taken 12MHz and 11.0592MH crytal both works fine. you can works any either.....

TAPAN MOJIDRA (author)Neel922015-04-09

CHECK WIRING ONCE AGAIN. AND FIRST UPLOAD SOME BASIC TESTING CODE LIKE LED BLINKING THEN YOU WILL KNOW THAT YOUR PROGRAMMER IS OK...

YOU MAY BE TRYING YOUR PROGRAMMED CHIP TO FAULTY PROJECT PCB OR ERROR MAY BE CREPT IN YOUR CODE?

I HAVE GENERATE MY HEX FILE IN INTEL80 FORMET ON KAIL SIMMULATOR FOR 89$
S52 CHIP THIS WILL WORK ONLY FOR 89S52 CHIP.

which project are you making?

About This Instructable

43,381views

34favorites

More by TAPAN MOJIDRA:ARDUINO 4*4 OR 4*3 KEYPAD :- Convert key pressed into intiger value 24*10 LED MATRIX PERFECTLY RUNNINGARDUINO AS A 8051 PROGRAMMER - CHEAPEST PROGRAMMER IN THE WORLD
Add instructable to: