Talks

We use the decimal system (base 10) to represent numbers, which uses ten digits, 0 to 9. Numbers can also be represented using a different base. The binary number system uses 2 as the base and the digits are 0 and 1 only. It is possible to represent them using switches having the two states, OPEN and CLOSED. In digital circuits, numbers are represented using a set of electronics switches.

It is also possible to perform arithmetic and logical operations using digital circuits like the AND, NOT and OR gates. For example, you can add two numbers using an adder circuit by feeding the inputs to it. However, for all practical purposes, we need to perform a series of such operations in an ordered manner. This was made possible by the concept of the â€˜Stored Programâ€™ introduced by John von Neumann in the late 1940s. This concept led to the modern digital computers. The arithmetic and logical operations are performed according to the bit patterns (called instructions) stored inside a series of memory locations. The timing of the operations are controlled by a clock signal.

Microprocessor

A transistor switch is a one bit storage element and we can use a set of them to store a binary number. Such an arrangement is also called a Register. A large number of them can be organised as memory elements of different sizes. A Microprocessor consists of

• A set of General Purpose Registers
• An Arithmetic and Logic Unit (ALU)
• A control unit that coordinates the operations according to the input clock signal.

The control circuit fetches Instruction from the external memory to the Registers, executes them using the ALU and stores the results back to the memory. The Registers are used as scratch pads for the temporary storage of data. Other than general purpose temporary storage there are some Registers with specific functions, as described below.

• The Program Counter: The PC contains the memory location from which the instruction or data has to be brought or stored. It is incremented with every instruction and its contents are modified by Jump and Call instructions.

• The Stack Pointer: This Register points to the memory location used as stack. A PUSH instruction stores the contents of some register to the memory location pointed to by the SP and increments the value of SP. A POP instruction retrieves the data and decrements SP.

• The Status Register: The results of the ALU operations sets the various bits of this register, for example the CARRY bit if the result of an addition exceeded the register size.

• The General Purpose Registers: In addition to the special registers mentioned above, there will be a set of general purpose registers. Some processors designate one of these registers as Accumulator, the default destination of the results of an ALU operation.

A microprocessor requires external memory for functioning. Instructions and data are fetched from this external memory and results stored to it. To be useful it should also have Input/output devices connected to it. Simple examples of I/O devices are switches and LEDs. More complex systems may have keyboards or graphical display units.

Memory:

There are many types of memory devices that can be interfaced to a microprocessor. The storage devices like CDs, hard disks etc. are sequential type. Semiconductor memories are of Random Access type, means you can access any memory location by specifying the address of that memory location. This type is further classified into

• Read/Write memory. Even though the word RAM (random Access Memory) is generally used to specify Read/Write memory, locations of ROM also can be accesses in a random fashion.

The read/write memory is further classified into

• Volatile memory. The contents of the volatile memory are lost when power is switched off.
• Non-volatile memory. The contents of non-volatile memory are preserved without power also.

The different types of non-volatile memory are

• ROM
• PROM (programmable ROM)
• EPROM (Erasable PROM)
• UVEPROM (UltraViolet EPROM)
• EEPROM (Electrically Erasable PROM)
• Flash memory. Flash memory is the latest technology providing electrically erasable non-volatile memory.

Microcontroller

Integrating the memory and some peripheral devices to a microprocessor on a single chip results in a microcontroller. They are widely used in electronics instruments like calculators, telephone sets, copying machines, printers etc. A microcontroller has all the components of a microprocessor, like the ALU, control unit and the Registers. In addition to that it also has

• Program memory (Generally Flash memory, that can be written and erased electrically)
• Data memory, that is read/write type
• EEPROM
• Input/Output ports, that are available on the external pins of the microcontroller chip.
• Peripheral devices like Analog to Digital Converter (ADC), DAC, Timer/Counter etc.
• A clock circuit that is used by the processor and the peripheral devices.

AVR family Microcontroller

The AVR series of microcontrollers are very popular and they are used in development systems like Arduino.

• For a detailed description of AVR family of processors refer to this Wikipedia article.

• The Registers and the Instruction set are explained HERE.

Several example programs in Assembler tested on AtMega32 are available HERE.