What Is A Microcontroller Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

As mentioned before, this chapter will discuss information about the microcontroller and the tasks that were related to it. At the beginning of this chapter, the theoretical background about microcontrollers and in particularly PIC16F877 will be presented in details. Next, different tasks related to the microcontroller, plus the problems faced and how they were solved will follow.

Circumstances that we find ourselves in today in the field of microcontrollers had their beginnings in the development of technology of integrated circuits. This development has made it possible to store hundreds of thousands of transistors into one chip. That was a prerequisite for production of microprocessors, and the first computers were made by adding external peripherals such as memory, input-output lines, timers and other. Further increasing of the volume of the package resulted in creation of integrated circuits. These integrated circuits contained both processor and peripherals. That is how the first chip containing a microcomputer, or what would later be known as a microcontroller came about.

What is a Microcontroller?

A microcontroller is a cheap single chip microcomputer. Single-chip microcomputer indicates that the complete microcomputer system lies within the confine of the integrated circuit chip. Microcontrollers are capable of storing and running the program that was written, complied and downloaded into it. The main parts of a microcontroller generally consist of the Central Processing Unit (CPU), Random Access Memory (RAM), Read Only Memory (ROM), input/output lines (I/O lines), serial and parallel ports, timers and other peripherals such as analog to digital (A/D) converter and digital to analog (D/A) converter (see Reference 7 for more details).

Why to use a Microcontroller

Microcontrollers are inexpensive microcomputers. The microcontroller's ability to store and run unique programs makes it very flexible. For example, one can program a microcontroller to perform functions based on predetermined situations (1/0-line logic) and selections. The microcontroller's capability to carry out mathematical and logic functions allows it to imitate complicated logic and electronic circuits. Other programs can make the microcontroller behave like a neural circuit or a fuzzy-logic controller. Microcontrollers are accountable for the "intelligence" in most smart devices on the consumer market. It is usually the brain of any system.

The Output

We can turn on and off many home devices by using mobile phone such as oven, washer, heater, fan …etc (four devices in our project), but for simplicity we use three LEDs to represent 3 devices and we use a recorder as a sample of a real work. For recorder, we use a frame relay to control its operation so the controller will be connected to the frame relay and it will control the operation of the recorder, to see how this operation is done we dedicate a special section for this topic below.

Frame Relay

Relays are electro-magnetically activated switches. Literally, there is an electromagnet inside the relay, and energizing that electromagnet causes the switch to change position by pulling the movable parts of the switch mechanism to a different position. To the greatest extent possible, the electromagnet is made to be electrically isolated from the signal path.

There are two main classes of relays - latching and non-latching. Non-latching relays are the simplest kind.

In a non-latching relay, the electromagnet pulls on a switch that is spring-loaded to one side. Which is called the "normal" or "reset" side? Whenever the electromagnet's coil carries enough current (called the pull-in current), it makes enough ampere-turns of magnetic force to pull the switch to the "energized" or "set" position. The switch stays in the energized position as long as the current in the coil is enough to make the electromagnet overcome the force of the spring. As soon as the current drops below the holding current, the spring pulls the switch back to the non-energized condition. Because of the way magnetic attraction works, it takes less magnetic force - and therefore less current in the coil - to hold the relay set than it did to move it there in the first place, so the holding current is less than the pull-in current.

Figure 3.1: Basic Relays

The no latching relay is shown schematically in the upper left hand comer of the "Relay Basics" illustration. The switch portion of the basic SPDT relay is shown as a switch that consists of a pole which can be switched to one of two throws. The throw that the pole connects to when no current flows in the coil is called the normally closed (NC) throw. The normally open (NO) contact is - well, normally open. A spring holds the switch in this position. The pole and throws are the only signal connections on the relay. The coil is only used to control the relay, not to conduct signal currents.

Power Supply

We know the fact that say no electronic device can operate on voltage supplies by company directly, a conversion must be made before we connect a voltage line to our controller, we use a power supply to convert 220 Vrms AC voltages to 15 Vrms DC value.

Since we need different DC values of voltage we use a regulator to provide us by different voltages (5, 12) V, we construct the power supply by using a full wave bridge rectifier and we place a capacitor on its output to smooth the ripple in the output wave.

Crystal Oscillators

Crystal oscillators are usually, fixed frequency oscillators where stability and accuracy are the primary consideration. For example it's almost impossible to design a stable and accurate LC oscillator for the upper HF and higher frequencies without resorting to some sort of crystal controller.

The internal clock circuit is completed with the addition of an external 3.579545 MHz crystal and is normally connected as shown in Figure below (Single- Ended Input Configuration). However, it is possible to configure several MT8870Ddevices employing only a single oscillator crystal. The oscillator output of the first device in the chain is coupled through a 30 pF capacitor to the oscillator input (OSC1) of the next device. Subsequent devices are connected in a similar fashion. Refer to Figure below, for details. The problems associated with unbalanced loading are not a concern with the arrangement shown, i.e., precision balancing capacitors are not required.

Figure 3.2: internal clock circuit Crystal oscillators

