+ All Categories
Home > Documents > Report Final PLKNJropeller

Report Final PLKNJropeller

Date post: 07-Mar-2016
Category:
Upload: prevenamaniam
View: 219 times
Download: 0 times
Share this document with a friend
Description:
,KN
31
Propeller LED Display
Transcript

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 1/31

Propeller LED Display

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 2/31

Propeller LED Display

1

Chapter 1

INTRODUCTION

1.1 Literature survey

1.2 Overview of project

1.3 Block Diagram

1.4 Overview of block diagram

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 3/31

Propeller LED Display

2

1.1 LITERATURE SURVEY

This project was started with a simple principle which is frequently encountered in

our everyday life, which is Persistence of Vision. This phenomenon makes one feel

fast moving/changing objects to appear continuous. A television is a common

example; in which image is re-scanned every 25 times, thereby appear continuous.

Further, a glowing object if rotated in a circle at fast speed, it shows a continuous

circle. By modifying this basic idea, 8 LEDs can be rotated in a circle, showing 8

concentric circles. But if these LEDs are switched at precise intervals, a steady

display pattern can be shown.

1.1.1Existing Systems:

Existing systems do employ POV principle, but for displaying each pixel, individual

LED is used. This results in a huge number of LEDs even for small sized displays. By

using a propeller type display, LED count can be kept to a bare minimum. Even 8LEDs can perform a task of over 525 LEDs.

1.1.2Applications:

Applications can find their way into cost effective solutions for large public displays,

information systems. It can directly replace Railway station information displays, bus

stands and many more places.

1.2 OVERVIEW OF PROJECT

1.2.1PROPELLER:Propeller is a term associated with a circular rotating object.

As this project needs to rotate whole circuit assembly, there must be some prime

mover attached to it. So, the term ‘Propeller’.

1.2.2LED DISPLAY:This project using bright light emitting diodes for

displaying the characters and symbols on its assembly. That’s why this project is

named as ‘PROPELLER LED DISPLAY’.

1.2.3 POV (Persistence of Vision):This is the phenomenon which is related to

vision capability of human eye by which an after- image is thought to persist for

approximately 1/25th of a second. So, if someone is observing the images at a rate of

25 images per second, then they appear to be continuous. The best example of this

 property is the red circle we observe when we rotate the firecracker or incense stick in

circle

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 4/31

1.3BLOCK DIAGR 

Propeller

M

Figure 1: Block Diagram of Project 

 LED Display

3

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 5/31

Propeller LED Display

4

1.4 OVERVIEW OF BLOCK DIAGRAMIn this section we will emphasize on detailed overview of each of the block shown in

 previous block diagram. In every description of the block respective schematics and

working is explained. The propeller display consists of following blocks, as shown in

the block diagram.

1. Interrupter Module

2. Microcontroller 

3. LED module

4. DC motor  

5. DC power supply

1.4.1Interrupter module:Interrupter module is our sensor module consisting of

the IR interrupt sensor MOC7811, from Motorola Inc. This sensor was selected from

a variety of other alternatives, because of its small size, precise interrupt sensing, and

sturdy casing. One great advantage of using this module is, interfacing it with the

microcontroller is just a matter of two resistors and a general purpose transistor.

Following is the complete circuit diagram of our interrupter module.

1.4.2.Microcontroller P89V51RD2: This project is based around the

microcontroller P89V51RD2, which is a derivative of 8051 family, from NXP. This is

a 40 pin IC packaged in DIP package. This small sized IC is used, mainly because of

its reduced weight. This improves the performance of the display, because reduced

weight gives advantage of increased RPM.

1.4.3LED Module:LED module consisting of 8 bright LED is fixed in another

side of the arm of our project. These LEDs are connected with each of the port pin of

microcontroller, with a series current limiting resistor of 22 ohm.

1.4.4. DC Motor: Repeated scanning of the display is must for continuous vision.

This task is achieved using circular rotation of the whole circuit assembly. So, we

used a DC motor as the prime mover.

1.4.5 DC Power Supply:For microcontroller, as well as the DC motor, a

regulated DC power supply is required. We have to provide +5V to the

microcontroller, while +12V to the motor.

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 6/31

Propeller LED Display

5

Chapter 2

Hardware Design

2.1 Interrupter Module

2.2 Mechanical Assembly

2.3 Power Supply Module

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 7/31

Propeller LED Display

6

2.1Interrupter moduleMOC7811 is the sensing part of the interrupter module, while rest of the circuitry

works as signal conditioning circuit 3 wires emerge out from the module,

respectivelyVcc, Signal and Ground. Output of the module is LOW, if interrupt

occurs, otherwise it remains HIGH.

It consists of IR LED and Photodiode mounted facing each other enclosed in plastic

 body. When light emitted by the IR LED is blocked because of some completely

opaque object, logic level of the photo diode changes. This 3change in the logic level

can be sensed by the microcontroller or by discrete hardware. This sensor is used to

give position feedback.

Output

Figure 2: Circuit diagram of interrupter module (MOC781)

Figure 3: Functioning of MOC7811

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 8/31

2.1.1Signal Conditioni

INT0 pin of our microcont

interrupt is should be signal

the sensor.

2.1.2Transistor 2N3904

This is ageneral purpose sili

amplifier configuration. It in

transient response.

2.2MECHANICAL

Mechanical assembly playsdisplay is scanned each tim

 basic idea we developed is o

ways to do this.Above diagra

Here, one major challenge

tried the same by adopting t

method, to use a 7805 regula

Propeller

g:

  roller is Active Low. That means, occurrenc

d with Low logic level. So, we must invert the

:

  con NPN transistor. It is connected in the CE

erts the output of the photodiode, and also im

SSEMBLY

  a vital role in proper functioning of this pr   , by rotating the whole assembly in a circular

our own, by implementing and modifying diff 

m shows the most reliable way, that we finally

as how to bring +5V supply to the spinning c

  o-three different methods, but finally conclu

or and I/P to regulator was given by a 9V DC b

Figure 4: Mechanical assembly

 LED Display

7

e of each

output of

inverting

roves the

  ject. The path. The

erent

selected.

  rcuit. We

ed on the

attery.

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 9/31

Propeller LED Display

8

Most critical objective was to achieve pristine balance and overall good mechanical

strength. We designed a case in which motor is fixed permanently and pcb is fixed on

it with the help of nut and bolts to avoid wobbling. To balance the weight we placed

 battery on one side of PCB and whole circuit on other side.

Figure 6: Project image (2)

Figure 5: Project image (1)

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 10/31

Propeller LED Display

9

2.3POWER SUPPLYWe are using a 9v motor dc motor to rotate the assembly to provide 9v to the DC

motor we have used a voltage adapter, which has an in built rectification circuit, that

converts 230 V AC mains to 9V DC.

The 9V DC is given to an arbitrary PCB then with connectors the supply is given to

motor.

Microcontroller we are using, P89V51RD2, operates at 5V DC supply. The DC

supply is provided by using 7805 regulator and a 9V battery.

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 11/31

Propeller LED Display

10

Chapter 3

Software Design

3.1 Schematic Diagram

3.2Programming In 8051

3.3 Keil Environment

3.4Interrupt,Timer &Counter 

3.5 Algorithm

3.6 Flow Chart

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 12/31

Propeller LED Display

11

3.1Schematic Diagram

Figure 7: Schematic diagram of project 

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 13/31

Propeller LED Display

12

3.2Programming for 8051 Using KEIL IDEIf not simpler, the version of the C programming language used for the

microcontroller environment is not very different than standard C when working on

mathematical operations, or organizing your code. The main difference is all about the

limitations of the processor of the P89V51RD2 microcontroller as compared to

modern computers.

Even if you’re not very familiar with the C language, this tutorial will introduce all

the basic programming techniques that will be used along this tutorial. It will also

show you how to use the KEIL IDE.

3.2.1From the C program to the machine language

The C source code is very high level language, meaning that it is far from being at the

 base level of the machine language that can be executed by a processor. This machine

language is basically just zero’s and one’s and is written in Hexadecimal format, that

why they are called HEX files.

There are several types of HEX files; we are going to produce machine code in the

INTEL HEX-80 format, since this is the output of the KEIL IDE that we are going to

use. Fig. 8 shows that to convert a C program to machine language, it takes several

steps depending on the tool you are using, however, the main idea is to produce a

HEX file at the end. This HEX file will be then used by the ‘burner’ to write every

 byte of data at the appropriate place in the EEPROM of the P89V51RD2.

3.2.2Organization of a C program

All C programs have this common organization scheme, sometimes it’s followed,

sometimes it’s not, however, it is imperative for this category of programming that

this organization scheme be followed in order to be able to develop your applications

Figure 8: Conversion of C program to machine language

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 14/31

Propeller LED Display

13

successfully. Any application can be divided into the following parts, noting that is

should be written in this order:

1. Headers Includes and constants definitions: In this part, header files (.h) are

included into your source code. Those headers files can be system headers to

declare the name of SFRs, to define new constants, or to include mathematical

functions like trigonometric functions, root square calculations or numbers

approximations. Header files can also contain your own functions that would

 be shared by various programs.

2. Variables declarations:More precisely, this part is dedicated to ‘Global

Variables’ declarations. Variables declared in this place can be used anywhere

in the code. Usually in microcontroller programs, variables are declared as

global variables instead of local variables, unless your are running short of

RAM memory and want to save some space, so we use local variables, whose

values will be lost each time you switch from a function to another. To

summarize, global variables as easier to use and implement than local

variables, but they consume more memory space.3. Functions’ body:Here you group all your functions. Those functions can be

simple ones that can be called from another place in your program, as they can

 be called from an ‘interrupt vector’. In other words, the sub-programs to be

executed when an interrupt occurs is also written in this place.

4. Initialization:The particularity of this part is that it is executed only one time

when the microcontroller was just subjected to a ‘RESET’ or when power is

 just switched ON, then the processor continue executing the rest of the

 program but never executes this part again. This particularity makes it the

 perfect place in a program to initialize the values of some constants, or to

define the mode of operation of the timers, counters, interrupts, and otherfeatures of the microcontroller.

5. Infinite loop

An infinite loop in a microcontroller program is what is going to keep it alive,

 because a processor have to be allays running for the system to function,

exactly like a heart have to be always beating for a person to live. Usually this

 part is the core of any program, and its from here that all the other functions

are called and executed.

3.2.3Simple C program for P89V51RD2

Here is a very simple but complete example program to blink a LED. Actually it is thesource code of the example project that we are going to construct in the next part of

the tutorial, but for now it is important to concentrate on the programming to

summarize the notions discussed above.

#include <REGX52.h>

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 15/31

Propeller LED Display

14

#include <math.h>

delay(unsignedint y)

{

unsignedint i;

for(i=0;i<y;i++){;}

}

main()

{

while(1)

{

delay(30000);

P1_0 = 0;

delay(30000);

P1_0 = 1;

}

}

After including basic headers for the SFR definitions of the 8952 microcontroller

(REGX52.h) and for mathematical functions (math.h), a function named ‘delay’ is

created, which is simple a function to create a delay controlled via the parameter ‘y’.

Then comes the main function, with an infinite loop (the condition for that loop to

remain will always be satisfied as it is ’1 ′). Inside that loop, the pin number 0 of port 1

is constantly turned ON and OFF with a delay of approximately one second.

3.3Using the KEIL environmentKEIL µVision is the name of a software dedicated to the development and testing of a

family of microcontrollers based on 8051 technology, like the P89V51RD2 which we

are going to use along this tutorial. You can download an evaluation version of KEIL

at their website: http://www.keil.com/c51/. Most versions share merely the same

interface, this tutorial uses KEIL C51 µvision 3 with the C51 compiler v8.05a.

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 16/31

Propeller LED Display

15

To create a project, write and test the previous example source code, follow the

following steps:

Open Keil and start a new project.

You will prompted to choose a name for your new project, Create a separate

folder where all the files of your project will be stored, chose a name and click

