Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

AT89S51/52 ISP Programmer – Signature Byte Read

By Himanshu Choudhary

 
The Signature Byte is a unique sequence of bytes which are used to identify the chip. It is written in the memory of the chip during the manufacturing process and cannot be changed. These memory locations are read only. Every chip manufactured by a company with the same number has the same signature byte. For example all the chips with number AT89S51 will have same signature byte.
 
In this project we will generate the pulses from one microcontroller to read the signature byte of the other microcontroller. The output will be displayed on the LEDs and can be verified using the datasheet.
The reader should know the basics of sending and receiving the single byte in programming mode. Refer to 8051 Programmer basics before reading this tutorial.
 
The location of the memory and the corresponding value where the signature byte is stored is given in the data sheets. By reading the signature byte it is possible to identify the key information about the chip like manufacturer, number etc.
 
In case of 89S52 the signature byte is of 3 bytes. It is stored in the memory location 0x000, 0x100, 0x200. The values stored at these locations are shown below:
 
(000H) = 0x1E indicates manufactured by Atmel
(100H) = 52H indicates AT89S52
(200H) = 06H
 

Circuit Diagram of 8051 Programmer

Fig. 1: Table listing 8051 instructions to read Signature Bytes

The instruction to read Signature Bytes is given in the table above. The first byte in the instruction is fixed. The second and third bytes are used to send the address of the memory location. The value of the signature byte corresponding to the memory location is returned during the transmission of fourth byte. This value is displayed on the LED’s. Please note “x” in the above table mean don’t care condition i.e., either 1 or 0 can be sent. In order to read all the 3 values of signature byte, the same process is repeated three times with different memory locations address.
 

Circuit and Algorithm

Circuit Diagram

Circuit Diagram of 8051 Programmer

Fig. 2: Circuit Diagram of 8051 Programmer

Algorithm
The algorithm to read the signature byte is:
1.      Power on the circuit.
2.      Send the instruction for programming enable.
3.      Check the 4th byte on MISO pin. If we receive 0x69 this means chip is enabled.
4.      If programming mode in enabled then send four bytes instruction corresponding to read first signature byte with address ‘000’.
5.      While sending 4th byte, we will receive the value of the 1st signature byte.
6.      Repeat the steps 4 and 5 to read the values corresponding to other two memory location of signature byte.
 
Note: Programming enable instruction is necessary only once. Also in case if the chip is already in the programming enable mode and some other operation like chip erase etc. has been performed, then there is no need to give the programming enable again.
 

Code

Code
The following code is used to read the signature byte and the output is displayed on LEDs.
#include <REG51.h>
#include<intrins.h>
#define port P1
#define p2 P2

sbit sck=port^0;
sbit res=port^3;
sbit miso=port^1;
sbit mosi=port^2;

bit bit1;
unsigned int i,bitno=0;
unsigned char a,b,c,d,output[13],count;
void delay(unsigned int msec)   // Function for delay
{
	int i,j;
	for(i=0;i<msec;i++)
		for(j=0;j<1275;j++);
}

void read()
{
	bit1=miso;
	output[count]=output[count]<<1;
	if(bit1==1)
		output[count]++;
}

void sread()
{
	count++;
	output[count]=0x00;
	for(bitno=0;bitno<8;bitno++)
	{
		_nop_();
		delay(1);
		_nop_();
		sck=1;
		delay(1);
		_nop_();
		read();
		sck=0;
	}
}

void sendbit()
{
	mosi=bit1;
	delay(1);
	_nop_();
	sck=1;
	delay(1);
	_nop_();
	sck=0;
}

void sendbyte(unsigned char m)
{
	for(bitno=0;bitno<8;bitno++)
	{
		bit1=m/128;
		m=m<<1;
		sendbit();
	}
}

void main()
{  
	i=0;
	sck=0;
	res=1;
	p2=0;
	count=-1;
	delay(50);

//=======Program enable===========

	a=0xac;
	b=0x53;
	c=0x00;
	d=0x11;
	sendbyte(a);
	sendbyte(b);
	sendbyte(c);
	sendbyte(d);

//==========Read===================
	
	sendbyte(0x28);
	sendbyte(0x00);
	sendbyte(0x00);
	sread();

	sendbyte(0x28);
	sendbyte(0x01);
	sendbyte(0x00);
	sread();

	sendbyte(0x28);
	sendbyte(0x02);
	sendbyte(0x00);
	sread();

//========Display=================
	for(i=0;i<3;i++);
	p2=output[i];
	p2=0xff;
	res=1;
	while(1);
} 


Filed Under: Tutorials
Tagged With: 8051, isp, microcontroller, signature byte read
 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Designing Gate Driver Circuit and Switching Mechanism for Modified Sine Wave Inverter – (Part 9/17)
  • Completing Modified Sine Wave Inverter Design with Full Bridge Circuit and Step Up Transformer – (Part 10/17)
  • Designing an Offline UPS – Part (12 /17)
  • How to reduce Switching Time of a Relay – (Part 15/17)
  • Testing MOSFET – (Part 16/17)
  • Driving High Side MOSFET using Bootstrap Circuitry – (Part 17/17)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Infineon offers DC-DC controller for full LED headlamps without a microcontroller
  • Vishay launches new high-precision, thin-film wraparound chip resistor
  • STMicroelectronics’ common-mode filters ensure signal integrity in serial interfaces
  • Renesas’ RA Family microcontrollers earn CAVP certification for cryptographic algorithms
  • MicroPython: Serial data communication in ESP8266 and ESP32 using UART

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd ldr led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics Research robot samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Looking for miniature shaded pole motors
  • RF switch selection
  • ddr3 sodimm daughter board for haps-80 system
  • 3D FDTD - how do I compute number of variables and required number of iterations?
  • IRF450 MoSFET

RSS Electro-Tech-Online.com Discussions

  • Opamp ciruit
  • DIY Mini 12v Router UPS malfunction
  • How can a 13 bit number represent 16 bit number?Or why is fragmentation offset multiple of 8?
  • Best home PCB printer and software for prototyping?
  • Passthrough charging-simple but impossible to achieve?
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering