Best books for 8051 microcontroller

By With No comments:
Many of the students out there who already know about 8051 controllers will be surprised to see this book ranked as #1 over the top of Mazidi and Ayala 🙂 I will say this is one of the best books to get started with 8051 micro controller. The author Subrata Ghoshal has done an amazing job with this book that any layman can get a great idea about micro controllers and its working. You only need to have an idea of the basic stuffs in electronics to follow this book.

The 8051 Microcontroller and Embedded Systems using Assembly and C -by Muhammad Ali Mazidi

The book I recommend here is the second edition from the author trios – Muhammad Ali Mazidi, Rolin Mckinlay and Janice Gillispie Mazidi. For years this book enjoyed a great popularity among students (through first edition without C programming) and 8051 enthusiasts. Still this book is one of the most popular books out there on 8051 and the authors are renowned world wide. The single reason I ranked book of Subrata Ghoshal above this one is “easier understanding”. Ghoshal has been successful in developing his book in the most “easy to read and grasp” format.
I suggest you buy this book too along with the book of Subrata Ghoshal, as this book by Mazidi focuses on C programming of 8051 along with assembly language. As a student you really need to know program 8051 using embedded C language. In the initial phases of your learning curve, assembly language is enough for writing programs (and you should start learning 8051 software by writing in assembly language as it helps you to understand concepts better). But when it comes to advanced software development for 8051, the “embedded C” will be more handy. The reason is, its is more easy to program using C language than using assembly language. It can save your time and makes possible efficient coding!

Why can't we program 8085 using C just like we program 8051?

By With No comments:
You can.
Whether it is 8085 or 8086 or 8051 the processor only understands machine language. Programming in C or any high level language will need a compiler. Since your development station (your PC where you will be writing the program) is not running on the target processor (8085 etc) you will need a cross compiler for it. You are programming in C for your 8051 applications using a cross compiler, linker and loader (or all three bundled in a IDE). Similarly you will need one for 8085 also.

Now 8051 is a micro-controller and is used in many industrial applications, hence its cross-compiler and developement systems are easily available. Wherease 8085 is mainly used only in colleges to introduce students to microprocessors. Here the stress in on assembly language programming so that one understands the concepts (memory org, instruction cycle etc), hence cross assemblers are available easily while cross compilers (for 'c' etc) are not.

Microcontrollers: What pins are used to upload a program to a 8051 IC?

By With No comments:
You need total four pins of the 8051 (P89V51RD2). viz RESET, TxD, RxD, GND
(of course IC should be properly powered).
Connect RxD of serial port of computer to TxD of 8051, TxD of serial port of computer to RxD of 8051, DTR of serial port of computer to RST pin of 8051 (all through RS232 interface only). Ground pins of both should be shorted.

The basic need of P89V51RD2 to be programmed serially is that, when you click on "start" button in flash magic, the controller should be RESET. So, when you click on "start" button in flash magic, it sends the reset signal on DTR (Data Terminal Ready) pin. So, connecting DTR to RST pin through RS232 converter will serve the purpose.

Is c knowledge necessary for 8051?

By With No comments:
 This the simplest Microcontroller to start learning C programming on Embedded Systems. But you need not be a master in C. If you know few things like
                   Declaration, Assignment, Statements and Decision Making.
          Start with simple program. But practice every day.
Conclusion : Today's Embedded world C is necessary for 8051.

No. C knowledge is not necessary for 8051. 
However one needs to know assembly level programming for 8051 which is very tough as implementing your logic in assembly can be tricky sometimes.
Hence many people choose to write a c program in a compiler/assembler which converts the program to assembly/machine level code.
however efficiency is much more in assembly programs.

Why don't the transformers work with a dc supply?

By With No comments:
A transformer is based on a very simple fact about electricity: when a fluctuating electric current flows through a wire, it generates a magnetic field (an invisible pattern of magnetism) or "magnetic flux" all around it. The strength of the magnetism (which has the rather technical name of magnetic flux density) is directly related to the size of the electric current. So the bigger the current, the stronger the magnetic field.
Now there's another interesting fact about electricity too. When a magnetic field fluctuates around a piece of wire, it generates an electric current in the wire. So if we put a second coil of wire next to the first one, and send a fluctuating electric current into the first coil, we will create an electric current in the second wire. The current in the first coil is usually called the primary current and the current in the second wire is (surprise, surprise) the secondary current. What we've done here is pass an electric current through empty space from one coil of wire to another. This is called electromagnetic induction because the current in the first coil causes (or "induces") a current in the second coil. We can make electrical energy pass more efficiently from one coil to the other by wrapping them around a soft iron bar (sometimes called a core).