save. The following window will appear, where you will be asked to select adevice for Target ‘Target 1′:

Figure 9: Getting started with KEIL (1)

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 17/31

Propeller LED Display

16

From the list at the left, seek for the brand name NXP, then under NXP,

select P89V51RD2. You will notice that a brief description of the device

appears on the right. Leave the two upper check boxes unchecked and click

OK. The P89V51RD2 will be called your ‘Target device’, which is the final

destination of your source code. You will be asked whether to ‘ copy standard

8051 startup code‘ click No.

Figure 10: Getting started with KEIL (2)

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 18/31

Propeller LED Display

17

Click File, New, and something similar to the following window should

appear. The box named ‘Text1′ is where your code should be written later.

 Now you have to click ‘File, Save as’ and chose a file name for your source

code ending with the letter ‘.c’. You can name is ‘code.c’ for example, and

click save. Then you have to add this file to your project work space at the left

as shown in the following screen shot:

Figure 11: Getting started with KEIL (3)

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 19/31

Propeller LED Display

18

Figure 12: Getting started with KEIL (4)

After right-clicking on ‘ source group 1‘, click on ‘ Add files to group…‘, then

you will be prompted to browse the file to add to ‘source group 1 ′, chose the

file that you just saved, eventually ‘code.c’ and add it to the source group. You

will notice that the file is added to the project tree at the left.

In some versions of this software you have to turn ON manually the option to

generate HEX files. make sure it is turned ON, by right-clicking on target

1, Options for target ‘target 1′, then under the ‘output‘ tab, by checking the

 box ‘generate HEX file‘. This step is very important as the HEX file is the

compiled output of your project that is going to be transferred to the micro-

controller.

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 20/31

Propeller LED Display

19

You can then start to write the source code in the window titled ‘code.c’ then

 before testing your source code, you have to compile your source code, and

correct eventual syntax errors. In KEIL IDE, this step is called ‘rebuild all

targets’ and has this icon: .

Figure 13: Getting started with KEIL (5)

You can use the output window to track eventual syntax errors, but also to

check the FLASH memory occupied by the program (code = 49) as well as the

registers occupied in the RAM (data = 9). If after rebuilding the targets, the

‘output window’ shows that there is 0 error, then you are ready to test the

 performance of your code. In KEIL, like in most development environment,

this step is called Debugging, and has this icon: . After clicking on the

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 21/31

Propeller LED Display

20

debug icon, you will notice that some part of the user interface will change,

some new icons will appear, like the run icon circled in the following figure:

Figure 14: Getting started with KEIL (6)

You can click on the ‘Run’ icon and the execution of the program will start. In

our example, you can see the behavior of the pin 0 or port one, but clicking on

‘peripherals, I/O ports, Port 1′. You can always stop the execution of the

 program by clicking on the stop button ( ) and you can simulate a reset by

clicking on the ‘reset’ button

3.4Interrupts, Timers and CountersMost microcontrollers come with a set of ‘ADD-ONs’ called peripherals, to enhance

the functioning of the microcontroller, to give the programmer more options, and to

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 22/31

Propeller LED Display

21

increase the overall performance of the controller. Those features are principally the

timers, counters, interrupts, Analog to digital converters, PWM generators, and

communication buses like UART, SPI or I2C. The P89V51RD2 is not the most

equipped micro-controller in terms of peripherals, but never the less, the available

features are adequate to a wide range of applications, and it is one of the easiest to

learn on the market.

3.4.1Introduction to P89V51RD2 Peripherals

 Figure 15 below shows a simplified diagram of the main peripherals present in the

P89V51RD2 and their interaction with the CPU and with the external I/O pins. You

can notice that there are three timers/Counters. We use the expression

“Timer/Counter” because this unit can be a counter when it counts external pulses on

its corresponding pin, and it can be a timer when it counts the pulses provided by the

main clock oscillator of the microcontroller. Timer/Counter two is a special counter

that does not behave like the two others, because it have a couple of extra

functionality.

The serial port, using a UART (Universal Asynchronous Receive Transmit) protocolcan be used in a wide range of communication applications. With the UART provided

