Microcontroller is a development of engineering of incorporate circuits. This development has made it possible to hive away 100s of 1000s of transistors into one bit. In microcontroller, No other external constituents such as memory, or constituents for having and directing informations are needed for its application because all necessary peripherals are already built into it. Therefore, we save the clip and infinite needed to build devices
3.3 Types of microcontrollers
There are different types of micro accountants. Each type has its ain belongingss. In the following an illustration of microcontroller used:
Intel 8051 ( based on 8085 i?p ) .
Microchip PIC Family: 16F84, 16F876, 16F877aˆ¦etc.
Atmel AVR 163.
The first three companies have produced many versions of microcontrollers each version has its ain belongingss and in the same clip its ain monetary value and applications.
3.4 Microcontroller architecture
3.4.1 Memory unit
Memory is portion of the microcontroller whose map is to hive away data.A The easiest manner to explicate it is to depict it as one large cupboard with tonss of shortss. If we suppose that we marked the shortss in such a manner that they can non be confused, any of their contents will so be easy accessible. It is adequate to cognize the appellation of the drawer and so we will cognize its contents for certain, as shown in figure 3.2
Figure ( 3.2 )
Memory Unit of measurement
Memory constituents are precisely like that. For a certain input we get the contents of a certain addressed memory location and that ‘s all. Two new constructs are brought to us: addressing and memory location. Memory consists of all memory locations, and turn toing is nil but choosing one of them. This means that we need to choose the coveted memory location on one manus, and on the other manus we need to wait for the contents of that location. Besides reading from a memory location, memory must besides supply for composing onto it. This is done by providing an extra line called control line. We will denominate this line as R/W ( read/write ) . Control line is used in the undermentioned manner: if r/w=1, reading is done, and if opposite is true so composing is done on the memory location. Memory is the first component, and we need a fewA operation of our microcontroller.
3.4.2 Cardinal treating unit ( CPU )
Let add 3 more memory locations to a specific block that will hold
a built in capableness to multiply, split, deduct, and travel its contents from one memory location onto another. The portion we merely added in is called “ cardinal processing unit ” ( CPU ) . Its memory locations are called registries, as shown in figure 3.3
Figure ( 3.3 ) Central processing unit
Registers are hence memory locations whose function is to assist with executing assorted mathematical operations or any other operations with informations wherever informations can be found. Look at the current state of affairs. We have two independent entities ( memory and CPU ) , which are interconnected, and therefore any exchange of informations is hindered, every bit good as its functionality. If, for illustration, we wish to add the contents of two memory locations and return the consequence once more back to memory, we would necessitate a connexion between memory and CPU. Simply stated, we must hold some “ manner ” through informations goes from one block to another.
That “ manner ” is called “ coach ” . Physically, it represents a group of 8, 16, or more wiresA there are two types of coachs: reference and informations coach. The first one consists of as many lines as the sum of memory we wish to turn to and the other 1 is every bit broad as informations, in our instance 8 spots or the connexion line. First one serves to convey reference from CPU memory, and the 2nd to link all blocks inside the microcontroller, as shown in figure 3.4
Figure ( 3.4 )
Equally far as functionality, the state of affairs has improved, but a new job has besides appeared: we have a unit that ‘s capable of working by itself, but which does non hold any contact with the outside universe, or with us! In order to take this lack, allow ‘s add a block that contains several memory locations whose one terminal is connected to the information coach, and the other has connexion with the end product lines on the microcontroller that can be seenA as pins on the electronic constituent.
3.4.4 Input-output unit
Those locations we ‘ve merely added are called “ ports ” . There are several types of ports: input, end product or bi-directional ports. When working with ports, foremost of all it is necessary to take which port we need to work with, and so to direct informations to, or take it from the port, as shown in fig. 3.5
Figure ( 3.5 )
When working with it the larboard Acts of the Apostless like a memory location. Something is merely being written into or read from it, and it could be noticed on the pins of the microcontroller.
3.4.5 Consecutive communicating:
Beside stated above we ‘ve added to the already bing unit the possibility of communicating with an outside universe. However, this manner of communication has its drawbacks. One of the basic drawbacks is the figure of lines that need to be used in order to reassign informations. What if it is being transferred to a distance of several kilometres? The figure of lines times figure of kilometres does n’t assure the economic system of the undertaking. It leaves us holding to cut down the figure of linesA in such a manner that we do n’t decrease its functionality. Suppose we are working with three lines merely, and that one line is used for directing informations, other for having, and the 3rd one is used as a mention line for both the input and the end product side. In order for this to work, we need to put the regulations of exchange of informations. These regulations are called protocol. Protocol is hence defined in progress so at that place would n’t be any misinterpretation between the sides that are pass oning with each other.
For illustration, if one adult male is talking in French, and the other in English, it is extremely improbable that they will rapidly and efficaciously understand each other. Let ‘s suppose we have the undermentioned protocol. The logical unit “ 1 ” is set up on the conveying line until transportation Begins. Once the transportation starts, we lower the transmittal line to logical “ 0 ” for a period of clip ( which we will denominate as T ) , so the having side will cognize that it is having informations, and so it will trip its mechanism for response. Let ‘s travel back now to the transmittal side and get down seting logic nothings and 1s onto the sender line in the order from a spot of the lowest value to a spot of the highest value. Let each spot stay on line for a clip period which is equal to T, and in the terminal, or after the 8th spot, allow us convey the logical unit “ 1 ” back on the line which will tag the terminal of the transmittal of one information.
A The protocol we ‘ve merely described is called in professional literature NRZ ( Non-Return to Zero ) , as shown in figure 3.6
Figure ( 3.6 )
Consecutive Unit of measurement
As we have separate lines for having and directing, it is possible to have and direct informations ( info. ) at the same clip. Alleged full-duplex manner block that enables this manner of communicating is called a consecutive communicating block. Unlike the parallel transmittal, information moves here bit by spot, or in a series of spots what defines the term consecutive communicating comes from.
After the response of information we need to read it from the having location and shop it in memory as opposed to directing where the procedure is reversed. Data goes from memory through the coach to the directing location, andA so to the receiving unit harmonizing to the protocol.
3.5 RF-ID reader
The ID2. ID12 and ID20 are similar to the disused ID0, ID10 and ID15 MK ( two ) series devices, but they have excess pins that allow Magnetic Emulation end product to be included
in the functionality. The ID-12 and ID-20 semen with internal aerials, and have read scopes of 12+ centimeters and 16+ centimeter, severally. With an external aerial, the ID-2
can present read scopes of up to 25 centimeter. All three readers support ASCII, Wiegand26 and Magnetic ABA Track2 information formats.
FIGURE 3.7 RF READER PINOUT
3.6 LCD ( liquid crystal show )
A liquid crystal show ( LCD ) is a thin, level show device made up of any figure of colour or monochrome pels arrayed in forepart of a light beginning or reflector. It is frequently utilised in battery-powered electronic devices because it uses really little sums of electric power
Figure ( 3.8 )
Although the LCD faculty informations sheet specify a 5V DC supply, supplies of 6V and 4.5V both work good,
The undermentioned figure shows the pinout map for all local types
( LCD Pinout )
-pin3 is a control pin, Vee which is used to change the contrast of the show ideally this pin should be connected to a variable supply
-pin4 is the registry select ( R.S ) line. The first of the three bid control inputs, when this line is low, informations bytes transferred to the show are treated as bids and by puting the R.S line high, character informations can be transferred to the faculty.
-pin5 is the readwrite ( RW ) line, this line is pulled low in order to compose bid or character informations to the faculty,
-pin6 is the enable ( E ) line, this input is used to originate the existent transportation of bids or character informations between faculty and the information lines when composing to the show, information is transferred merely on the high to low passage of the signal.
Pins7-14 are the eight coach lines ( D0-D7 ) informations can be transferred to and from the show either as individual 8-bit byte or as two 4-bit ( nybbles ) in the ulterior instance merely the upper four information lines ( D4-D7 ) are used, This 4-bit manner is good when utilizing a microcontroller as a fewer inputoutput lines are required.
In order for the LCD to work good it needs to be initialized foremost, to initialise the LCD we foremost put logic low on the ( RS ) pin so fed it with the appropriate initializing codification
Figure shows the bid control codes that should be used to initialise the LCD
Figure ( 3.10 )
( LCD bid )
Since we want to salvage the inputoutput pins of the microcontroller we will utilize the four-bit manner, in this manner we send each byte that represent the ASCII codification into two portion ( 4-bit each ) .
3.7 motor driver
Brushed DC motor is one of the earliest motor designs. Today, it is the motor of pick in the bulk of variable velocity and torsion control applications.
Easy to understand design
Easy to command velocity
Easy to command torsion
Simple, inexpensive thrust design
The design of the brushed DC motor is rather simple. A lasting magnetic field is created in the stator by either of two agencies:
Simple, inexpensive thrust design
The consequence of this design is that variable velocity or variable torsion electronics are easy to plan and industry. Changing the velocity of a brushed DC motor requires little more than a big adequate potentiometer. In pattern, these have been replaced for all but sub-fractional HP applications by the SCR and PWM thrusts, which offer comparatively exactly control electromotive force and current. Common DC thrusts are available at the low terminal ( up to 2 HP ) for under US $ 100 — and sometimes under US $ 50 if preciseness is non of import.
Large DC thrusts are available up to 100s of HP. However, over about 10 HP careful consideration should be given to the price/performance trade-offs with AC inverter systems, since the AC systems show a monetary value advantage in the larger systems. ( But they may non be capable of the application ‘s public presentation requirments ) .
Expensive to bring forth
Ca n’t faithfully command at lowest velocities
Driving circuit ( H-bridge )
First PIC accountant can non drive a motor straight, since it can non provide adequate current. Alternatively, there must be some interface circuitry so that the motor power is supplied from another power beginning and merely the control signals derive from the PIC. This interface circuitry can be implemented by a circuit known as the H-bridge. Besides to command motor way, merely command the way of current fluxing through it, so by utilizing the H-bridge we are able to command the motor in both frontward and change by reversal by commanding the current way. An H-bridge simply consists of 4 switches connected in topology of an H, where the motor terminuss form the crossbar of the H. The diagram below shows an H-bridge circuit.
Figure 3.11 H-bridge.
In an H-bridge, the switches are opened and closed in a mode so as to set a electromotive force of one mutual opposition across the motor for current to flux through it in one way or a electromotive force of the opposite mutual opposition, doing current to flux through the motor in the opposite way for rearward way. In the circuit shown on the right, if switches S1 and S4 are closed while switches S2 and S3 are unfastened, current will flux from left to compensate in the motor, or in other words, positive electromotive force across the terminuss. When switches S2 and S3 are closed and switches S1 and S4 are unfastened, current will flux from right to go forth, change by reversaling the electromotive force mutual opposition. If the terminuss of the motor are unfastened, the motor will drift ( vicous braking ) and if the terminuss are short circuited, the motor will brake ( dynamic brake ) .
These switches can be either relays or semiconductor devices such as transistors ( BJT or FET ) .
Using mechanical switches ( relays ) is easy, but it is slow, and it is hard or impossible to interface with a sophisticated accountant. Modern motor accountants do this much better by utilizing power transistors alternatively of switches. The transistors can be distinct parts, or they can all be built onto one big IC.
And after understanding the h-bridge we decided to acquire it as an IC ( l293D ) that will take the signal from the microcontroller as TTL degree so drive the motor,
Figure below shows how precisely we connected the driver to the microcontroller
Figure 3.12 driver connexion
3.8 consecutive interfaces
In telecommunications, RS-232 ( Recommended Standard 232 ) is a criterion for consecutive binary informations signals linking between a DTE ( Data terminal equipment ) and a DCE ( Data Circuit-terminating Equipment ) . It is normally used in computing machine series ports. A similar ITU-T criterion is V.24.
Figure ( 3.12 )
The RS-232 criterion defines the electromotive force degrees that correspond to logical one and logical nothing degrees. Valid signals are plus or minus 3 to 15 Vs. The scope near nothing Vs is non a valid RS-232 degree ; logic one is defined as a negative electromotive force, the signal status is called marker, and has the functional significance of OFF. Logic nothing is positive, the signal status is spacing, and has the map ON. The standard specifies a maximal open-circuit electromotive force of 25 Vs ; signal degrees of A±5 V, A±10 V, A±12 V, and A±15 V are all normally seen depending on the power supplies available within a device. RS-232 drivers and receiving systems must be able to defy indefinite short circuit to land or to any electromotive force degree up to +/-25 Vs. The batch rate, or how fast the signal alterations between degrees, is besides controlled.
Because the electromotive force degrees are higher than logic degrees used by incorporate circuits, particular step ining circuits are required to interpret logic degrees, and to protect circuitry internal to the device from short circuits or transients that may look on the RS-232 interface.
Because both terminals of the RS-232 circuit depend on the land pin being zero Vs, jobs will happen when linking machinery and computing machines where the electromotive force between the land pin on one terminal, and the land pin on the other is non zero. This may besides do a risky land cringle.