Chip programmer
Chipprogrammer is a blog for
introducing programming techniques for microcontroller and microprocessor which
is common for academia of different countries. This blog is created to discuss
programming techniques of Microprocessors and microcontrollers like 8085
microprocessor, 8051 microcontroller, Atmel AT-MEGA 32 AVR etc.. I strongly
believes that this blog will helpful for novice to professional.
A microprocessor or microcontroller is a
programmable device takes number, performs arithmetic or logic operation
according to the program stored in memory and produces result. But both of them
have some dissimilarities as discussed below;
· Internal Memory: A microprocessor requires an external memory for program/data storage. Instruction execution requires movement if data from the external memory to microprocessor or vice versa. A microcontroller has required on-chip memory associated with peripherals.
· Availability of Ports:Microcontroller consist ofI/O ports so that any peripherals can be interfaced to it. Microprocessor needs interfacing the peripheral devices.
· Clock Speed:Microcontroller s are also called embedded controllers. A microcontroller clock speed is limited only a few tens of MHz. Microcontrollers are numerous and many of them are application specific. Usually, microprocessors have good computing power and they have higher clock speed to facilitate faster computation.
· Built in Features:Most of the microcontrollers have built in Features like Analog to Digital Converter(ADC), Timers, Serial communication ports, counters, Digital to Analog Converter(DAC), Watch Dog Timers(WDT), Real Time Clocks(RTC), Comparators, Pulse Width Modulation(PWM), etc. Almost all these applications available in new generation microcontrollers. In Microprocessors these features are not icluded due to the unavailability of Ports.
· Stand Alone Operations:A microcontroller does not require much additional interfacing ICs for operation and it functions as a stand alone system. It requires just a clock and only a power supply. A microcontroller can be thought of a microprocessor with inbuilt peripherals. A microprocessor needs to be interfaced with associated peripherals for its operation.
· Use:Microprocessors are primarily used for computational purpose, where as microcontrollers find wide application in devices needing real time processing or control. Application of microcontrollers are numerous, starting from domestic applications such as in washing machines, TVs, air conditioners. Microcontrollers are also used in automobiles, process control industries, cell phones, electrical drives, robotics and in space applications.
Harvard and von Neumann architectures
Every microprocessor must have memory space to store program (code) and data. While code provides instructions to the CPU, the data provides the information to be processed. The CPU uses buses (wire traces) to access the code ROM and data RAM memory spaces. The early computers used the same bus for access- ing both the code and data. Such an architecture is commonly referred to as Von Neumann (Princeton) architecture. That means for von Neumann computers, theprocess of accessing the code or data could cause them to get in each other's way and slow down the processing speed of the CPU, because each had to wait for theother to finish fetching. TO speed up the process Of program execution, some CPUs use what is called Harvard architecture. In Harvard architecture, we have separate buses for the code and data memory. See figure shown below. That means that we needfour sets of buses: (1) a set of data buses for carrying data into and out of the CPU, (2) a set of address buses for accessing the data, (3) a set of data buses for carrying code into the CPU, and (4) an address bus for accessing the code. See figure shown. This is easy to implement inside an IC chip such as a microcontroller where both ROM code and data RAM are internal (on-chip) and distances are on the micron and millimeter scale. But implementing Harvard architecture for systems such as x86 IBM PC-type computers is very expensive because the RAM and ROM that hold code and data are extemal to the CPU. Separate wire traces for data and code on the motherboard will make the board large and expensive, For example, for a Pentium microprocessor with a 64-bit data bus and a 32-bit address bus we will need about 100 wire traces on the motherboard if it is von Neumann architecture (96 for address and data, plus a few others for control signals of read andwrite and so on). But the number of wire traces will double to 200 if we use Harvard architecture. Harvard architecture will also necessitate a large number of pins coming out of the microprocessor itself. For this reason you do not see Harvard architecture implemented in the world of PCs and workstations. This is also the reason that microcontrollers such as AVR use Harvard architecture internally, but they still use von Neumann architecture if they need external memory for code and data space. The von Neumann architecture was developed at Princeton University, while the Harvard architecture was the work of Harvard University.