Sunteți pe pagina 1din 49

1

Design and Implementation of ZIGBEE Based Billboard

2
TABLE OF CONTENTS
CHAPTER

TITLE

1.

2.

PAGE NO

ABSTRACT

INTRODUCTION

1.1

Block Diagram

1.2

Circuit Diagram

HARDWARE DESCRIPTION

3.

2.1

Introduction

2.2

Description

2.2.1

Memory Unit

2.2.2

Central Processing Unit

2.2.3

Input Output Unit

10

2.2.4

Serial communication

11

2.2.5

Timer Unit

13

2.2.6

AT89C51 MICROCONTROLLER

14

2.2.7

Description

14

2.2.8

Special Function Registers

15

MICROCONTROLLER INTERFACING
3.1

BILLBOARD
3.1.1

The EN control line

3.1.2

Checking the busy status of BILLBOARD

3.1.3

Initializing the BILLBOARD

3.1.4

Clearing the Display

21

22
22
3.1.5

23

Writing text to the BILLBOARD

24
3.1.6
3.2

Cursor Positioning

ZIGBEE MODULE

26

3
3.2.1

Key features
3.2.2

28

Specifications

29

3.3
4.

3.2.3

Pin Signals

30

3.2.4

Electrical Characteristics

31

3.2.5

Flow control

32

RS232 serial connector pin assignment


DESCRIPTION OF DEVELOPMENT SYSTEM
4.1

4.2
5.

6.

34

Cross Compilers

35

4.1.1

Introduction to Keil

36

4.1.2

Functioning of Keil

36

4.1.3

Development tools in keil

37

4.1.4

C51 Optimizing C Cross Compiler

38

4.1.5

A51 Macro Assembler

39

4.1.6

BL51 Code Banking Linker/Locator

40

4.1.7

OC51 banked object file converter

40

4.1.8

OH51 object hex converter

40

4.1.9

VISION/51 FOR WINDOWS

41

TARGET PROCESSOR

42

APPLICATION SOFTWARE
5.1

Application software description

45

5.2

Screen Shots

46

CONCLUSION

46

ABSTRACT
The objective of our project is to design and implement zigbee based Advertising
billboard system. Our goals is to design an electronic billboard that can show images,
perhaps even animated ones, and is able to receive new ones remotely. This design
constructed using super E-paper has to have several features. First, new data should be
able to be received. So a receiver is necessary. In order to be able to receive data
remotely, some sort of wireless system has to be set up.
To process the data accordingly, a controller has to be configured. This controller
also has to show the image on a screen. Some sort of micro processing unit is required to
do this task.
In the case of a slideshow of images or even an animation, data has to be stored in
memory. The choice of what to type of storage to use is an important one as well. It has to
be fast enough to both store new data while continuing retrieve data to send to the screen.
LITERATURE REVIEW OVERVIEW
XBee and XBee-PRO Modules were engineered to meet
ZigBee/IEEE 802.15.4 standards and support the unique needs of low-cost, low-power
wireless sensor networks. The modules require minimal power and provide reliable
delivery of critical data between devices. The modules operate within the ISM 2.4 GHz
frequency band and are pin-for-pin compatible with each other.

KEY FEATURES:

Long Range Data Integrity:


XBee Range
Indoor/Urban: up to 100 (30 m)
Outdoor line-of-sight: up to 300 (100 m)
Transmit Power: 1 mW (0 dBm)
Receiver Sensitivity: -92 dBm
XBee-PRO Range
Indoor/Urban: up to 300 (100 m)
Outdoor line-of-sight: up to 1 mile (1500 m)
Transmit Power: 100 mW (20 dBm) EIRP
Receiver Sensitivity: -100 dBm
RF Data Rate: 250,000
Advanced Networking & Security
Retries and Acknowledgements
DSSS (Direct Sequence Spread Spectrum)
Each direct sequence channels has over 65,000 unique network addresses
available
Point-to-point, point-to-multipoint and peer-to-peer topologies supported
128-bit Encryption

6
METHODOLOGY
SHORTCOMINGS OF THE EXISTING SYSTEM:
Every bus stop and billboard has a paper advertisement inside. The
reason for this is simple; paper is easy to use and extremely cheap. However,
it has some drawbacks as well. Before an image is actually on the street, it
first has to be printed, pasted and placed. The journey from design to
placement is quite long. Another major disadvantage is the considerable
amount of waste generated by the use of paper. Finally, many people just
ignore a paper advertisement. Their attention is drawn to the vibrant
environment around them and not to a still image.

PLAN OF IMPLEMENTATION:
This project is implemented in various stages mentioned below
STAGE 1: Implementation of Application
STAGE 2: Implementation of Zigbee Protocol.
STAGE 3: Implementation of BILLBOARD display
STAGE 4: System Integration and Testing
STAGE 1:
An application software is been created to send the data to the microcontroller
which is been connected with the billboard. The application software is created by using
Microsoft Visual Studio. It will run on the PC and send the data to the microcontroller by
using Zigbee transceiver.
STAGE 2:
The Zigbee transmitter at the transmitter side will send the data to the Zigbee
receiver which is present at the receiver side. The Zigbee Receiver stores the data in the
microcontroller. The received data is displayed in the BILLBOARD screen.

STAGE 3:
BILLBOARD display has the capacity to display whatever we are promoting in
programming for microcontroller if microcontroller sends appropriate commands to it. In
our project it displays the status of the mailbox and the operation of our project.
BILLBOARD has two ports to be connected with microcontroller, one is for control
lines, another one is for data lines, this data lines will carry the data to be displayed in
BILLBOARD display and control lines gets the control commands for BILLBOARD in
which place data has to display.
STAGE 4:
Each and Every part of our project will be integrated as given below,
Zigbee can be connected to the microcontroller to receive data from it. And
Microcontroller will be connected with BILLBOARD display, the BILLBOARD used to
display the data. This whole section has been tested by giving power supply in it. By
using of this project the automatic delivery of mails/couriers can be easily monitored.

