burning the microcontroller

Thread Starter

ash007sun

Joined May 18, 2012
2
Hi all,

I could use some help from you guys to know some small facts about burning the code into microcontroller. I just can't understand the whole idea of that. I mean, what happens when the hex codes are dumped into the program memory of the controller? How could the controller understand that a particular hex code stands for an instruction? And also, like what are the conditions (which is done by the burner kit) in which the pins has to be when we need to send in the codes to the controller in order to program it?

Thanks..
 

MrChips

Joined Oct 2, 2009
35,093
Hi all,

I could use some help from you guys to know some small facts about burning the code into microcontroller. I just can't understand the whole idea of that. I mean, what happens when the hex codes are dumped into the program memory of the controller?
Hex codes are simply a sequence of 0s and 1s.
A byte, the most common format used, consists of combinations of eight 0s or 1s.
A single byte gets stored into one byte of MCU memory.

How could the controller understand that a particular hex code stands for an instruction?
The MCU does not know the difference between an instruction or data.
Instructions are commands to the MCU. Data is information to be used by the program. The flow of program execution is controlled by a register called the Program Counter (PC). The PC tells the MCU the location of the instruction to executed next. Your program has to make sure the PC never ventures on to data otherwise the MCU will treat it as an instruction and will execute it as if it were instruction. This will cause your application to crash.

And also, like what are the conditions (which is done by the burner kit) in which the pins has to be when we need to send in the codes to the controller in order to program it?
This is determined by the manufacturer of the MCU. Each MCU has its particular style of programming. Various schemes have been used by different manufacturers:

  • Parallel Port
  • Serial Port SCI (Serial Communications Interface), UART, RS-232, etc.
  • SPI (Serial Peripheral Interface)
  • One-wire, BDM (Background Debug Mode)
  • ISP (In-System Programming) or ICSP (In-Circuit System Programming)
  • JTAG (Joint Test Action Group)
 

cravenhaven

Joined Nov 17, 2011
34
Think of the hex codes in a similar way to which we understand the old morse code, or deaf people understand sign language etc. It is just a code that the designers of the chip have defined to mean something. On power up the MCU grabs the first byte it encounters and ASSUMES that it is an instruction, presents it to the core instruction unit, the instruction unit decodes it and does whatever its been designed to do. If the programmer had inadvertently put data into the first memory location (normally location 0,but sometimes $FFFF depending on CPU) then the CPU would try to interpret it as an instruction and do whatever it was supposed to.
 

Thread Starter

ash007sun

Joined May 18, 2012
2
@ MrChips and @cravenhaven,

Thank you for your reply.
I have one more doubt. I need to generate simultaneously a train of 1.5ms pulses for about 2 sec and a train of 2 ms pulses for another 2 sec. I could do it by using the timers. But will it be possible to generate these pulses simultaneously by using AT89C51? I mean can we do some sort of time division multiplexing or something else? If not, then which microcontroller could be used for this purpose?
Please help..

Thanks...
 
Top