Date post: | 04-Apr-2018 |
Category: |
Documents |
Upload: | badur-shakeal |
View: | 230 times |
Download: | 0 times |
of 30
7/30/2019 A202SE Microcomputer System Coursework
1/30
AUSTONINSTITUTE OF MANAGEMENT CEYLON
Faculty of Engineering
Advanced Diploma in Electrical and Electronics
Engineering
A202SE Micro Computer System
Coursework
Student Name: M. Badurdeen Shakeal
Student ID: T1-11-EEE-L2-86
Supervisor: Mr. Roshan Weerasuriya
Submission Date: 2012.05.28
7/30/2019 A202SE Microcomputer System Coursework
2/30
A202SE
PROJECT/ASSGNMENT SUBMISSION ACKNOWLEDGEMENT SLIP
Name of Student: M.BADURDEEN SHAKEAL Student No: 260211/76 T1-11-EEE-L2-86
Home Address: No.2/154, Sejiah Region, Panavitiya, Deekirikewa, 60123, Sri Lanka
Date of Submission: 2012 may 28th Name of Tutor: Mr. Roshan Weerasuriya
Program/ Module: A202SE (Microcomputer Systems)
Received By: _________________________ Date: ___________________________________
Individual Projects (30%)
Coursework1 :Design based C/C++Interfacing Assignment
Marks
Learning Outcome Weightage
1stmarker
2nd
marker/moderat
or
Finalmark
Design and implement software programsfor microprocessors using C/C++specification and design flow.2. Use interfacing methods to enablemicroprocessors to communicate with anexternal hardware system.3. Use modern Integrated DevelopmentEnvironments to support the design flow.
Q1:
Functional operation of an ALU
Design for Logic Extender (LE) Unit
Design for Arithmetic Extender (AE)unit
Design for Carry Extender (CE) Unit
Resultant ALU system
Discussion
Q2:
Principles of a DC motor, itsapplications and control techniques
Interfacing techniques/ designcalculations
Flow chart for motor controlprogram
C/C++ Programmming
Simulation with IDE
Analysis/ Discussion on results
Conclusion
40%
4%11%9%7%5%4%
50%
6%7%6%
10%10%7%4%
Page 2
7/30/2019 A202SE Microcomputer System Coursework
3/30
A202SE
Quality and structure of the report 10%
Total Marks 100%
1st markers comment
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
2nd markers/ moderator comment
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
Page 3
7/30/2019 A202SE Microcomputer System Coursework
4/30
A202SE
Table of Contents
1. Abstract. 02
2. Introduction.. 03
3. Literature Review
3.1. Functional operation of an ALU... 03
3.2. Principle of operation of DC motor and its applications... 04
3.3. Principle of DC motor control... 07
3.4. PIC microcontrollers and development system. 10
4. Design Criteria
4.1. Design calculation for major components of ALU system
4.1.1. Design for logic extender (LE)...... 12
4.1.2. Design for arithmetic extender (AE). 14
4.1.3. Design for carry extender (CE)..15
4.1.4. Resultant ALU System.. 16
4.2. Necessary interfacing techniques for DC motor control...
11
4.3. Necessary design calculation for DC motor control..
12
5. Software implementation
5.1. Flow chart for DC motor control program.....
17
5.2. C/C++ program implementation
18
5.3. Simulation with integrated development environment (IDE)...
19
Page 4
7/30/2019 A202SE Microcomputer System Coursework
5/30
A202SE
6. Critical analysis
6.1. Investigation of different inputs criteria
22
6.2. Discussions and comparisons of results
23
7. Conclusions....24
8. Reference... 25
9. Turn it in Report ... 26
1. Abstract
The motivation behind this course work is designing a four bit ALU which can successfully tackle
logical and arithmetic operations of this module coursework is understand the functional
operation of an Arithmetic Logic Unit (ALU) and DC motor control system using Peripheral
interface controller (PIC) microcontroller.
This micro computer system module coursework has two main questions. First part of this
coursework is designing and calculation of a 4 bit ALU. This Arithmetic Logic Unit was
controlled by three functions. Those are logic extender, arithmetic extender and carry extender. Its
inputs are modes select M and operations select S1 and S0. The mode input is selects between
logic and arithmetic operations. Using the ripple carry full adders as building blocks together with
logic extender unit, here manipulate all logical operations and arithmetic extender unit to
manipulate all arithmetic operations and carry extender unit to modify the carry in signal C 0.
The second main part is designing and implement of a DC motor system. Its controlled by PIC
(peripheral interface controller) microcontroller. PIC16F877A microcontroller and simple motor
driving techniques are used control the DC motor. Microcontroller has been programmed by using
CCS Compiler software and simulated the whole circuit system by using proteus (ISIS
Professional) software. The C programming language has been used here for programming the
microcontroller. Two main input switches are used to control the motor. One switch is used for
rotate the motor clockwise and stop the motor. The other switch is used for rotate the motor anti-
clockwise and also stop the motor.
Page 5
7/30/2019 A202SE Microcomputer System Coursework
6/30
A202SE
2. Introduction
The main object of this microcomputer system coursework has divided two main areas. The initial
object is design a 4bit ALU (Arithmetic Logic Extender) consist of logic extender, arithmetic
extender and carry extender. Also it should have capable of performing both arithmetic and
logical function in a given applications.
The other object is program a microcontroller using C language and
simulates the microcontroller by a simulation software call proteus
and control the motor. The motor is solely based on the idea of
controlling the motor which uses PIC microcontroller technology to
rotate the motor both clock and anti-clockwise and stop, start the
motor. The C language programming is used here for achieve the
objective.
The ALU used here has only a 4 bit capacity. Therefore in can
process maximum for 4 bit operation at a time. According to this
reason these type of ALU is suitable for small operations only. Ill the PIC microcontroller has
ability to perform thousands of operations and process. But the DC motor has only ability itself to
start the motor, stop the motor, increasing and decreasing the speed and changing the rotating
direction. So the PIC is limited to these features only.
The ALU can be controlled by following three inputs.
Page 6
7/30/2019 A202SE Microcomputer System Coursework
7/30
A202SE
M is mode select, S0 and S1 are operation selects
Full adder and ripple carry adder which is need to design the ALU
The figure 2.1 shows the state diagram.
Here Inputs are Xi and Yi
Carry input is Ci
Carry output is C0
Figure 2.1
Literature Review
3.1 Functional operations of an ALU
The ALU (Arithmetic Logic Unit) is a most important part of a microprocessor. The ALU is
operating based on arithmetic and logical operations such as arithmetically adding, subtraction
and logically OR, AND, XOR, NOR, XNOR, and NOT which the microprocessor
comes across. Also it has capability of performing multiplication and division related problem.
ALU is a combinational circuit and its output depends on only the current input. It doesnt care
about previous input. The ALU is process numerical value in the same format as digital circuit
functions. Because now a days computers are twos complement (binary) representations.
Ripple carry full adder has been used here as a building block for ALU designing. The logic
extender (LE) perform the all the logical function and arithmetic extender (AE) compute all the
arithmetic function as well as carry extender control full adders carry values. Each combinational
circuit is designed separately.
Page 7
7/30/2019 A202SE Microcomputer System Coursework
8/30
A202SE
3.2 Principle of operation of DC motor and its applications
DC motor is an electrical machine which is ability of converting direct current electrical power in
to mechanical power. It has a capability of controlling the speed of rotor more accuracy. Inside of
DC motor has a permanent magnet. It can control electrical power to mechanical power using an
interaction which is created by two sides of magnetic fields. One of these is created by permanentmagnet and other field is created by electrical current is within the inside winding.
The direct current (DC) motor is one of the first machines devised to convert electrical power into
mechanical power. Permanent magnet (PM) direct current converts electrical energy into
mechanical energy through the interaction of two magnetic fields. One field is produced by a
permanent magnet assembly the other field is produced by an electrical current flowing in the
motor windings. These two fields result in a torque which tends to rotate the rotor. As the rotor
turns, the current in the windings is commutated to produce a continuous torque output. The
stationary electromagnetic field of the motor can also be wire-wound like the armature (called a
wound-field motor) or can be made up of permanent magnets (called a permanent magnet motor).
In either style (wound-field or permanent magnet) the commentator. An act as half of a
mechanical switch and rotates with the armature as it turns. The commutator is composed of
conductive segments (called bars), usually made of copper, which represent the termination of
individual coils of wire distributed around the armature. The second half of the mechanical switch
is completed by the brushes. These brushes typically remain stationary with the motor's housing
but ride (or brush) on the rotating commutator. As electrical energy is passed through the brushes
and consequently through the armature a torsional force is generated as a reaction between the
motor's field and the armature causing the motor's armature to turn. As the armature turns, the
Page 8
7/30/2019 A202SE Microcomputer System Coursework
9/30
A202SE
brushes switch to adjacent bars on the commutator. This switching action transfers the electrical
energy to an adjacent winding on the armature which in turn perpetuates the torsional motion of
the armature.
Permanent magnet (PM) motors are probably the most commonly used DC motors, but there are
also some other type of DC motors (types which use coils to make the permanent magnetic field
also) .DC motors operate from a direct current power source. Movement of the magnetic field isachieved by switching current between coils within the motor. This action is called
"commutation". Very many DC motors (brush-type) have built-in commutation, meaning that as
the motor rotates, mechanical brushes automatically commutate coils on the rotor. You can use
dc-brush motors in a variety of applications. A simple, permanent-magnet dc motor is an essential
element in a variety of products, such as toys, servo mechanisms, valve actuators, robots, and
automotive electronics.
There are several typical advantages of a PM motor. When compared to AC or wound field DC
motors, PM motors are usually physically smaller in overall size and lighter for a given power
rating. Furthermore, since the motor's field, created by the permanent magnet, is constant, the
relationship between torque and speed is very linear. A PM motor can provide relatively high
torque at low speeds and PM field provides some inherent self-braking when power to the motor
is shutoff. There are several disadvantages through, those being mostly being high current during
a stall condition and during instantaneous reversal. Those can damage some motors or be
problematic to control circuitry. Furthermore, some magnet materials can be damaged when
subjected to excessive heat and some loose field strength if the motor is disassembled.
High-volume everyday items, such as hand drills and kitchen appliances, use a dc servomotor
known as a universal motor. Those universal motors are series-wound DC motors, where the
stationary and rotating coils are wires in series. Those motors can work well on both AC and DC
power. One of the drawbacks/precautions about series-wound DC motors is that if they are
unloaded, the only thing limiting their speed is the wind age and friction losses. Some can literally
tear themselves apart if run unloaded.
A brushless motor operates much in the same way as a traditional brush motor. However, as the
name implies there are no brushes (and no commutator). The mechanical switching function,
implemented by the brush and commutator combination in a brush-type motor, is replaced by
electronic switching in a brushless motor. In a typical brushless motor the electromagnetic field,created by permanent magnets, is the rotating member of the motor and is called a rotor. The
rotating magnetic field is generated with a number of electromagnets commutatated with
electronics switches (typically transistors or FETs) in a right order at right speed. In a brushless
motor, the trick becomes to know when to switch the electrical energy in the windings to
perpetuate the rotating motion. This is typically accomplished in a brushless-type motor by some
feedback means designed to provide an indication of the position of the magnet poles on the rotor
relative to the windings.
Page 9
7/30/2019 A202SE Microcomputer System Coursework
10/30
A202SE
A Hall Effect device (HED) is a commonly used means for providing this positional feedback. In
some applications brushless motors are commutated without sensors or with the use of an encoder
for positional feedback. A brushless motor is often used when high reliability, long life and high
speeds are required. The bearings in a brushless motor usually become the only parts to wear out.
In applications where high speeds are required (usually above 30,000 RPM) a brushless motor is
considered a better choice (because as motor speed increases so does the wear of the brushes on
traditional motors).
A brushless motor's commutation control can easily be separated and integrated into other
required electronics, thereby improving the effective power-to-weight and/or power-to-volume
ratio. A brushless motor package (motor and commutation controller) will usually cost more than
a brush-type, yet the cost can often be made up in other advantages. For example, in applications
where sophisticated control of the motor's operation is required. Brushless motors are seen
nowadays in very many computer applications, they for example rotate normal PC fans, hard
disks and disk drives.
Sometimes the rotation direction needs to be changed. In normal permanent magnet motors, this
rotation is changed by changing the polarity of operating power (for example by switching from
negative power supply to positive or by inter-changing the power terminals going to power
supply). This direction changing is typically implemented using relay or a circuit called an H
bridge. There are some typical characteristics on "brush-type" DC motors.
When a DC motor is straight to a battery (with no controller), it draws a large surge current when
connected up. The surge is caused because the motor, when it is turning, acts as a generator. The
generated voltage is directly proportional to the speed of the motor. The current through the motor
is controlled by the difference between the battery voltage and the motor's generated voltage
(otherwise called back EMF). When the motor is first connected up to the battery (with no motor
speed controller) there is no back EMF.
So the current is controlled only by the battery voltage, motor resistance (and inductance) and the
battery leads. Without any back emf the motor, before it starts to turn, therefore draws the large
surge current. When a motor speed controller is used, it varies the voltage fed to the motor.
Initially, at zero speed, the controller will feed no voltage to the motor, so no current flows. As the
motor speed controller's output voltage increases, the motor will start to turn. At first the voltage
fed to the motor is small, so the current is also small, and as the motor speed controller's voltage
rises, so too does the motor's back EMF. The result is that the initial current surge is removed,acceleration is smooth and fully under control
Motor speed control of DC motor is nothing new. A simplest method to control the rotation speed
of a DC motor is to control it's driving voltage. The higher the voltage is, the higher speed the
motor tries to reach. In many applications a simple voltage regulation would cause lots of power
loss on control circuit, so a pulse width modulation method (PWM)is used in many DC motor
controlling applications. In the basic Pulse Width Modulation (PWM) method, the operating
power to the motors is turned on and off to modulate the current to the motor. The ratio of "on"
Page 10
7/30/2019 A202SE Microcomputer System Coursework
11/30
A202SE
time to "off" time is what determines the speed of the motor. When doing PWM controlling, keep
in mind that a motor is a low pass device.
The reason is that a motor is mainly a large inductor. It is not capable of passing high frequency
energy, and hence will not perform well using high frequencies. Reasonably low frequencies are
required, and then PWM techniques will work. Lower frequencies are generally better than higher
frequencies, but PWM stops being effective at too low a frequency. The idea that a lowerfrequency PWM works better simply reflects that the "on" cycle needs to be pretty wide before
the motor will draw any current (because of motor inductance). A higher PWM frequency will
work fine if you hang a large capacitor across the motor or short the motor out on the "off" cycle
(e.g. power/brake pwm) The reason for this is that short pulses will not allow much current to
flow before being cut off. Then the current that did flow is dissipated as an inductive kick -
probably as heat through the fly-back diodes.
The capacitor integrates the pulse and provides a longer, but lower, current flow through the
motor after the driver is cut off. There is not inductive kick either, since the current flow isn't
being cut off. Knowing the low pass roll-off frequency of the motor helps to determine an
optimum frequency for operating PWM. Try testing your motor with a square duty cycle using a
variable frequency, and then observe the drop in torque as the frequency is increased. This
technique can help determine the roll off point as far as power efficiency is concerned.
Besides "brush-type" DC motors, there is another DC motor type: brushless DC motor. Brushless
DC motors rely on the external power drive to perform the commutation of stationary copper
winding on the stator. This changing stator field makes the permanent magnet rotor to rotate. A
brushless permanent magnet motor is the highest performing motor in terms of torque / vs. weight
or efficiency. Brushless motors are usually the most expensive type of motor.
Electronically commutated, brush-less DC motor systems are widely used as drives for blowers
and fans used in electronics, telecommunications and industrial equipment applications. There is
wide variety of different brush-less motors for various applications. Some are designed to rotate at
constant speed (those used in disk drives) and the speed of some can be controlled by varying the
voltage applied to them (usually the motors used in fans).
Some brushless DC motors have a built-in tachometer which gives out pulses as the motor rotates
(this applies to both disk drive motors and some computer fans). In general, users select brush-
type DC motors when low system cost is a priority, and brushless motors to fulfill otherrequirements (such as maintenance-free operation, high speeds, and explosive environments
where sparking could be hazardous). Brush type DC motors are used in very many battery
powered appliances. Brushless DC motors are commonly used in applications like DC powered
fans and disk drive rotation motor
Page 11
7/30/2019 A202SE Microcomputer System Coursework
12/30
A202SE
For DC motors because the direction of current the equation will be
Vs = E + IaRa Ia = I1 + If
Vs : Supply Voltage Ia : armature current If : field current
E : back e.m.f Ra : armature resistance
Another equation for DC motor is
Page 12
7/30/2019 A202SE Microcomputer System Coursework
13/30
A202SE
E generated e.m.f
P no. of pole pairs
Flux per pole
N speed per second (rps)
Z number of armature conductors
C number of parallel path
There are 2 types of armature windings . they are wave winding & lap winding . In this
equation C depends on that , that means in wave winding C = 2 & in lap winding C = 2P .
3.4 PIC microcontrollers and development system
PIC microcontroller is a processor with built in memory and RAM. It can use to control specific
project. It has separate external RAM, ROM and peripheral chip. PIC is a very powerful device
and it has many useful built in modules like EEPROM, Timers, Analogue Comparators, UART
and etc..
Its applications are
Frequency counter : using the internal timers and reporting through UART (RS232) or output to
LCD.
Capacitance meter : analogue comparator oscillator.
Event timer : using internal timers.
Event data logger: capturing analogue data using an internal ADC and using the internal
EEPROM for storing data (using an external I2C for high data storage capacity.
Servo controller (Control through UART) : using the internal PWM module or using a software
created PWM.
Page 13
7/30/2019 A202SE Microcomputer System Coursework
14/30
A202SE
Features
In fact a PIC microcontroller is an amazingly powerful fully featuredprocessor with internal
RAM, EEROM FLASH memory and peripherals. One of the smallest ones occupies the space of
a 555 timer but has a 10bit ADC, 1k of memory, 2 timers, high current I/O ports a comparator a
watch dog timer... I could go on as there is more!
Programming
One of the most useful features of a PIC microcontroller is that you can re-program them as they
use flash memory (if you choose a part with an F in the part number e.g. 12F675 not 12C509).
You can also use the ICSP serial interface built into each PIC Microcontroller for programming
and even do programming while it's still plugged into the circuit!
You can either program a PIC microcontroller using assembler or a high level language and I
recommend using a high level languagesuch as C as it ismuch easier to use (after an initial
learning curve). Once you have learned the high level language you are not forced to use the
same processor e.g. you could go to an AVR or Dallas microcontroller and still use the same high
level language.
Input / Output - I/O
A PIC Microcontroller can control outputs and react to inputs
e.g. It could drive a relay or read input buttons.
With the larger devices it's possible to drive LCDs or seven segment displays with very few
control lines as all the work is done inside the PIC microcontroller.
Comparing afrequency counterto discrete web designs It will find two or three chips for the
microcontroller design and ten or more for a discrete design. So using those saves prototype
design effort as you can use built in peripherals to take care of lots of the circuit operation.
Many now have a built in ADC so you can read analogue signal levels so we don't need to add an
external devices e.g. It can be read anLM35 temperature sensordirectly with no interface logic.
Page 14
http://www.best-microcontroller-projects.com/pic-compiler.htmlhttp://www.best-microcontroller-projects.com/pic-compiler.htmlhttp://www.best-microcontroller-projects.com/pic-frequency-counter.htmlhttp://www.best-microcontroller-projects.com/pic-frequency-counter.htmlhttp://www.best-microcontroller-projects.com/temperature-recorder.htmlhttp://www.best-microcontroller-projects.com/temperature-recorder.htmlhttp://www.best-microcontroller-projects.com/pic-frequency-counter.htmlhttp://www.best-microcontroller-projects.com/temperature-recorder.htmlhttp://www.best-microcontroller-projects.com/pic-compiler.html7/30/2019 A202SE Microcomputer System Coursework
15/30
A202SE
Peripherals
The PIC microcontroller has many built in peripherals and this can make using them quite
daunting at first which is why I have made this introductory page with a summary of each major
peripheral block.
At the end is a short summary of themain devices used in projectsshown on this site.
The best way to start is to learn about the main features of a chip and then begin to use each
peripheral in a project. I think learning by doing is the best way.
Designing Criteria
4.1 ALU operation table
M S1 S0 Functions Xi (Logic
Extender)
Yi(Arithmetic
Extender)
C0
Logic operations
0 0 0 (Ai . Bi)' ai'ORbi' 0 0
0 0 1 Ai Bi ai XOR bi 0 0
0 1 0 (Ai + Bi)' ai' andbi' 0 0
0 1 1 (Ai Bi)' ai XNORbi 0 0
Arithmetic operations
1 0 0 Ai + Bi + 1 ai bi 1
1 0 1 Ai + Bi' ai bi' 0
1 1 0 Ai + 1 ai 0 1
1 1 1 Ai'+ Bi ai' bi 0
4.1.1 Logic Extender Unit
Truth table of logic extender
M S1 S0 Xi (Logic Extender)
0 0 0 (Ai . Bi)'
0 0 1 Ai Bi
0 1 0 (Ai + Bi)'
Page 15
http://www.best-microcontroller-projects.com/pic-microcontroller.html#Deviceshttp://www.best-microcontroller-projects.com/pic-microcontroller.html#Deviceshttp://www.best-microcontroller-projects.com/pic-microcontroller.html#Deviceshttp://www.best-microcontroller-projects.com/pic-microcontroller.html#Devices7/30/2019 A202SE Microcomputer System Coursework
16/30
A202SE
0 1 1 (Ai Bi)'
1 0 0 Ai
1 0 1 Ai
1 1 0 Ai
1 1 1 Ai'
Kanough Map of Logic Extender
Excitation Equation of Logic extender
Xi = M' Ai' Bi' S1 + M' Ai' S1' S0' + M' Ai' Bi S1' + Ai Bi' S1' + M' Ai Bi S1 S0 +
M Ai S1' + M Ai S0' + M Ai' S1 S0
Output circuit of Logic extender
Page 16
7/30/2019 A202SE Microcomputer System Coursework
17/30
A202SE
M S 1 S 0 A B
M
N O T
S 1
N O T
S 0
N O T
A
N O T
B
N O T
U 1
A N D 4
U 2
A N D 4
U 3
A N D 4U 4
A N D 4
U 5
A N D 3U 6
A N D 4
U 7
A N D 5
U 8
A N D 4
U 1 4
O R 8
Figure 4.1.1.1
4.1.2 Arithmetic extender unit
Truth table of Arithmetic extender
Page 17
7/30/2019 A202SE Microcomputer System Coursework
18/30
A202SE
Kanough Map of Arithmetic extender
Excitation equation Arithmetic extender
Yi = M Bi S1' S0' + M Bi S1 S0 + M Bi' S1' S0
Circuit Arithmetic extender
Page 18
M S1 S0 Yi0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 Bi1 0 1 Bi'
1 1 0 0
1 1 1 Bi
7/30/2019 A202SE Microcomputer System Coursework
19/30
A202SE
M S1 S0 B
U2
NOT
U3
NOT
U4
NOT
U5
AND4U6
AND4
U7
AND4
U8
OR3
Figure 4.1.2.1
4.1.3 Carry Extender Unit
Truth table of Carry extender
M S1 S0 C0
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
Kanough map of Carry extender
Page 19
7/30/2019 A202SE Microcomputer System Coursework
20/30
A202SE
Excitation equation of Carry extender
C0= M S0'
Circuit of Carry extender
M S0
U1
AND2
U2
NOT
Figure 4.1.3.1
4.1.4 The Resultant Circuit of the Arithmetic Logic Unit
Page 20
7/30/2019 A202SE Microcomputer System Coursework
21/30
A202SE
Figure 4.1.4.1
5. Software Implementation
Page 21
7/30/2019 A202SE Microcomputer System Coursework
22/30
A202SE
5.1. Flow chart of DC motor control program
Figure 5.1.1
Implementation and simulate the circuit
Page 22
7/30/2019 A202SE Microcomputer System Coursework
23/30
A202SE
PIC16F877A microcontroller is used here to design the circuit. The source code is written in C
language and its compiled by using CCS Compiler. Thereafter circuit is designed and simulates
using proteus ISIS 7 Professional software. The microcontroller input voltage is low and it is
controlled by very low voltage. Around 0.5mV it can be star, stop and control the motor. Using
low voltage and power consumption can have a high efficiency of the device. Using delay
function by coding the motor functioning time can be set.
5.2. C program implementation
The C language source code which is used to program
#include "16F877A.h"
#use delay (clock=1000000)
void main()
{
int x;
int y;
output_D(0);
output_D(1);
while(1)
{
x=input(PIN_c0);
y=input(PIN_c1);
if(x==1)output_high(PIN_D0);
delay_ms(250);
if(x==0)output_low(PIN_D0);
if(y==1)output_high(PIN_D1);
if(y==0)output_low(PIN_D1);
delay_ms(450);
}
}
Screenshot of the CCS Compiler.
Page 23
7/30/2019 A202SE Microcomputer System Coursework
24/30
A202SE
Figure 5.2.1
5.3 Simulation with integrated development environment (IDE)
The proteus software screen shots
Figure 5.3.1
When both switches are turned off and start the system, the motor go to rest.
Page 24
7/30/2019 A202SE Microcomputer System Coursework
25/30
A202SE
Figure 5.3.2
When switch SW2 is turned on, the input C0 is high output D0 also high. Then motor start to
rotate clockwise
Figure 5.3.3
When switch SW2 is turned off and switch SW1 is turned on, the input C1 is high output D1 also
high. Then motor start to rotate anti-clockwise.
Page 25
7/30/2019 A202SE Microcomputer System Coursework
26/30
A202SE
Figure 5.3.4
When both switches are turned on both inputs and outputs are high. Then motor get voltage from
both sides and it goes to rest.
Page 26
7/30/2019 A202SE Microcomputer System Coursework
27/30
A202SE
Discussion
ALU
After making the truth table we can make the simulation circuit. But it will be very complicated
and hardware designing cost also will be high. Also the circuit size become larger and it willdefault in application. We can simplify the circuit using kanough map from the truth table. When
we use the kanough map we can get simplified equations and we can design the simplified circuit
using those equations.
When we designing a simplified circuit it reduced circuit building cost and get more efficiency
circuit. When it comes to industrial the circuit size will be very smaller and its easier to portable.
Also the power cost wil be reduced.
DC Motor
Here we select a simple DC motor control system. Using two switch rotate the motor clock and
anti-clockwise and stop/start the motor. When the switch one is on the motor right side terminal
get voltage and motor start to rotate. Here we used series wound motor. So if the switch is open
for long time the rotating speed goes to infinite. It is not suitable for application and it will be very
harmful.
The input switch is not directly connected to the motor and its designed for low voltage.
Otherwise the input voltage can be high. The reason here is when we use the low input voltage the
transient effect also will be low.
Page 27
7/30/2019 A202SE Microcomputer System Coursework
28/30
A202SE
Conclusions
ALU
A 4 bit ALU has capability to perform only eight operations at a time. The logic extender of this
ALU is little bit complicated comparing other. Because it is performing for main operations OR,AND, NOT and XOR. There for inputs (M, S1, S0 ,ai , bi). So 32 bit Kanough map has to be used
to solve and get the equations. Therefore it needs lot of processing and big circuit. But arithmetic
and carry extender require small circuit. Carry extender is a very small circuit with single gate
operation. This 4 bit ALU has a ability of performing any mathematical operation such as
addition, subtraction, multiplication and division and logical operations such as AND, OR,
NOT.Etc.
DC Motor
The DC motor controller design here using PIC microcontroller and it can controlled by PIC very
successfully. In the control system here program PIC microcontroller by C language and compiled
it using CCS Compiler successfully and it design the whole system on proteus ISIS 7 Professional
software and installed the compiled C file into PIC successfully. After when play system it plays
completely successfully and able to stop/star and change the direction of the motor.
This type of motor controller system is very important in this generation. Because the PICprogram can be changed nay time easily according to the applications. When simulating the
program it gets real working condition in the microcontroller. A DC motor control using a PIC
microcontroller is a better choice and it is efficiency way of control the system.
Page 28
7/30/2019 A202SE Microcomputer System Coursework
29/30
A202SE
Reference
1. A PIC microcontroller introduction [Online] [Accessed 2012.may.26] http://www.best-
microcontroller-projects.com/pic-microcontroller.html
2.Principles of operation of DC electric motors. 2012. Principles of operation of DC electric
motors. [ONLINE] [Accessed 26 May 2012] http://www.pc-control.co.uk/dc-motors.htm
3.Bates, M(2008) programming 8-bit PIC Microcontrollers in C with interactive hardware
simulation
4.Enoch Hwang (2006).Digital Logic and Microprocessor Design with VHDL, chapter 4. .
United Kingdom .
Page 29
http://www.pc-control.co.uk/dc-motors.htmhttp://www.pc-control.co.uk/dc-motors.htm7/30/2019 A202SE Microcomputer System Coursework
30/30
A202SE
Turn it in report