As we came to know that the transformer works with changing in flux with out any change in physical parts (i.e, we can say the transformer is a static device). So, to provide this fluctuating current it only possible with ALTERNATING CURRENT (A.C) because for A.C we have frequency. But in D.C we don't have frequency so the steady current constantly flows in the same direction so we can't get fluctuating electric field. That is why TRANSFORMERS DON'T WORK ON DC.

Embedded Computer Systems

By With 1 comment:
An embedded system is a special-purpose system in which the computer is completely encapsulated by the device it controls. Unlike a general-purpose computer, such as a personal computer, an embedded system performs pre-defined tasks, usually with very specific requirements. Since the system is dedicated to a specific task, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass-produced, so the cost savings may be multiplied by millions of items.

Some examples of embedded systems include ATMs, cell phones, printers, thermostats, calculators, and videogame consoles. Handheld computers or PDAs are also considered embedded devices because of the nature of their hardware design, even though they are more expandable in software terms. This line of definition continues to blur as devices expand.
Embedded Computer Systems
Embedded Computer Systems
The field of embedded system research is rich with potential because it combines two factors. First, the system designer usually has control over both the hardware design and the software design, unlike general-purpose computing. Second, embedded systems are built upon a wide range of disciplines, including computer architecture (processor architecture and microarchitecture, memory system design), compiler, scheduler/operating system, and real-time systems. Combining these two factors means that barriers between these fields can be broken down, enabling synergy between multiple fields and resulting in optimizations which are greater than the sum of their parts.
One challenge with embedded systems is delivering predictably good performance. Many embedded systems (e.g. anti-lock brakes in a car) have real-time requirements; if computations are not completed before a deadline, the system will fail, possibly injuring the user. Unfortunately, many of the performance enhanceming features which make personal computers so fast also make it difficult to predict their performance accurately. Such features include pipelined and out-of-order instruction execution in the processor, and caches in the memory system. Hence the challenge for real-time system researchers is to develop approaches to design fast systems with easily predicted performance, or to more accurately measure existing complex but fast systems.
Embedded Computer would be a chip on which RAM, I/O bus, Data bus, Memory, ROM etc, are built in.

Beagle Bone, Raspberry Pi are the examples.

What is embedded software?

By With No comments:

What is embedded software? is most asked question now days. Most of Electronics  engineers don't know  What is embedded software? There no perfect answer for What is embedded software? here we had tried to answer What is embedded software?

Embedded Software is a specialized software written for devices or machines which are not fully considered as computers. Example of embedded software are process and plant control, airplane systems, rockets etc. These machines or devices typically has operating system which is called Real Time Operating system.
What is embedded software?

What is embedded software?

It's usually low level programming using C, C++, and assembly. They should have knowledge of these languages, memory management, threads, and know a bit about hardware such as circuit design.

some salient features of the 8051 microcontroller

By With No comments:
  • On-chip RAM: Random access memory of 128 byte is used for data storage in 8051. RAM as a non-volatile memory consists of register banks, stacks for temporary data storage and some special function registers.
  • On-chip ROM: 8051 consists of 4KB ROM for program storage. ROM as a volatile memory helps in permanent data storage.
  • Timers and Counters: Timer helps in providing delay between the events. In 8051, there are two timer pins T0, T1. If these pins are used in the counter mode, we can count the external pulses. In T0, it is possible to store 16 bit data. This is done by storing the lower 8 bit in TL0 and the upper 8 bit in TH0. Similarly, we can store 16 bit data in T1 also. TMOD and TCON helps in the timer operation.
  • Serial Port: Inorder, to perform the serial communication, TXD and RXD pins are used. TXD pin is used for transmitting the serial data and the RXD pin is used for the transmission of the data. SCON register is used to control the operation of the serial communication.
  • Input and Output Ports: P0, P1. P2. P3 form the four ports of 8051 microcontroller. Each of the port is 8 bit wide. Port P0 is used as a Lower Order Address bus. Port P2 can be used as I/O port and higher order bus A8 to A15. Port P3 can be used as I/O pin and each pin of port 3 has special functions.
  • Oscillator – This is used to provide clock to the 8051 microcontroller. The crystal frequency can vary from 4MHz to 30MHz.
  • Interrupts - Interrupts are requests which are used to handle special events or routines known as Interrupt Service Routines. INT0 and INT1 are the basic interrupt pins used in 8051.
  • Arithmetic Logic Unit - This unit is used for arithmetic calculations.
  • Accumulator (A register) – This register is used for arithmetic operations.
  • B register – This is an 8bit register that is bit addressable and is used for two instructions only like MUL AB and DIV AB.
  • Program Counter – is a 16 bit register that helps to access address from 0000H to FFFFH. Program Counter is used to address the next instruction to be executed from the ROM.
  • Flag Bits and PSW register – The flag bits are used to indicate the arithmetic condition of the ACC. Program Status Word (PSW) is the flag resister in 8051. This register consists of four flags like Carry, Auxiliary Carry Flag, Register Select 1, Register Select 0, Parity Flag, Overflow flag.
  1. Parity Flag (P) – If the accumulator registers consists of odd number of 1’s, then the parity flag will be set to 1. While, if the accumulator register consists of even number of 0’s, then the parity flag will be 0.
  2. Carry Flag (CY) – This flag is set when there is a carry out from the D7 bit.
  3. Auxiliary Carry (AC) – If there is a carry out after addition or subtraction operation from D4 bit, then the AC is set. Otherwise, AC is cleared.
  4. Overflow Flag (OV) – This flag is set when the result of the signed operation is very big.
  5. Register Select (RS1 and RS0) – They are used to change the bank registers.