in the P89V51RD2 you can easily communicate with a serial port equipped computer,

as well as communicate with another microcontroller. This last application, called

Multi-processor communication, is quite interesting, and can be easily implemented

Figure 15: Internal block diagram of microcontroller 

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 23/31

Propeller LED Display

22

with two P89V51RD2 microcontrollers to build a very powerful multi-processor

controllers.

If all the peripherals described above can generate interrupt signals in the CPU

according to some specific events, it can be useful to generate an interrupt signal from

an external device that may be a sensor or a Digital to Analog converter. For that

 purpose there are two External Interrupt sources (INT0 and INT1).

This was a presentation of the available peripheral features in a P89V51RD2

microcontroller. Through this tutorial, we are going to study how to setup and use

external interrupts and the two standard timers (T0 and T1). For simplicity, and

to keep this tutorial a quick and straight forward one, The UART and the

Timer/Counter 2 shall be discussed in separate tutorials.

3.4.2External Interrupts

Let’s start with the simplest peripheral which is the external interrupt, which can be

used to cause interruptions on external events (a pin changing its state from 0 to 1 or

vice-versa). In case you don’t know, interruption is a mean of stopping the flow of a

 program, as a response to a certain event, to execute a small program called ‘interrupt

routine’.

As you noticed in figure 15, in the P89V51RD2, there are two external interrupt

sources, one connected to the pin P3.2 and the other to P3.3. They are configured

using a number of SFRs (Special Function Registers). Most of those SFRs are shared

 by other peripherals as you shall see in the rest of the tutorial.

The first register you have to configure (by turning On or Off the right bits) is

the IE register, shown in figure 16 . IE stands for ‘Interrupt Enable’, and it is used to

allow different peripherals to cause software interruption. To use any of the interrupts,

the bit EA (Enable ALL) must be set to 1, then, you have enable each one of the

interrupts to be used with its individual enable bit. For the external interrupts, the two

 bits EX0 and EX1 are used for External Interrupt 0 and External Interrupt 1.

Using the C programming language under KEIL, it is extremely simple to set those

 bits, simply by using their name as any global variables, using the following syntax:

EA = 1;

EX0 = 1;

Figure 16: IE register 

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 24/31

Propeller LED Display

23

EX1 = 1;

The rest of the bits of IE register are used for other interrupt sources like the 3 timers

overflow (ETx) and the serial interface (ES).

Similarly, you have to set the bits IT0 and IT1 in the TCON register, shown in figure

4.2.B. The bits IT0/IT1 are used to configure the type of signal on the corresponding

 pins (P3.2/P3.3) that generated an interrupt according to the following table:

IT0/IT1 = 1 External interrupt caused by a falling edge signal on P3.2/P3.3

IT0/IT1 = 0 External interrupt caused by a low level signal on P3.2/P3.3

If IT0 or IT1 is set to 0, an interruption will keep reoccurring as long as P3.2 or P3.3

is set to 0. This mode isn’t easy to manage, and most programmers tends to use

external interrupts triggered by a falling edge (transition from 1 to 0).

Again, this register is ‘bit addressable’ meaning you can set or clear each bit

individually using their names, like in the following example:

IT0 = 1;

IT1 = 1;

3.4.2.1The IE register

First, you have to Enable the corresponding interrupts, but writing 1′s to the

corresponding bits in the IE register. The following table shows the names and

definitions of the concerned bits of the IR register (you can always take a look at the

complete IE register in figure 14):

EA Enable All interrupts

ET2 Enable Timer 2 interrupts (will not be treated in this tutorial)

ET1 Enable Timer 1 interrupts

ET0 Enable Timer 0 interrupts

You can access those special bits by their names, as simply as it seems, example:

Figure 17: TCON register 

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 25/31

Propeller LED Display

24

ET0 = 1;

3.4.3Timer/Counter

The timer is a very interesting peripheral that is imperatively present in every

microcontroller. It can be used in two distinct modes:

1. Timer: Counting internal clock pulses, which are fixed with time, hence, we

can say that it is very precise timer, whose resolution depends on the