1. INTRODUCTION
Outdoor advertising is mainly characterized by the use of paper. Every bus stop
and billboard has a paper advertisement inside. The reason for this is simple; paper is
easy to use and extremely cheap. However, it has some drawbacks as well. Before an
image is actually on the street, it first has to be printed, pasted and placed. The journey
from design to placement is quite long. Another major disadvantage is the considerable
amount of waste generated by the use of paper. Finally, many people just ignore a paper
advertisement. Their attention is drawn to the vibrant environment around them and not
to a still image. So not surprisingly, the advertising industry has been searching for years
to find an alternative for this kind of advertising. Usually the only alternative that is
found is using an BILLBOARD screen with a controller, a so-called digital screen. These
can show animated images and can be updated instantly and remotely. This reduces the
journey from design to placement to only a couple of minutes. However, digital screens
have not been deployed in great numbers. This is because no satisfying products exist
thus far. This is due to several problems with the modernization of outdoor advertising.
First, it is still too expensive; it is practically impossible to compete with paper on a
financial level. Also, since the objects are outside all the time, they are vulnerable to
vandalism. Paper posters are easily replaced, but its digital counterpart is quite a lot more
expensive when it gets destroyed and needs to be replaced. Lastly, an electronic billboard
requires a lot of energy, which is both a waste of money and harmful to the environment.
A possible alternative is super E-paper. Super E-paper has many of the advantages
of conventional paper and digital billboards, without many drawbacks. For instance, once
a data has been loaded onto super E-paper, it doesnt need to be refreshed anymore. This
decreases its energy consumption significantly. Also, just like a digital screen, it can be
updated instantly and remotely. Besides this, super E-paper is relatively cheap and has
paper-like visibility and flexibility.

1.1 BLOCK DIAGRAM

Transmitter Section:

The Zigbee and gsm module transceiver is connected with the PC via the serial
port. The GUI is run on the PC to get the data from the user. GUI is created by using
Microsoft Visual Studio.

10

Receiver Section:

The receiver section has the microcontroller P89V51RD2 is an 8-bit


microcontroller which run with the frequency of 11.0592MHz. The Zigbee transceiver is
connected with the microcontroller via the serial port. The billboard(BILLBOARD) is
connected with the parallel ports of the microcontroller to get the data from the
microcontroller. The billboard will display the data which is given in the transmitter side
by using the GUI.

11

1.2 CIRCUIT DIAGRAM FOR TRANSMITTER SECTION

CIRCUIT DIAGRAM FOR RECEIVER SECTION:

12

2. HARDWARE DESCRIPTION
2. HARDWARE DESCRIPTION
2.1 INTRODUCTION TO TARGET PROCESSOR
Microcontroller differs from a microprocessor in many ways. First and the most
important is its functionality. In order for a microprocessor to be used, other components
such as memory, or components for receiving and sending data must be added to it. In short
that microprocessor is the very heart of the computer. On the other hand, microcontroller is
designed to be all of that in one. No other external components are needed for its
application because all necessary peripherals are already built into it. Thus, we save the
time and space needed to construct devices .this chapter deals with the study of
microcontrollers.

2.2 DESCRIPTION TO EMBEDDED CONTROLLERS


Microcontroller, as the name suggests, are small controllers. These are like single chip
computers that are often embedded into systems to function as processing /controllers unit. For
example, the remote control you are using probably has microcontrollers inside that do
decoding and other controlling functions. They are also used in automobiles, washing
machines, microwave ovens, toysetc, where automation is needed. The key features of
microcontrollers include:

13
High integration of Functionality
Microcontrollers sometimes are called single chip computers because they have
on-chip memory and I/O circuitry and other circuitries that enable them to
function as small standalone computers without other supporting circuitry.
Field Programmability, Flexibility
Microcontrollers often use EEPROM or EPROM as their storage device to
allow field programmability so they are flexible to use. Once the program is tested to
be correct then large quantities of microcontrollers can be programmed to be used in
embedded systems.
Easy to Use
Assembly language is often used in microcontroller and since they usually
follow RISC architecture, the instruction set is small. The development package of
microcontrollers often includes an assembler ,a simulator ,a programmer to burn the
chip and a demonstration board .Some packages include a high level language compiler
such as a C compiler and more sophisticated libraries.

The main units of a microcontroller are discussed below:-

2.2.1MEMORY UNIT
Memory is part of the microcontrollers whose function is to store data.
The easiest way to explain it is to describe it as one big closet with lots of drawers. If
we suppose that we marked the drawers in such a way that they cant be confused, any of their
contents will then be easily accessible. It is enough to know the designation of the drawer and
so its contents will be known to us for sure.

14

Fig 2.2.1 Memory Unit of Microcontroller


Memory components are exactly like that. For a certain input we get the contents of a
certain addressed memory location and thats all. Two new concepts are brought to us:
addressing and memory location. Memory consists of all memory locations, and addressing is
nothing but selecting one of them. This means that we need to select the desired memory
location on one hand, and on the other hand we need to wait for the contents of that location.
Besides reading from a memory location, memory must also provide for writing onto it. This is
done by supplying an additional line called control line. We will designate this line as R/W
(read/write). Control line used in the following way: if r/w=1, reading is done, and if opposite
is true then writing is done on the memory location. Memory is the first element, and we need
a few operation of our microcontroller.

2.2.2 CENTRAL PROCESSING UNIT


Let add three memory locations to a specific block that will have a built in capability to
multiply, divide, subtract, and move its contents from one memory location onto another. The
part we just in is called Central Processing Unit (CPU). Its memory locations are called
registers.

15

Fig 2.2.2 Central Processing Unit of Microcontroller


Registers are therefore memory locations whose role is to help with performing various
mathematical operations or any other operations with data wherever data can be found. Look at
the current situation. We have two independent entities (memory and CPU) which are
interconnected, and thus any exchange of data is hindered, as well as its functionality. If, for
example, we wish to add the contents of two memory locations and return the result again back
to memory, we would need a connection between memory and CPU. Simply stated, we must
have some way though data goes from one block to another.

