DRIVER DEVELOPMENT FOR GENERAL PURPOSE HAND HELD TERMINAL
A SUMMER TRAINING PROJECT
FROM
ELECTRONICS CORPORATION OD INDIA LIMITED
HYDERABAD.
Submitted by
AMBER VASUDEO BEHRE
BACHELOR OF ENGINEERING
in
COMPUTER SCIENCE AND ENGINEERING
UNITED INSTITUTE OF ENGINEERING AND TECHNOLOGY ALLAHABAD
UP TECHNOLOGICAL UNIVERSITY:: LUCKNOW
JULY 2010
INTRODUCTION
To make efficient use of technology, development of a general
purpose handheld terminal with a capacity to connect to PC
through a standard interface and with facilities such as man
machine interface to easily record data has been carried out.
This can be used for various applications like database
collection, software up-gradation or any other data porting
application.
A real life example is in ‘Electricity Department’, where there is
a need to collect the data related to monthly consumption of
electrical energy in terms opf no. of units consumed by and at
each house hold and then keeping it as a database for releasing
the monthly bills. Now this task can be easily achieved by this
hand terminal.
The ‘General purpose hand held terminal’ is a portable
device running an embedded application which targets a
specific utility service.
The handheld terminal consists mainly of three important
constituents:
•A standard COM Port (UART) interface for connecting to a
PC.-UART
•An LCD and an LCD controller.-LCD
•A keyboard and a keyboard controller.-I2C
FIRMWARE
In any embedded application involves the development of
hardware and a suitable software (firmware) which is
embedded in the device itself and which runs automatically as
soon as you turn on the device.
Basically any hardware has to undergo a firmware development
so that we can use our applications on it.
DRIVERS
Every device that connects to PC has some drivers to be prepared.
These drivers are prepared on hardware and are provided to the
customer along with the hardware to facilitate them for applications.
The drivers are prepared in ANSI ‘C’ to be compiled by a Analog
Devices supplied KEIL compiler facilitating the generation of
executable object code that is later downloaded into the non-volatile
memory available inside the controller.
Printed Control Board
The hardware is built on a PCB which consists of following
important constituents:-
•An ARM Micro-controller, namely, ADuC7026 from Analog
devices with an inbuilt UART port, hereafter called ‘the
controller’.
•An LCD with built in LCD controller interfacing with the
controller through its GPIO ports.
•A Keyboard Controller IC, MAX7349 from MAXIM
interfacing with the controller on I2C interface.
Printed Control Board
UART
It is a piece of computer hardware that translates data between
parallel and serial forms.
Externally though, in UART, we deal with serial transmission or
receiving only.
A UART is usually an individual (or part of an) integrated circuit used
for serial communications over a computer or peripheral device
serial port.
In UART, we have atleast 3 pins for communication-
•Ground line-G
•Transmission line-TX
• Reciever line-RX
Three aspects of UART are –
•Asynchronous
•Baud rate
•Byte boundary
ASYNCHRONOUS COMMUNICATION
Asynchronous communication is transmission of data without the
use of an external clock signal.
UART is asynchronous device because the clocks used in both the
receiver end and transmitter end are different. So tolerance causes
asynchronization.
BAUD RATE
It is the unit of symbol rate, also known as baud rate
or modulation rate; the number of distinct symbol changes
(signaling events) made to the transmission medium per second
in a digitally modulated signal or a line code.
The COM/serial port of any computer system works by default at
9600 baud. So as a default we can set 9600 baud for any data
loader like our hand terminal to achieve transparency. Baud rate
settings are done through the bit value settings of various
registers.
BYTE BOUNDRY
The start bit is the opposite polarity of the data-line's idle state. The
stop bit is the data-line's idle state, and provides a delay before the
next character can start. (This is called asynchronous start-stop
transmission).
IMPORTANT REGISTERS IN UART
* COMCON0 is a modem control register.
*COMSTA0 is the line status register.
*COMRX is an 8-bit receive register.
*COMTX is an 8-bit transmit register.
*COMDIV0 is a low byte divisor latch.
•COMTX, COMRX, and COMDIV0 share the same address location
•COMTX and COMRX can be accessed when Bit 7 in the
COMCON0 register is cleared.
•COMDIV0 can be accessed when Bit 7 of COMCON0 is set.
BIT CODE SETTINGS FOR COMCON0
REGISTER
So, COMCON0 = 00000111 = 0x07.
*COMDIV0 & COMDIV1=when set have a default baud rate as
9600.
LCD (LCD interfacing)
A liquid crystal display (LCD) is a thin, flat
electronic visual display that uses the light modulating properties of
liquid crystals (LCs). LCs do not emit light directly.
They are used in a wide range of applications including:
computer monitors, television, instrument panels,
aircraft cockpit displays, signage, etc.
LCD INTERFACING WITH
MICROCONTROLLER
•Only the instruction register (IR) and the data register (DR) of the
LCD can be controlled by the MCU.
•Before starting the internal operation of the LCD, control
information is temporarily stored into these registers to allow
interfacing with various MCUs, which operate at different speeds, or
various peripheral control devices.
•The internal operation of the LCD is determined by signals sent
from the MCU. These signals, which include register selection
signal (RS), read/write signal (R/W), and the data bus (DB0 to
DB7), make up the LCD instructions .
Signals are generated using following GPIO ports of the micro-
controller:
•DB0 to DB7 : GPIO Port 3, port nos. 0:7 respectively.
•RS : GPIO Port 1, port no. 5
•EN: GPIO Port 1, port no. 4
•R/W: GPIO Port 1, port no. 6
DRIVER FOR LCD INBUILT IN ADuC7026:
•GPxDAT are Port x configuration and data registers. They configure
the direction of the GPIO pins of Port x, set the output value for the
pins configured as output, and store the input value of the pins
configured as input.
•Here,x=0, 1, 2 or 3.
•We are using GP3DAT in our program.
example, GP3DAT=11111111001100000000000000000000
=0XFF300000.
In this code I’m displaying ‘DATA LOADER AMBER’, if it
displays this tag on the handheld terminal then it means our code
is correct, and the device is working properly.
In this code I’m displaying ‘DATA LOADER AMBER’, if it displays this tag on the
handheld terminal then it means our code is correct, and the device is working
properly. Now this is achieved by creating a buffer in the code, namely, lcd_data [17],
containing 17 elements..
We store ASCII code equivalents of characters that we intend to display..
*It is set as-
0xFF440000-‘D’
0xFF410000-‘A’
0xFF540000-‘T’
0xFF410000-‘A’
0xFF200000-‘ ’
0xFF4c0000-‘L’
0xFF4f0000-‘O’
0xFF410000-‘A’
0xFF440000-‘D’
0xFF450000-‘E’
0XFF520000-‘R’
0xFF410000-‘A’
0xFF4d0000-‘M’
0xFF420000-‘B’
0xFF450000-‘E’
0xFF520000-‘R’
KEYBOARD CONTROLLER INTERFACING
(I2C)
Inter-Integrated Circuit is a multi-master serial single-
ended computer bus invented by Philips that is used to attach low-
speed peripherals to a motherboard, embedded system, or cell-
phone.
MASTER AND SLAVE
•The I2C protocol defines the concept of master and slave devices.
A master device is simply the device that is in charge of the bus at
the present time and this device controls the clock and generates
START and STOP signals.
•. Slaves simply listen to the bus and act on controls and data that
they are sent.
•The master can send data to a slave or receive data from a slave .
• slaves do not transfer data between themselves
I2C basic command sequence:
1. Send the START bit (S).
2. Send the slave address (ADDR).
3. Send the Read(R)-1 / Write (W)-0 bit.
4. Wait for/Send an acknowledge bit (A).
5. Send/Receive the data byte (8 bits) (DATA).
6. Expect/Send acknowledge bit (A).
7. Send the STOP bit (P).
Note: You can use 7 bit or 10 bit addresses
These bits are already set for the registers in embedded and for
the microcontroller we are using.
REGISTERS IN I2C INTERFACING
•IRQEN provides the value of the current enable mask.
•I2CxADR are master address byte registers.
•I2CxFSTA are FIFO status registers.
CONCLUSION
From the foregone discussion and various points touched upon
in the presentation appearing in the topics above, it can be
safely concluded that the handheld terminal promises to be a
wonderful apparatus that can be used for wide variety of
applications and utilities without much complexity in
operation.
Also, there is tremendous scope for further up-gradation in
terms of interface as well as utilities in terms of value addition
for the product
THANKYOU!!!!