frequency of the main CPU clock (note that CPU clock equals the crystal

frequency over 12).

2. Counter: Counting external pulses (on the corresponding I/O pin), which can

 be provided by a rotational encoder, an IR-barrier sensor, or any device that

 provide pulses, whose number would be of some interest.

Sure, the CPU of a microcontroller could provide the required timing or counting, but

the timer/counter peripheral relieves the CPU from that redundant and repetitive task,

allowing it to allocate maximum processing power for more complex calculations.

So, like any other peripheral, a Timer/Counter can ask for an interruption of the

 program, which – if enabled – occurs when the counting registers of the

Timer/Counter are full and overflow. More precisely, the interruption will occur at the

same time the counting register will be reinitialized to its initial value.

So to control the behavior of the timers/counters, a set of SFR are used, most of them

have already been seen at the top of this tutorial.

3.4.3.1 The TCON register

The TCON register is also shared between more than one peripherals. It can be used

to configure timers or, as you saw before, external interrupts. The following table

shows the names and definitions of the concerned bits of the TCON register (available

in figure 17 ):

TF1 Overflow interrupt flag, used by the processor.

TR1 Timer/counter 1 RUN bit, set it to 1 to enable the timer to count, 0 to stop counting.

TF0 Overflow interrupt flag, used by the processor.

TR0 Timer/counter 0 RUN bit, set it to 1 to enable the timer to count, 0 to stop counting.

As the IE register, TCON is also bit-addressable, so you can set its bit using its

names, like we did before. Example:

TR0 = 1;

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 26/31

Propeller LED Display

25

3.4.3.2The TMOD register

Before explaining the TMOD register, let us agree and make it clear that the register

IS NOT BIT-ADDRESSABLE, meaning you have to write the 8 bits of the register in

a single instruction, by coding those bits into a decimal or hexadecimal number, as

you shall see later.

So, as you can see in figure 16 , the TMOD register can be divided into two similar set

of bits, each group being used to configure the mode of operation of one of the two

timers.

For the given Timer/Counter, the corresponding bits of TMOD can be defined as in

the following table:

G

Gate signal. For normal operation clear this bit to 0.

If you want to use the timers to capture external events’s length, set it to 1, and the timer 1/0 will stop counting when

External Interrupt 1/0 pin is low (set to 0 V). Note that this feature involves both a timer and an external interrupt, It you’re

responsibility to write the code to manage the operation of those two peripherals.

C/T’ Set to 1 to use the timer/counter 1/0 as a Counter, counting external events on P3_4/P3_5, cleared to 0 to use it as timer,counting the main oscillator frequency divided by 12.

M1

Timer MODE: Those two last bits combine as 2 bit word that defines the mode of operation, defined as the table below.

M0

3.4.3.3Timer/counter modes of operation

Each timer/counter has two SFR called TL0 and TH0 (for timer/counter0) and TL1

and TH1 (for timer/counter 1). TL stands for timer LOW, and is used to store thelower bits of the number being counted by the timer/counter. TH stands for TH, and is

used to store the higher bits of the number being counted by the timer/counter.

M1 M0 Mode Description

Figure 18: TMOD register 

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 27/31

Propeller LED Display

26

0 0 0

Only TH0/1 is used, forming an 8bit timer/counter.

Timer/counter will count up from the value initially stored in TH0/1 to 255, and then overflow back

to 0.

If an interrupt is enabled, an interrupt will occur upon overflow.

If used as timer, pulses from the processor are divided by 32 (after being divided by 12). The result isthe main oscillator frequency divided by 384.

If used as counter, external pulses are only divided by 32.

0 1 1

Both TH0/1 and TL0/1 are used, forming a 16 bit timer/counter.

Timer/counter will count up from the 16 bit value initially stored in TH0/1 and TL0/1 to 65535, and

then overflow back to 0.

If an interrupt is enabled, an interrupt will occur upon overflow.

If used as timer, pulses from the processor are only divided by 12.

If used as counter, external pulses are not divided, but the maximum frequency that can be accurately

counted equals the oscillator frequency divided by 24.