2.2.3 Input-Output Unit


Those locations weve just added are called ports. There are several types of ports:
Input, output or bidirectional ports. When working with ports, first of all it is necessary to
choose which port we need to work with, and then to send data to, or take it from the port.

16

Fig 2.2.3 Input-Output Unit of Microcontroller


When working with it the port acts like a memory location. Something is simply being
written into or read from it, and it could be noticed on the pins of the microcontroller.

2.2.4 Serial Communication:


Beside stated above weve added to the already existing unit the possibility of
communication with an outside world. However, this way of communicating has drawbacks.
One of the basic drawbacks is the number of lines which need to be used in order to transfer
data. What if it is being transferred to a distance of several kilometers? The number of lines
times numbers of kilometers doesnt promise the economy of the project. It leaves us having
to reduce the number of lines in such a way that we dont lessen its functionality. Suppose we
are working with three lines only, and that one line is used for sending data ,other for receiving,
and the third one is used as a reference line for both the input and output side. In order for this
to work, we need to set the rules of exchange of data. These rules are called protocol. Protocol
is therefore defined in advance so there wouldnt be any misunderstanding between the sides
that are communicating with each other. The logical unit 1 is set up on the transmitting line
until transfer begins. Once the transfer starts, we lower the transmission line to logical 0 for a
period of time (which we will designate as T), so the receiving side will know that it is
receiving data, and so it will activate its mechanism for reception. Lets go back now to the
transmission side and start putting logic zeros and ones the transmitter line in the order from a
bit of the lowest value to a bit of the highest value. Let each bit stay on line for a time period
which is equal to T, and in the end, or after the 8 th bit. Let us bring the logical unit 1 back on

17
the line which will mark the end of the transmission of one data. The protocol weve just
described is called in professional literature NRZ (Non-Return to Zero).

Fig 2.2.4 Serial Communication


As we have separate lines for receiving and sending, it is possible to receiving and
sends data at the same time. So called full-duplex mode block which enables this way of
communication is called a serial communication block.
Unlike the parallel transmission, data moves here bit by bit, or in a series of bits what defines
the term serial communication comes from. After the reception of data we need to read it from
the receiving location and store it in memory as opposed to sending where the process is
reversed. Data goes from memory through the buys to the sending location, and then to the
receiving unit according unit according to the protocol.

18

2.2.5 Timer Unit


Since we have the serial communication explained, we can receive, send and Process
data.

Fig 2.2.5 Timer


However, in order to utilize it in industry we need a few additionally blocks. One of
those is the timer block which is significant to us because it can give us information about
time, duration, protocol etc. The basic unit of the timer is a free-run counter which is in fact a
register whose numeric value increments by one in even intervals, so that by taking its value
during periods T1 and T2 and on the basis of their difference we can determine how much time
has elapsed. This is a very important part of the microcontroller whose understanding requires
most of our time.

2.2.6 FEATURES OF AT89C51 MICROCONTROLLER (TARGET


PROCESSOR)
Features:
Compatible with MCS-51 Products
4K Bytes of In-System Reprogrammable Flash Memory
Endurance: 1,000 Write/Erase Cycles
Fully Static Operation: 0 Hz to 24 MHz
Three-Level Program Memory Lock
128 x 8-Bit Internal RAM
32 Programmable I/O Lines
Two 16-Bit Timer/Counters
Six Interrupt Sources
Programmable Serial Channel
Low Power Idle and Power Down Modes

19
Description
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer
with 4K bytes of Flash Programmable and Erasable Read Only Memory (PEROM). The
device is manufactured using Atmels high density nonvolatile memory technology and is
compatible with the industry standard MCS-51 instruction set and pinout. The on-chip
Flash allows the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a
monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a
highly flexible and cost effective solution to many embedded control applications
Pin Configurations

The AT89C51 provides the following standard features: 4K bytes of Flash, 128
bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt
architecture, a full duplex serial port, on-chip oscillator and clock circuitry. In addition,
the AT89C51 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU
while allowing the RAM, timer/counters, serial port and interrupt system to continue
functioning. The Power down Mode saves the RAM contents but freezes the oscillator
disabling all other chip functions until the next hardware reset.

20

Pin Description
VCC
Supply voltage.
GND
Ground.
Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as
highimpedance inputs.
Port 0 may also be configured to be the multiplexed loworder address/data bus during
accesses to external program and data memory. In this mode P0 has internal pullups.

21
Port 0 also receives the code bytes during Flash programming, and outputs the code bytes
during program verification. External pullups are required during program verification.
Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1 output buffers
can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high
by the internal pullups and can be used as inputs. As inputs, Port 1 pins that are externally
being pulled low will source current (IIL) because of the internal pullups. Port 1 also
receives the low-order address bytes during Flash programming and verification.
Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pullups. The Port 2 output buffers
can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high
by the internal pullups and can be used as inputs. As inputs, Port 2 pins that are externally
being pulled low will source current (IIL) because of the internal pullups. Port 2 emits the
high-order address byte during fetches from external program memory and during
accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this
application it uses strong internal pull-ups when emitting 1s. During accesses to external
data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2
Special Function Register. Port 2 also receives the high-order address bits and some
control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high
by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally
being pulled low will source current (IIL) because of the pullups. Port 3 also serves the
functions of various special features of the AT89C51 as listed below:

Port 3 also receives some control signals for Flash programming and verification.
RST
Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device.
ALE/PROG
Address Latch Enable output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during
Flash programming.

