Hi Every one....After My lots of experiments with a little monster called microcontroller, i would like to share my practical experience and knowledge to help you out with,how to use microcontrollers to incorporate intelligence in electronics systems automation.Before going in to the detailed Description of microcontrollers,I just give you a breif introduction.
Basically a microcontroller is a microprocessor with on chip RAM,ROM,I/O ports...etc.
A microcontroller provides intelligence to any system.
suppose that an air conditioning(a.c) system is that with a microcontroller inside,provides intelligence to it.like sensing the outside temperature,if temperature is high then increase the cooling from a.c and if outside temperature is cool then decrease the cooling of the a.c.
There are several types of microcontrollers used in practice but 3 types are very famous and easy to work with!!
what for this microcontrollers are??
Human uses his intelligence to a accomplish any task.lets take a simple example..suppose the task is to ON or OFF the water pump motor when the tank is empty or full respectively.The same task can be made automated without humans intervention.this is possible if an electronic system can capture the intelligence of human in the form of a program.this is what exactly a microcontroller does.
Microcontroller is a digital device it knows only machine language(low level language) that is zeros and ones(0 s,1s).
and what we know is a a simple 'c' programming language(high level language) in which we can give instructions and Microcontrollers cannot directly understand that.so we have to bridge both the human and microcontroller.so here is how to proceed!!!!!!!!!
so this is overveiw of how to provide intelligence in the microcontrollers with the instructions given by the human.
usully we write a program in our PC and then connect the microcontroller to the computers serial port(com1) or parallelport(lpt1).and then flash the program into the target microcontroller.The program in the form of bits is stored in the EEPROM(flash memory).
a microcontroller can be reprogrammed some 10,000 times.
so the tools required are .................
HARDWARE:
In order to connect the microcontroller with the PC to Flash the program in to the microcontroller we need an interface.
The microcontroller can be programmed in two methods
1.using serial port of PC(DB-9).
2.using parallel port of PC(DB-25).
SOFTWARE:
1.cross compiler
eg:KEIL for 8051 and WINAVR for AVR microcontrollers.
2.isp burner program
eg: isp pgm for 8051 and pony prog for AVR microcontrollers.
HOW THE CODE is EXECUTED IN MICROCONTROLLER:A cross compiler to covert 'C" code in to HEX code and a ISP BURNER program to convert the HEX code in to BITS(0s and 1s).
eg: 1. c=b // assigning value of 'b' to 'c'. in 'c' programming.
(cross compilr converts a c program toHEX(assembly) so now the instruction is converted as shown below)
2. MOV c,b //moving value of 'b' to 'c'. in HEX.
MOV is a mnemonic(user convinience) in HEX it is equivalent to E590h.
here E5 is a machine code for move in to accumlator from specific memory location and 90h the address for 'b' together those two bytes make up an instruction.
(A burner converts a HEX content to BITS(0s and 1s) as shown below)
3. E590h
now writing bit equivalent to the HEX instruction.
E------->1110
5------->0101
9------->1001
0------->0000
so the final BIT instruction that a microcontroller can understand is "1110010110010000" is sent to the UART(inside microcontroller) in the serial format by the computer so the bits are then converted parallelly by UART and executed as instruction by CPU of microcontroller.
And thats all for today..hope you liked it.
IN NEXT tutorials we discuss each microcontroller programming and flashing the program in to microcontroller in detail....:)
Feel free to post your comments and doubts, i will be waiting for them!!!!!!!!!
for any help mail me at electronicsmadeeasy.eme@gmail.com
---->Happy Learning<----
Thank you..:)
0 comments:
Post a Comment