1 0 2

TL0/1 is used for counting, forming an 8 bit timer/counter. TH0/1 is used to hold the value to be

restored in TL upon overflow.

Timer/counter will count up from the 8 bit value initially stored in TL0/1 and to 255, and then

overflow, setting the value of TH0/1 in TL0/1. This is called the auto-reload function.

If an interrupt is enabled, an interrupt will occur upon overflow.

If used as timer, pulses from the processor are only divided by 12.

If used as counter, external pulses are not divided, but the maximum frequency that can be accuratelycounted equals the oscillator frequency divided by 24.

1 1 3   This mode is beyond the scope of this tutorial.

Timer modes 1 and 2 are the most used in 8051 microcontroller projects, since they

offer a wide range of possible customization.

3.5 ALGORITHM

Main routine:

1. Load proper value in IE register, so that the interrupts INT0 and T0 are

enabled. (IE = 83H)

2. Offer higher priority to the INT0 (External) interrupt. (IP = 01H)

3. Configure timer 1 as 16-bit timer, and timer 0 as 8-bit auto reload mode timer.

( TMOD = 12H)

4. INT0 should be configured as edge interrupt. (IT0 = 1)

5. Configure port 3 as input port. (P3 = 0FFH)

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 28/31

Propeller LED Display

27

6. Move input string to the video RAM area. (call ‘ramc’ function)

7. Start the timers.

8. Initiate an infinite loop.

Interrupt Routines:

(a) External Interrupt:

1. Stop the timers.

2. Move th1 and tl1 into convenient registers.

3. Divide this 16 bit value by our total number of segments.

4. Subtract the answer from 256, and load the result in th0.

5. Now, reset the video RAM pointer and character segment pointers to their

initial respective positions.

6. Start the timers.

7. Return from interrupt.

(b) Timer 0 Interrupt:1. Call the display routine.

2. Clear timer overflow flag.

3. Return from interrupt.

4. Clear timer overflow flag.

5. Return from interrupt.

3.6 FLOW CHART

Figure 19: Flow chart of program

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 29/31

Propeller LED Display

28

FUTURE SCOPEWe can improvise this project in the following ways:-

1. We can make 3-Dimensional version of this display.

2. This display can be programmed as an Analog clock.

3. Real time digital clock can be easily programmed through this.4. Though we have tried our best to minimize the cost of project but it can

further be made cost efficient by cost cutting components.

5. The project can be made more compact with effective arrangement of all the

components.

6. Using 3-D version of this display, a very effective representation of earth’s

globe.

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 30/31

Propeller LED Display

29

TROUBLESHOOTING MANUAL

1. Output voltage of LM7805 is not 5V

Test the continuity throughout the wires, as shown in the circuit

diagram.

Replace appropriate component, if needed.

2. DC motor is not rotating

Check the current flowing through the motor. If it reaches above

750mA, then the motor is short, Replace it.

In case of jamming, try to grease the bearing and shaft.

3. The display rotates, but not displaying garbage values.

Check the red strip (Interrupt) is in proper position or not. If not,

adjust it.

4. Some or all LEDs not glowing.

Check the relimate connector, that connects the LED module to the

microcontroller.

Otherwise, check the continuity through each wire.

If the connections are ok, then replace the particular LED.

7/21/2019 Report Final PLKNJropeller

http://slidepdf.com/reader/full/report-final-plknjropeller 31/31

Propeller LED Display

Bibliography(a) J.B. Gupta, Electronic circuits and devices, 1sted,S.KKataria and Sons,2005

(b) Muhammed AliMazidi, Janice GillispieMazidi and Rolin D Mckinlay,The

8051 Microcontroller and Embedded System Using Assembly and C ,2nded,

Pearson, 2007

(c) Ramakant A. Gayakwad, Op Amp and Lineair Integrated Circuit ,2nded,Prentice Hall PTR, 2000

(d) K R Botkar, Integrated Circuits,2nded, Khanna Publisher,2003

(e) (2011)LogicBrigade website.[Online].Available:http://www.logicbrigade.com/


Recommended