22
In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and
may be used for external timing or clocking purposes. Note, however, that one ALE
pulse is skipped during each access to external Data Memory. If desired, ALE operation
can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only
during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting
the ALE-disable bit has no effect if the microcontroller is in external execution mode.
PSEN
Program Store Enable is the read strobe to external program memory When the AT89C51
is executing code from external program memory, PSEN is activated twice each machine
cycle, except that two PSEN activations are skipped during each access to external data
memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.
Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.
EA should be strapped to VCC for internal program executions. This pin also receives the
12-volt programming enable voltage (VPP) during Flash programming, for parts that
require 12-volt VPP.
XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a
quartz crystal or ceramic resonator may be used. To drive the device from an external
clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in
Figure 2.
There are no requirements on the duty cycle of the external clock signal, since the input
to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and
maximum voltage high and low time specifications must be observed.
Idle Mode
In idle mode, the CPU puts itself to sleep while all the onchip peripherals remain active.
The mode is invoked by software. The content of the on-chip RAM and all the special
functions registers remain unchanged during this mode. The idle mode can be terminated
by any enabled interrupt or by a hardware reset. It should be noted that when idle is
terminated by a hard ware reset, the device normally resumes program execution,
from where it left off, up to two machine cycles before the internal reset algorithm takes
control. On-chip hardware inhibits access to internal RAM in this event, but access to
the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port
pin when Idle is terminated by reset, the instruction following the one that invokes Idle
should not be one that writes to a port pin or to external memory.

23

24
3. MICROCONTROLLER INTERFACING
3.1. BILLBOARD:
Frequently, an 8051 program must interact with the outside world using input and
output devices that communicate directly with a human being. One of the most common
devices attached to an 8051 is a BILLBOARD display. Some of the most common
BILLBOARDs connected to the 8051 are 16x2 and 20x2 displays. This means 16
characters per line by 2 lines and 20 characters per line by 2 lines, respectively.
Fortunately, a very popular standard exists which allows us to communicate with
the vast majority of BILLBOARDs regardless of their manufacturer. The standard is
referred to as HD44780U, which refers to the controller chip which receives data from an
external source (in this case, the 8051) and communicates directly with the
BILLBOARD.
44780 BACKGROUND
The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for
the data bus. The user may select whether the BILLBOARD is to operate with a 4-bit
data bus or an 8-bit data bus. If a 4-bit data bus is used the BILLBOARD will require a
total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an 8-bit data bus is
used the BILLBOARD will require a total of 11 data lines (3 control lines plus the 8 lines
for the data bus).
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the BILLBOARD
that you are sending it data. To send data to the BILLBOARD, your program should
make sure this line is low (0) and then set the other two control lines and/or put data on
the data bus. When the other lines are completely ready, bring EN high (1) and wait for
the minimum amount of time required by the BILLBOARD datasheet (this varies from
BILLBOARD to BILLBOARD), and end by bringing it low (0) again.

25
The RS line is the "Register Select" line. When RS is low (0), the data is to be
treated as a command or special instruction (such as clear screen, position cursor, etc.).
When RS is high (1), the data being sent is text data which sould be displayed on the
screen. For example, to display the letter "T" on the screen you would set RS high.
The RW line is the "Read/Write" control line. When RW is low (0), the
information on the data bus is being written to the BILLBOARD. When RW is high (1),
the program is effectively querying (or reading) the BILLBOARD. Only one instruction
("Get BILLBOARD status") is a read command. All others are write commands--so RW
will almost always be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation
selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0,
DB1, DB2, DB3, DB4, DB5, DB6, and DB7.
AN EXAMPLE HARDWARE CONFIGURATION
As we've mentioned, the BILLBOARD requires either 8 or 11 I/O lines to
communicate with. For the sake of this tutorial, we are going to use an 8-bit data bus--so
we'll be using 11 of the 8051's I/O pins to interface with the BILLBOARD.
Let's draw a sample psuedo-schematic of how the BILLBOARD will be connected to the
8051.

26
As you can see, we've established a 1-to-1 relation between a pin on the 8051 and
a line on the 44780 BILLBOARD. Thus as we write our assembly program to access the
BILLBOARD, we are going to equate constants to the 8051 ports so that we can refer to
the lines by their 44780 name as opposed to P0.1, P0.2, etc. Let's go ahead and write our
initial equates:
DB0 EQU P1.0
DB1 EQU P1.1
DB2 EQU P1.2
DB3 EQU P1.3
DB4 EQU P1.4
DB5 EQU P1.5
DB6 EQU P1.6
DB7 EQU P1.7
EN EQU P3.7
RS EQU P3.6
RW EQU P3.5
DATA EQU P1
3.3.1 HANDLING THE EN CONTROL LINE
As we mentioned above, the EN line is used to tell the BILLBOARD that you are
ready for it to execute an instruction that you've prepared on the data bus and on the other
control lines. Note that the EN line must be raised/lowered before/after each instruction
sent to the BILLBOARD regardless of whether that instruction is read or write, text or
instruction. In short, you must always manipulate EN when communicating with the
BILLBOARD. EN is the BILLBOARD's way of knowing that you are talking to it. If you
don't raise/lower EN, the BILLBOARD doesn't know you're talking to it on the other
lines.
Thus, before we interact in any way with the BILLBOARD we will always bring
the EN line low with the following instruction:
CLR EN
And once we've finished setting up our instruction with the other control lines and
data bus lines, we'll always bring this line high:
SETB EN

27
The line must be left high for the amount of time required by the BILLBOARD as
specified in its datasheet. These are normally on the order of about 250 nanoseconds, but
check the datasheet. In the case of a typical 8051 running at 12 MHz, an instruction
requires 1.08 microseconds to execute so the EN line can be brought low the very next
instruction. However, faster microcontrollers (such as the DS89C420 which executes an
instruction in 90 nanoseconds given an 11.0592 Mhz crystal) will require a number of
NOPs to create a delay while EN is held high. The number of NOPs that must be inserted
depends on the microcontroller you are using and the crystal you have selected.
The instruction is executed by the BILLBOARD at the moment the EN line is
brought low with a final CLR EN instruction.
3.3.2 CHECKING THE BUSY STATUS OF THE BILLBOARD
As previously mentioned, it takes a certain amount of time for each instruction to
be executed by the BILLBOARD. The delay varies depending on the frequency of the
crystal attached to the oscillator input of the 44780 as well as the instruction which is
being executed.
While it is possible to write code that waits for a specific amount of time to allow
the BILLBOARD to execute instructions, this method of "waiting" is not very flexible. If
the crystal frequency is changed, the software will need to be modified. Additionally, if
the BILLBOARD itself is changed for another BILLBOARD which, although 44780
compatible, requires more time to perform its operations, the program will not work until
it is properly modified.
A more robust method of programming is to use the "Get BILLBOARD Status"
command to determine whether the BILLBOARD is still busy executing the last
instruction received.
The "Get BILLBOARD Status" command will return to us two tidbits of
information; the information that is useful to us right now is found in DB7. In summary,
when we issue the "Get BILLBOARD Status" command the BILLBOARD will
immediately raise DB7 if it's still busy executing a command or lower DB7 to indicate