DTMF detector

We present a new, low-complexity DTMF detector that meets the 8-bit Microchip PIC16F84 microcontroller

Figure 3.3: DTMF detector

The MT8870D is a complete DTMF receiver integrating both the band split filter and digital decoder functions. The filter section uses switched capacitor techniques for high and low group filters; the decoder uses digital counting techniques to detect and decode all 16 DTMF tone pairs into a 4-bit code. External component count is minimized by on chip provision of a differential input amplifier, clock oscillator and latched three-state bus interface.


• Complete DTMF Receiver

• Low power consumption

• Internal gain setting amplifier

• Adjustable guard time

• Central office quality

• Power-down mode

• Inhibit mode

• Backward compatible with MT8870C/MT8870C-1


• Receiver system for British Telecom (BT) or (MT8870D).

• Paging systems.

• Repeater systems/mobile radio.

• Credit card systems.

• Remote control.

• Personal computers.

Functional Block Diagram:

Figure 3.4: MT8870D chipset block diagram.

The MT8870Dmonolithic DTMF receiver offers small size, low power consumption and high performance. Its architecture consists of a band split filter section, which separates the high and low group tones, followed by a digital counting section which verifies the frequency and duration of the received tones before passing the corresponding code to the output bus.

Table 3.1: Pin description of DTMF


A keypad is a set of buttons arranged in a block which usually bear digits and other symbols but not a complete set of alphabetical letters. If it mostly contains numbers then it can also be called a numeric keypad. Keypads are found on many alphanumeric keyboards and on other devices such as calculators, combination locks and telephones which require largely numeric input.

A computer keyboard usually contains a small numeric keypad with a calculator-style arrangement of buttons duplicating the numeric and arithmetic keys on the main keyboard to allow efficient entry of numerical data. This keypad is usually positioned on the right side of the keyboard because most people are right handed.

Many laptop computers have special function keys which turn part of the alphabetical keyboard into a numerical keypad as there is insufficient space to allow a separate keypad to be built into the laptop's chassis. Separate plug-in keypads can be purchased.

The (DTMF) keypad is laid out in a 4Ã-4 matrix, with each row representing a low frequency, and each column representing a high frequency. Pressing a single key such as '1' will send a sinusoidal tone of the two frequencies 697 and 1209 Hz. The two tones are the reason for calling it multi-frequency. These tones are then decoded by the switching center in order to determine which key was pressed.

Table 3.2 DTMF keypad frequencies (with sound clips)

1209 Hz

1336 Hz

1477 Hz

1633 Hz

697 Hz





770 Hz





852 Hz





941 Hz





Table 3.3 DTMF Event Frequencies


Low frequency

High frequency

Busy signal

480 Hz

620 Hz

Dial tone

350 Hz

440 Hz

Ring back tone (US)

440 Hz

480 Hz

The tone frequencies, as defined by the Precise Tone Plan, are selected such that harmonics and inter-modulation products will not cause an unreliable signal. No frequency is a multiple of another, the difference between any two frequencies does not equal any of the frequencies, and the sum of any two frequencies does not equal any of the frequencies.

A telephone keypad is a keypad that appears on a "touch tone" telephone, it was standardized when the Dual-tone multi-frequency (DTMF) system was introduced, and replaced the rotary dial as shown Figure 3.5.

Figure 3.5: Rotary dial telephone

The rotary dial is a device mounted on or in a telephone or switchboard that is designed to send interrupted electrical pulses, known as pulse dialing, corresponding to the number dialed. It was invented in 1888 by Almon Strowger. The device was phased out from the 1970s onwards, with the onset of touch tone dialing and which used a telephone keypad instead of a dial.

The keypad is laid out in a (3Ã-4 matrix), with each row representing a low frequency, and each column representing a high frequency. When used to dial a telephone number, pressing a single key such as '1' will send a sinusoidal tone of the two frequencies 697 and 1209 hertz (Hz).

The "*" is called the star or asterisk key. The "#" is called the number sign, pound key or hash key, depending on one's nationality or personal preference.

These can be used for special functions. For example, in the UK, users can order a 7.30am alarm call from a British Telecom telephone exchange by dialing: *55*0730#. Most of the keys also bear letters according to the following system:

0 = none

5 = JKL

1 = none

6 = MNO

2 = ABC

7 = P(Q)RS

3 = DEF

8 = TU

4 = GHI

9 = WXYZ

These letters have had several auxiliary uses. Originally, the letters referred to area codes. In the US in the mid-20th century, numbers were seven digits long including a two-digit prefix, the latter expressed as letters rather than numbers. In the UK telephone numbering system, a similar two-letter code was added after the initial zero to form the first part of the Subscriber trunk dialing code for that region. In recent times, the letters on the keys have found a new use thanks to text messaging on mobile phones. And in our project we used this standard dual tone multi frequency (DTMF) in another field; that we analyze frequencies to use it as a controller to any machine. The figure (3.5) schematic shows how we use the DTMF T8870D (DTMF input, binary output, crystal oscillator (clock)…..etc).