Is 8051 worth studying now?

By With No comments:

First one have to spearate peripherals from CPU, you can put simple peripherals around an 8051 and extremely complex ones around a Cortex-M4 and vica versa. Selecting a device with simple peripherals should be part of the criteria when selecting a part to use for an intro training (Save the bluetooth, RF, USB ++ peripherals for the later courses). 

The 8051 is an old single accumulator CPU and it is outdated in regards to both performance and power consumption. The only adoption we see of it today is people who have large code bases and do not have the resources to port it to new micros, i.e. there is hardly any new code developed on 80561 compared to AVR, STM8, MSP430 and PICs. 

I would think that one would be better of by using an AVR (like fabLab is doing as well as Arduino), PICs or MSP430. These are still releatively simple architectures that all can connect to DMAs and different memory structures and work very well as a platform to learn the basics of computer architecture. If you learn a bit about all of them you can also see benefits of a linear address map vs paging etc. 
In short i would suggest a modern 8/16 bit architecture because:
- Still simple enough to use for your first projects
- Used in multiple industries today, so what you learn in school is 1-to-1 to what is expected from you when you start working
- Made for C.

What are the differences in detail between ATmega 16 and 8051 microcontroller, which of these two is better?

By With No comments:
Both are micro-controllers so fundamentally they both are same. But what makes them differ is how and for what you want to use them.

8051, is a very good micro-controller to learn mainstream embedded systems(or at least what they teach in colleges),It is powerful enough to run most of your projects.There are now a days there are advanced variants(S8051XC3 ).

But on comparing the original 8051(or even better AT89C51RD2,which is optimized for faster code execution in X2 mode) with Atmega16, Atmega16 is all about high speed prototyping and getting your project running is most simplest and fastest way with least possible part count.

Atmega16 wins on many accounts:

  • With Atmega16 you can get your project up and running in least possible time with minimum part count,whereas with 8051 you at the very start will have to deal with pull-up resistors and such components that are required by 8051 to at least  run properly in the first place.
  • Atmega16 has better RISC instruction set ,most of them being single cycle execution thus faster code execution,while 8051 still supports slower CISC which require multiple machine cycles for execution.
  • Atmega16 has loads of on-chip  peripherals like timers(both 8 and 16 bits),8-channel 10 bit ADCs,I2C bus,SPI bus,UART interface,watchdog timer,whereas original 8051 only has 2 timers plus UART and better variants like RD2 only has SPI added.
  • Atmega16 has higher code memory and RAM as compare to 8051.
  • Atmega16 is simple to program and supporting programming hardware is also easy to learn and use.
And not only Atmega16 but whole AVR series scores well above 8051 family(Look I am not here to take sides but there exists an 8051 variant C8051F120 that pisses all over  Atmega16 in terms of speed and peripheral count.)

The ATmega16 hardware differs in many respects from the 8051, but in some cases it's an easy replacement. Some of the earlier AVRs, the AT90S8515 for example, were pin compatible with the 8051, and for them it was a drop-in replacement, the only differences being the polarity of the RESET and that PORT0 (PORTA on the AVR) wasn't open collector. It is not difficult to convert software. C programs can be recompiled with few changes, and assembler programs can be translated line by line once you have a little knowledge of the architectural differences.

One big difference is the AVR is much faster. It executes most instructions in a single clock cycle, as against 12 for a standard 8051 or 6 for one of the high speed variants. If you're converting an existing project, it's really important to take this into account, or all the timing will be wrong. Further, AVRs have an internal calibrated clock option, so in many cases you don't need a crystal and gain two extra port pins.

8051 can address external memory, and also execute from it. Some AVRs can address external RAM (the mega16 is not one of them) but no AVR can execute code from external memory. AVRs (mostly) have a lot more internal RAM than 8051, and a real stack and stack pointer. They have 32 registers, each of which behaves like the 8051's accumulator, ie can be the destination for an arithmetic operation. They have three 16 bit pointer registers. A lot of this doesn't matter if you program in C because you're abstracted from the hardware, but you will certainly notice the edge in code size and performance.

Oh, and you can get an in circuit emulator for about $50. Does one even exist for the 8051?