28
that the BILLBOARD is no longer occupied. Thus our program can query the
BILLBOARD until DB7 goes low, indicating the BILLBOARD is no longer busy. At that
point we are free to continue and send the next command.
Since we will use this code every time we send an instruction to the
BILLBOARD, it is useful to make it a subroutine. Let's write the code:
WAIT_BILLBOARD:
CLR EN ;Start BILLBOARD command
CLR RS ;It's a command
SETB RW ;It's a read command
MOV DATA,#0FFh ;Set all pins to FF initially
SETB EN ;Clock out command to BILLBOARD
MOV A,DATA ;Read the return value
JB ACC.7,WAIT_BILLBOARD ;If bit 7 high, BILLBOARD still busy
CLR EN ;Finish the command
CLR RW ;Turn off RW for future commands
RET
3.3.3 INITIALIZING THE BILLBOARD
Before you may really use the BILLBOARD, you must initialize and configure it.
This is accomplished by sending a number of initialization instructions to the
BILLBOARD.
The first instruction we send must tell the BILLBOARD whether we'll be
communicating with it with an 8-bit or 4-bit data bus. We also select a 5x8 dot character
font. These two options are selected by sending the command 38h to the BILLBOARD as
a command. As you will recall from the last section, we mentioned that the RS line must
be low if we are sending a command to the BILLBOARD. Thus, to send this 38h
command to the BILLBOARD we must execute the following 8051 instructions:
CLR RS
MOV DATA,#38h
SETB EN
CLR EN
LCALL WAIT_BILLBOARD
So, in all, our initialization code is as follows:

29
INIT_BILLBOARD:
CLR RS
MOV DATA,#38h
SETB EN
CLR EN
LCALL WAIT_BILLBOARD
CLR RS
MOV DATA,#0Eh
SETB EN
CLR EN
LCALL WAIT_BILLBOARD
CLR RS
MOV DATA,#06h
SETB EN
CLR EN
LCALL WAIT_BILLBOARD
RET
Having executed this code the BILLBOARD will be fully initialized and ready for
us to send display data to it.
3.3.4 CLEARING THE DISPLAY
When the BILLBOARD is first initialized, the screen should automatically be
cleared by the 44780 controller. However, it's always a good idea to do things yourself so
that you can be completely sure that the display is the way you want it. Thus, it's not a
bad idea to clear the screen as the very first operation after the BILLBOARD has been
initialized.
An BILLBOARD command exists to accomplish this function. Not surprisingly,
it is the command 01h. Since clearing the screen is a function we very likely will wish to
call more than once, it's a good idea to make it a subroutine:
CLEAR_BILLBOARD:
CLR RS
MOV DATA,#01h
SETB EN
CLR EN
LCALL WAIT_BILLBOARD
RET
How that we've written a "Clear Screen" routine, we may clear the BILLBOARD
at any time by simply executing an LCALL CLEAR_BILLBOARD.

30
3.3.5 WRITING TEXT TO THE BILLBOARD
Now we get to the real meat of what we're trying to do: All this effort is really so
we can display text on the BILLBOARD. Really, we're pretty much done.
Once again, writing text to the BILLBOARD is something we'll almost certainly
want to do over and over--so let's make it a subroutine.
WRITE_TEXT:
SETB RS
MOV DATA,A
SETB EN
CLR EN
LCALL WAIT_BILLBOARD
RET
The WRITE_TEXT routine that we just wrote will send the character in the
accumulator to the BILLBOARD which will, in turn, display it. Thus to display text on
the BILLBOARD all we need to do is load the accumulator with the byte to display and
make a call to this routine.
A "HELLO WORLD" PROGRAM
Now that we have all the component subroutines written, writing the classic
"Hello World" program--which displays the text "Hello World" on the BILLBOARD is a
relatively trivial matter. Consider:
LCALL INIT_BILLBOARD
LCALL CLEAR_BILLBOARD
MOV A,#'H'
LCALL WRITE_TEXT
MOV A,#'E'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#' '
LCALL WRITE_TEXT

31
MOV A,#'W'
LCALL WRITE_TEXT
MOV A,#'O'
LCALL WRITE_TEXT
MOV A,#'R'
LCALL WRITE_TEXT
MOV A,#'L'
LCALL WRITE_TEXT
MOV A,#'D'
LCALL WRITE_TEXT
The above "Hello World" program should, when executed, initialize the
BILLBOARD, clear the BILLBOARD screen, and display "Hello World" in the upper
left-hand corner of the display.
3.3.6 CURSOR POSITIONING
The above "Hello World" program is simplistic in the sense that it prints its text in
the upper left-hand corner of the screen. However, what if we wanted to display the word
"Hello" in the upper left-hand corner but wanted to display the word "World" on the
second line at the tenth character? This sounds simple--and actually, it is simple.
However, it requires a little more understanding of the design of the BILLBOARD.
The 44780 contains a certain amount of memory which is assigned to the display.
All the text we write to the 44780 is stored in this memory, and the 44780 subsequently
reads this memory to display the text on the BILLBOARD itself. This memory can be
represented with the following "memory map":

In the above memory map, the area shaded in blue is the visible display. As you
can see, it measures 16 characters per line by 2 lines. The numbers in each box is the
memory address that corresponds to that screen position.

