Chapter 3
Chapter 3
CHAPTER 3
SOFTWARE DESCRIPTION
3.1.
in number of tools available as open source in the market. Among the number of the
tools for programming the ARM7 the Keil vision is used in the project for writing
the code. The vision IDE from the Keil combines the project management and make
facilities and source code editing with program debugging and complete simulation in
one powerful environment. It is easy to use and helps to quickly create embedded
program that work. The Vision editor and debugger are integrated in a single
application that provides a seamless embedded systems project development. The
programming language used in the project is Embedded C. The code is written and
complied to create a hexadecimal file that is to be dumped in to the microcontroller in
Keil tool. The successfully compiled source code in dumped in to the microcontroller
by using another tool called Flash Magic.
3.3.
Keil Vision2
This is an IDE (Integrated Development Environment) that helps you write,
A project manager
A make facility
Page 50
Tool configuration
Editor
A powerful debugger
To get start here are some several example programs
STEP1: Open the Keil vision tool by clicking on its icon then the
environment will be open as shown in the figure 3.1.
STEP2: In the tabs listed in the taskbar select the click on the project menu
and select new then a pop up window appears to give the name for the project.
Select a name and save it with which the project available in storage.
STEP3: After creating the path for saving the project a pop up window will be
appear to select the micro controller on which the programming is going to
done.
Page 51
STEP4: From the list of the companies as listed in the window select the NXP
as the maker of the LPC2148 is Philips as shown in the figure 3.2.
STEP5: After selecting the NXP click on the plus symbol left to the NXP to
see the step2 list of controllers manufactured by the Philips. From the list
select the LPC2148 as it is the controller used in the project as shown in
figure 3.3.
STEP7: After selecting yes on the pop up window asked for adding startup
code then a work environment window will be opened as before. In the left
side of the window right click on the tab target 1 and from the dropdown menu
select the "options for target1 menu". Then a popup window appears as shown
in the figure 3.4. In the window by selecting the target tab the oscillating
frequency will be set as required.
Page 52
STEP8: After selecting the oscillating frequency click on the output tab and
tick the box left to the option create Hex fie in order to create a Hex file for
dumping in to the microcontroller after debugging as shown in the figure 3.4.
STEP9: After selecting the option to create a Hex file, click on ok then work
environment window opens then click on the file menu and select the new
then an empty file opens where program is written.
STEP10: After writing the program click on the save button. Then click on
the option source group1 and click on the add files to source group1. Then a
list of programs available to add will be displayed. Then by selecting the
current file the program is added for debugging.
STEP11: After adding the program file to the source group then click on the
project menu and select the option build target then the program will be
compiled and after ensuring that no error and on warning a pop up window
will opens saying that program build successfully as shown in the figure 3.5.
Page 53
Figure 3.4. Selecting Frequency and the Options for Creating Hex File.
Page 54
microcontroller. The tool used for dumping the Hex files in to the microcontroller is
Flash Magic.
Flash Magic
3.4.
The Flash Magic tool is a open source software that allows us to port the
hexadecimal codes in to the microcontroller. The flash magic supports over a large
range of the microcontrollers widely used. The in system programming feature of the
LPC2148 enables the user not to use any separate device for the porting of the Hex
files.
The steps in the porting of the hexadecimal codes in to the LPC2148 are as
follows:
a. Interface RS232 Cable between RS232 Serial Port of PC and Board UART-0
(CN3).
b. Supply power into board in the case, we can see red LED1 is in status O.
c.
d. Run Program Flash Magic, it will display result as shown in figure 3.6.
e. Select COM port corresponding with (in this example, it is COM1). Start
setting the initial values into program as desired, so we configure values into
program as follows:
Page 55
figure3.6.
the communication with every external peripheral that are used to form a
communication network is communicated with the serial protocol. The GSM module
used in the project connected to the UART1 for both reception and transmission with
the micro controller. The GPS module also communicates in the serial manner with
the reception of the location information. The GPS module interfaced with the
UART0 of the micro controller that too with the Rx pin of the UART0. The
communication between the PC and the microcontroller is done by using the
transmitter pin of the UART0 as there is only one way communication between the
PC and the microcontroller. The registers used for the serial communication in the
LPC2148 and the programming steps are as follows:
UOLCR: The line control register helps to set the pattern of the data stream
that is the number of bits and the parity considered and the number of stop
bits. In the project the value is set to 0x83 as the pattern is considered with no
parity and one stop bit.
UODLL and UODLM: The UODLL and the UODLM registers are used to set
the baud rate with the transmission or the reception is going to take place and
for the baud rate of 9600 in this project the UODLL is set to 0x62.
UOTHR: The UOTHR register is the transmit hold register which contains the
data to be transmitted. To check if any data is available in the UOTHR the
Page 57
UORBR: The UORBR is the receive buffer register which is used to receive
data same as the UOTHR. To check if any data is available for the reception
UOLSR register value is and with the value of 0x01 which indicates the status
of the receiving data.
UOLSR: The UOLSR register is the line status register which contains the
important data about the transmit and receive data ready bits for
communication.
The registers discussed above are the just needed registers to establish a
Page 58
Page 59
Page 60