32
Thus, the first character in the upper left-hanad corner is at address 00h. The
following character position (character #2 on the first line) is address 01h, etc. This
continues until we reach the 16th character of the first line which is at address 0Fh.
However, the first character of line 2, as shown in the memory map, is at address
40h. This means if we write a character to the last position of the first line and then write
a second character, the second character will not appear on the second line. That is
because the second character will effectively be written to address 10h--but the second
line begins at address 40h.
Thus we need to send a command to the BILLBOARD that tells it to position the
cursor on the second line. The "Set Cursor Position" instruction is 80h. To this we must
add the address of the location where we wish to position the cursor. In our example, we
said we wanted to display "World" on the second line on the tenth character position.
3.2 ZIGBEE :
3.2.1 KEY FEATURES:
Long Range Data Integrity:
XBee Range

Indoor/Urban: up to 100 (30 m)


Outdoor line-of-sight: up to 300 (100 m)
Transmit Power: 1 mW (0 dBm)
Receiver Sensitivity: -92 dBm
XBee-PRO Range

Indoor/Urban: up to 300 (100 m)


Outdoor line-of-sight: up to 1 mile (1500 m)
Transmit Power: 100 mW (20 dBm) EIRP
Receiver Sensitivity: -100 dBm
RF Data Rate: 250,000

Advanced Networking & Security


Retries and Acknowledgements
DSSS (Direct Sequence Spread Spectrum)

33
Each direct sequence channels has over 65,000 unique network addresses
available
Point-to-point, point-to-multipoint and peer-to-peer topologies supported
128-bit Encryption

3.2.2 SPECIFICATIONS:

34

3.2.3 PIN SIGNALS:

35

3.2.4 ELECTRICAL CHARACTERISTICS:

Fig 5.k
3.2.5 FLOW CONTROL:

36

Fig 5.l
DI (Data In) Buffer:
When serial data enters the RF module through the DI pin (pin 3), the data is
stored in the DI Buffer until it can be processed.
Hardware Flow Control (CTS):
When the DI buffer is 17 bytes away from being full; by default, the module deasserts CTS (high) to signal to the host device to stop sending data [refer to D7 (DIO7
Configuration) parameter]. CTS is re-asserted after the DI Buffer has 34 bytes of memory
available.
How to eliminate the need for flow control:
1. Send messages that are smaller than the DI buffer size.
2. Interface at a lower baud rate [BD (Interface Data Rate) parameter] than the
throughput data rate.

Case in which the DI Buffer may become full and possibly overflow:

37
If the module is receiving a continuous stream of RF data, any serial data that
arrives on the DI pin is placed in the DI Buffer. The data in the DI buffer will be
transmitted over-the-air when the module is no longer receiving RF data in the network.
DO (Data Out) Buffer:
When RF data is received, the data enters the DO buffer and is sent out the serial
port to a host device. Once the DO Buffer reaches capacity, any additional incoming RF
data is lost.
Hardware Flow Control (RTS):
If RTS is enabled for flow control (D6 (DIO6 Configuration) Parameter = 1), data
will not be sent out the DO Buffer as long as RTS (pin 16) is de-asserted.
Two cases in which the DO Buffer may become full and possibly overflow:
1. If the RF data rate is set higher than the interface data rate of the module, the module
will receive data from the transmitting module faster than it can send the data to the host.
2. If the host does not allow the module to transmit data out from the DO buffer because
of being held off by hardware or software flow control
3.3 RS232 SERIAL CONNECTOR PIN ASSIGNMENT:
The RS232 connector was originally developed to use 25 pins. In this DB25
connector pinout provisions were made for a secondary serial RS232 communication
channel. In practice, only one serial communication channel with accompanying
handshaking is present. Only very few computer have been manufactured where both
serial RS232 channels are implemented. Also on a number of Telebit modem models the
secondary channel is present. It can be used to query the modem status while the modem
is on-line and busy communicating. On personal computers, the smaller DB9 version is
more commonly used today. The diagrams show the signals common to both connector
types in black. The defined pins only present on the larger connector are shown in red.

38
Note, that the protective ground is assigned to a pin at the large connector where the
connector outside is used for that purpose with the DB9 connector version.
RS232 DB9 pinout

The pinout is also shown for the DEC modified modular jack. This type of
connector has been used on systems built by Digital Equipment Corporation; in the early
days one of the leaders in the mainframe world. Although this serial interface is
differential (receive and transmit have their own floating ground level which is not the
case with regular RS232) it is possible to connect RS232 compatible devices with this
interface because the voltage levels of the bit streams are in the same range. Where the
definition of RS232 focussed on the connection of DTE, data terminal equipment
(computers, printers, etc.) with DCE, data communication equipment (modems), MMJ
was primarily defined for the connection of two DTE's directly.

39

Signal

9-pin
DTE

25-pin
DCE

Carrier Detect

CD

from Modem

Receive Data

RD

from Modem

Transmit Data

TD

from Terminal/Computer

DTR

20

from Terminal/Computer

Signal Ground

SG

from Modem

Data Set Ready

DSR

from Modem

Request to Send

RTS

from Terminal/Computer

Clear to Send

CTS

from Modem

Ring Indicator

RI

Description

Data Terminal Ready

22

Source DTE or DCE

from Modem

40

4. DESCRIPTION OF DEVELOPMENT SYSTEM


4.1 CROSS COMPILERS
First of all we begin this chapter by giving a brief introduction about cross
compilers in embedded programming and their applications. We know that the execution
of code in a microcontroller takes place as a hexadecimal code. So we can program any
microcontroller using an assembly language. Also though the use of cross compilers we
can program the microcontrollers in any language like C or C++.
The cross compiler acts as a bridge between the programming software and
microcontrollers. Suppose we are programming the microcontroller using C the code
written in C language cannot be directly executed by microcontroller. So this code
written in C is fed to a cross compiler which converts into hexadecimal code which is
understood and executed by microcontroller. The advantages of using cross compilers is
that in case of some applications programming the microcontroller using assembly
language will become bulk and tedious. So when we use cross compilers we can program
the microcontroller in any other language which is easy to program and debug also. The
commonly used cross compilers are SDCC (Small devices C compiler), Keil etc.
In this our project the use of Keil cross compiler is to program the
microcontroller. In this chapter we discuss the introduction to programming in Keil
features of Keil and finally advantages of using Keil when compared to other cross
compilers. When we are writing program for any microcontroller using cross compiler we
cannot directly write the converted code on to the microcontroller. This means we need to
use a special technique to load the program into the microcontroller. One of the methods
is to use a microcontroller with a flash memory. Flash memory is similar to erasable
programmable read only memory. So once program is written and debugged using cross
compiler, we need to flash the program on to the flash memory of the memory. Once
program is flashed the microcontroller is loaded with the hex code and it will be ready for
execution.

41
4.1.1 INTRODUCTION TO KEIL:
Keil software provides the premier 8051 development tools to industry .The keil
software comprises of different tool kits. A tool kit consist of several application program
that we can use to create our 8051 application .When we use keil software for our project
the development cycle is some what similar to a software development project .It consist
of creating source file in C or assembly language compiling or assembling the source
files

debugging error in the source file, linking file from complier and assembler and

finally building a project linking all the files and testing the linked application.
4.1.2 FUNCTIONING OF KEIL
All the files are created through the micro vision integrated development
environment are then passed to the C51 compiler or A51 assembler. The compiler and
assembler process source files and create relocatable object files. Object files created by
the compiler or assembler may be used by the library manager to create a library. A
library is a specially formatted, ordered program collection of object modules that linker
can process. When the linker processes a library, only the object modules in the library
necessary for program creation are used. Object files created by the compiler and
assembler and library files created by the library manager are processed by the linker to
create an absolute object module. An absolute object file or module is an object file with
no relocatable code. All the code in an absolute object file resides at fixed locations.
The absolute object file created by the linker may be used to program EPROM or
other memory devices. The absolute object module may also be used with the dScope-51
debugger / simulator or with an in-circuit emulator. The dScope-51 source level
debugger/simulator is ideally suited for fast, reliable high-level-language program
debugging. The debugger contains a high-speed simulator and a target debugger that let
you simulate an entire 8051 system including on-chip peripherals. By loading specific
I/O drivers, we can simulate the attributes and peripherals of a variety of 8051 family.
The RTX-51 real time operating system is a multitasking kernel for the 8051 family. The
RTX-51 real time kernel simplifies the system design, programming, and debugging of
complex applications where fast reaction to time critical event is essential. The kernel is

42
fully integrated into the C51compiler and is easy to use. Task description tables and
operating system consistency are automatically controlled by the BL51 code banking
linker/locater.
4.1.3 DEVELOPMENT TOOLS IN KEIL
The Fig 4.1 shows the full extent of the Keil Software 8051 development tools.
The tools listed in this diagram comprise the professional developers kit. In addition to
the professional kit, Keil Software provides a number of other tool kits for the 8051
developer. The most capable kit is the professional developers kit is described as
follows:
The professional developers kit includes everything the professional 8051
developer needs to create sophisticated embedded applications. This tool kit includes the
following components:

C51 Optimizing C compiler,

A51 Macro Assembler,

BL51 Code Banking Linker/Locator,

OC51 Banked Object file converter,

OH51 Object-Hex converter,

LIB51 Library Manager,

dScope-1 Simulator/debugger,

tScope-51 Target Debugger,

Monitor-51 ROM Monitor and Terminal Program,

Integrated Development Environment,

RTX-51 Tiny Real-Time Operating System.

43
In addition, the professional developers kit includes the following tools for Windows
users:

dScope-51 Simulator/Debugger for windows,

Micro Vision/51 Integrated Development Environment for windows.

The professional developers kit can be configured for all 8051 derivatives. The tools
included in this kit can run any compatible computer.
4.1.4 C51 OPTIMIZING C CROSS COMPILER
The C programming language is a general-purpose programming language that
provides code efficiency, elements of structured programming, and a rich set of operators.
Its generality, combined with its absence of restrictions, make C a convenient and
effective programming solution for a wide variety of software tasks. Many applications
can be solved more easily and effectively with C than with other more specialized
languages. The Keil software C51 optimizing cross compiler for the MS-DOS operating
system is a complete implementation of the ANSI (American National Standards
Institute) standard for the C language. The C51 compiler generates code for the 8051
microprocessor but is not a universal C compiler adapted for the 8051 target. It is a
ground-up implementation dedicated to generating extremely fast and compact code for
the 8051 microprocessor. For most 8051 applications, the C51 compiler gives software
developers the flexibility of programming in /c while matching the code efficiency and
speed of assembly language. Using a high-level language like C has many advantages
over assembly language programming. For example:

Knowledge of the processor instruction set is not required. A rudimentary


knowledge of the 8051s memory architecture is desirable but not necessary.

Register allocation and addressing mode details are managed by the compiler.

The ability to combine variable selection with specific operations improves


program readability.

44

Keywords and operational functions that more nearly resemble the human thought
process can be used.

Program development and debugging times are dramatically reduced when


compared to assembly language programming.

The library files that are supplied provide many standard routines (such as
formatted output, data conversions, and floating-point arithmetic) that may be
incorporated into our application.

Existing routine can be reused in new programs by utilizing modular


programming techniques available with C.

The C language is very portable and very popular. C compilers are available for
almost all target systems. Existing software investments can be quickly and easily
converted from or adapted to other processors or environments.

4.1.5 A51 MACRO ASSEMBLER


The A51 assembler is a macro assembler for the 8051 microcontroller family. It
translates symbolic assembly language mnemonics into relocatable object code where the
utmost speed, small code size, and hardware control are critical. The macro facility
speeds development and conserves maintenance time since common sequences need only
be developed once. The A51 assembler supports symbolic access to all features of the
8051 architecture and is configurable for the numerous 8051 derivatives. The A51
assembler translates an assembler source file into a relocatable object module. If the
DEBUG control is used, the object file contains full symbolic information for debugging
with dScope or an in-circuit emulator. In addition to the object file, the A51 assembler
generates a list file which may optionally include symbol table and cross reference
information. The A51 assembler is fully compatible with Intel ASM-51 source modules.
The A51 assembler supports all members of the 8051 family. The special function
register (SFR) set of the 8051 is predefined. However, the NOMOD51 control lets you
override these definitions with processor-specific include files. The A51 assembler is
shipped with include files for the 8051, 8051fx, 8051GB, 8052, 80152, 80451, 80452,
80515, 80C517, 80C517A, 8x552, 8xC592, 8xCL782, 8xCL410 and 80C320
microcontrollers. You can easily create include files for other 8051 family members.

45
4.1.6 BL51 CODE BANKING LINKER/LOCATOR
The 51 code banking linker/locator combines one or more object modules into a
single executable 8051 program. The linker also resolves external and public references,
and assigns absolute addresses to relocatable programs segments. The BL51 code
banking linker/locator processes object modules created by the keil C51 compiler and
A51 assembler and the Intel PL/M-51 compiler and ASM-51 assembler. The linker
automatically selects the appropriate run-time library and links only the library modules
that are required. Normally, you invoke the BL51 code banking linker/locator from the
command line specifying the names of the object modules to combine. The default
controls for the BL51 code banking linker/locator have been carefully chosen to
accommodate most applications without the need to specify additional directives.
However, it is easy for us to specify custom settings for your applications.
4.1.7 OC51 BANKED OBJECT FILE CONVERTER
The OC51 banked object file converter creates absolute object modules for each
code bank in a banked object module. Banked object modules are created by the BL51
code banking linker/locator when you create a bank switching application. Symbolic
debugging information is copied to the absolute object files and can be used by dScope or
an in-circuit emulator. We may use the OC51 banked object file converter to create
absolute object modules for the command area and for each code bank in your banked
object module. You may then generate Intel HEX files for each of the absolute object
modules using the OH51 object-hex converter.
4.1.8 OH51 OBJECT-HEX CONVETER
The OH51 object-hex converter creates Intel hex files from absolute object
modules. Absolute object modules can be created by the BL51 code baking linker or by
the OC51 banked object file converter. Intel hex files are ASCII files that contain a
hexadecimal representation of your application. They can be easily loaded into a device
programmer for writing on Erasable programmable read only memory.

46
LIB51 LIBRARY MANAGER
The LIB51 library manager lets you create and maintain library files. A library file
is a formatted collection of one or more object files. Library files provide a convenient
method of combining and referencing a large number of object files. Libraries can be
effectively used by the BL51 code banking linker/locator. The LIB51 library manager lets
you create a library file, add object modules to a library file, remove object modules from
may be controlled interactively or from the command line.
DSCOPE-51 FOR WINDOWS
DScope-51 is a source level debugger and simulator for programs created with the
keil C51 compiler and A51 assembler and the Intel PL/M-51 compiler and ASM-51
assembler. DScope-51 is a software-only product that lets us simulate the features of an
8051 without actually having target hardware. We may have used Scope-51 to test and
debug our embedded applications before actual 8051 hardware is ready. DScope-51
simulates a wide variety of 8051 peripherals including the internal serial port, external
I/O, and timers.
4.1.9 VISION/51 FOR WINDOWS
Microvision/51 is an integrated software development platform that includes a full
function editor, project manager, make facility, and environment control for the keil 8051
tools. When we use Vision/51 speeds our embedded applications development by
providing the following:

Standard Windows user interface,

Dialog boxes for all environment and development tool settings,

Multiple file editing capability,

Full function editor with user-definable key sequences,

Application manager for adding external programs into the pull-down


menu,

47

Project manager for creating and maintaining projects,

Integrated make facility for building target programs from your projects,

On-line help system.

48
5. APPLICATION SOFTWARE
5.1 APPLICATION SOFTWARE DISCRIPTION
Application software is a computer program that functions and is operated
by means of a computer, with the purpose of supporting or improving the software user's
work. In other words, it is the subclass of computer software that employs the capabilities
of a computer directly and thoroughly to a task that the user wishes to perform. This
should be contrasted with system software (infrastructure) or middleware (computer
services/ processes integrators), which is involved in integrating a computer's various
capabilities, but typically does not directly apply them in the performance of tasks that
benefit the user. In this context the term application refers to both the application
software and its implementation. In some types of embedded systems, the application
software and the operating system software may be indistinguishable to the user, as in the
case of software used to control a VCR, DVD player or microwave oven.
The application software for this project has been developed from a high level
graphical programming language (visual basic).This method of implementation gives the
user a more flexibility to have hands on the system. The application software is a virtual
representation of the actual instrument and provides all facilities for the user to control
the working of the system. This technique of operating the system (the actual instrument)
is highly advantageous, as it does not permit the actual instrument to be misused, for
example, here, the minimum and maximum ranges of the system is defined and hence
prevents the user from exceeding the limits. Thus the application software provides high
security to the actual instrument. Moreover certain graphical representation of the real
time values with high resolution can also be implemented.

49
5.2 SCREEN SHOTS

6. CONCLUSION
The purpose of this report was to show a design of an electronic
billboard can be effectively realized using BILLBOARD. The conclusion is split
in two. The first part describes what design choices have been made, what
the design looks like and how it performs. What is needed to implement the
design using BILLBOARD is discussed in the second part.
As a receiver, a standard 2.4GHz device, found in many other
applications, suffices. Other research showed that both the distance at which
the data could be received and the transmission rates were acceptable. The
controller that will be consists of three components. First a receiver/decoder
is required. This buffers the serial data from the receiver device and forwards
it to the storage management component in 8-bit packets. The central
component, which acts as the main controller, stores the received data in the
memory while at the same time sending data to the screen. The screen is
driven by the last component of the controller, the screen controller. This
drives the screen we have chosen.

S-ar putea să vă placă și