0% found this document useful (0 votes)
273 views

Lab Report No 1 Microprocessor Systems

.

Uploaded by

Hasan Raza
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
273 views

Lab Report No 1 Microprocessor Systems

.

Uploaded by

Hasan Raza
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 19

Lab Report no 1

Subject:
Microprocessor Systems

Submitted To:
Engr. SIR ATIF

Submitted By:
Name: M Anjum Sarfraz . GCPKI00936
Ahsan Javaid GCPKI00938

B.Sc (EE) EE-FA-19

Department of Electrical Engineerig


Grafton College, Islamabad

Page 1 of 19
Experiment 1

Laboratory Hardware and Tools

Each day, our lives become more dependent on ‘embedded systems’,


digital information tech-nology that is embedded in our environment. Try
making a list and counting how many devices with embedded systems
you use in a typical day. Here are some examples: if your clock radio
goes o , and you hit the snooze button a few times in the morning, the
rst thing you do in your day is interact with an embedded system.
Heating up some food in the microwave oven and making a call on a cell
phone also involve embedded systems. That is just the beginning. Here
are a few more examples: turning on the television with a hand held
remote, playing a hand held game, using a calculator, and checking your
digital wristwatch. All those are embedded systems devices that you
interact with.

Exponentially increasing computing power, ubiquitous connectivity and


the convergence of tech-nology have resulted in hardware/software
systems being embedded within everyday products and places. The last
few years has seen a renaissance of hobbyists and inventors building
custom electronic devices. These systems utilize o -the-shelf
components and modules whose development has been fueled by a
technological explosion of integrated sensors and actuators that
incorporate much of the analog electronics which previously presented a
barrier to system development by non-engineers. Microcontrollers with
custom rmware provide the glue to bind sophisticated o -the-shelf
modules into complex custom systems.

What are Embedded Systems?

Embedded systems are combination of hardware and software


combined together to perform a dedicated task. Usually, they are used
to control a device, a process or a larger system. Some examples of
Page 2 of 19
embedded systems include those controlling the structural units of a car,
the automatic pilot and avionics of aircraft, telematic systems for tra c
control, the chipset and software within a set-top box for digital TV, a
pacemaker, chips within telecommunication switching equipment,
ambient devices, and control systems embedded in nuclear reactors.
The block diagram of embedded system is shown in Figure 1.1

Lab Objective

Development of an embedded system requires that combination of both


hardware and software components should perform their assigned tasks
under the prede ned circumstances. This lab provides a series of
experiments aimed at teaching hardware interfacing and embedded.

Page 3 of 19
5

Embedded System
Microcontroller Chemical
Electrical,
Processor Mechanical,
or Other
I/O Ports
devices
RAM
DAC
ROM ADC Analog
Signals
Bus

Figure 1.1: Block diagram of an embedded system

programming skills. We follow the bottom up approach by starting with


simpler tasks and gradually building on that to develop a complete
embedded system.

Prerequisites for Lab

This lab is designed for the students having some experience in ‘C’
programming, but no prior experience with embedded systems. In this
lab, we assume that you have basic understanding of digital logic design
and analog electronics.

Hardware Required

Hardware required for the experiments in this lab is listed below:


1. Stellaris Launchpad Board based on LM4F120H5QR microcontroller
2. Expansion Board based on di erent electronic components required
to perform lab assign-ments.

Stellaris Launchpad Board

The key component used in the tutorials is the Stellaris Launchpad board
produced by Texas In-struments (TI). The board, illustrated in Figure 1.2,
includes a user con gurable LM4F120H5QR micro-controller with 256 KB
ash and 32 KB RAM as well as integrated circuit debug interface (ICDI).
With appropriate software running on the host it is possible to connect to
the LM4F120 processor to download, execute and debug user code.

In Figure 1.2, there is a horizontal white line slightly above the the midpoint. Below the line are the
LM4120H5QR, crystal oscillators, user accessible RGB LED, user accessible push-buttons and a reset push
button. Above the line is the hardware debugger interface including a 3.3V
6 CHAPTER 1. LABORATORY HARDWARE AND TOOLS

Power Select USB Connector


Switch (Power/ICDI) Green Power LED

USB Micro-B Reset Switch


Connector
(Device)
RGB User LED

Stellaris® LaunchPad
BoosterPack XL
Interface (J1, J2, J3,
Stellaris® LaunchPad and J4 Connectors)
BoosterPack XL
Interface (J1, J2, J3, Stellaris®
and J4 Connectors) LM4F120H5QR
Microcontroller

MSP430™ MSP430™
LaunchPad-Compatible LaunchPad-Compatible
BoosterPack Interface BoosterPack Interface

User Switch 1 User Switch 2

Figure 1.2: Launchpad Board

The LM4F120H5QR is a member of the Stellaris processors and o ers


80 MHz Cortex-M4 pro-cessor with FPU, a variety of integrated
memories and multiple programmable GPIO. This board provides far
more computation and I/O horsepower than is required for the tasks per-
formed in the lab. Furthermore, the LM4F120H5QR microcontroller is
code-compatible to all members of the extensive Stellaris family,
providing exibility to t precise needs.

Expansion Board

The headers on the Launchpad can be used to connect the external


peripherals and electronic devices to develop a custom application. Like
other expansion boards, we designed our own expansion board for
Stellaris Launchpad to explore di erent applications that our MCU can
support. This board helps students get familiar with di erent peripherals
of MCU by interacting with simple electronic components like seven
segment display, 16x2 character LCD, temperature sensor (LM35),
analog potentiometer, MAX232 and DB9 connector for interfacing UART
7

(a) UET Launchpad expansion board (b) Launchpad mounted on expansion board

Figure 1.3: UET Launchpad Expansion board

level shifter, real time clock (DS1307) for I2C interfacing. Figure 1.3
shows the expansion board with and without launchpad mounted on it

Stellaris LM4F Series Overview

The LM4F120 microcontrollers are based on the ARM Cortex-M4 core.


The Cortex-M4 di ers from previous generations of ARM processors by
de ning a number of key peripherals as part of the core architecture
including interrupt controller, system timer and, debug and trace
hardware (including external interfaces). This additional level of
integration means that system software such as real-time operating
systems and hardware development tools such as debugger interfaces
can be common across the family of processors.

The LM4F microcontroller provides a wide range of connectivity features


such as CAN, USB Device, SPI/SSI, I2C, UARTs. It supports high
performance analog integration by providing two 1MSPS 12-bit ADCs
and analog and digital comparators. It has best-in-class power con-
sumption with currents as low as 370 A/MHz, 500 s wakeup from low-
power modes and RTC currents as low as 1.7 A. This Stellaris series o
ers a solid road map with higher speeds, larger memory and ultra low
currents.
Feature Description

Core ARM Cortex-M4F processor core


Performance 80-MHz operation; 100 DMIPS performance
Flash 256 KB single-cycle Flash memory
System SRAM 32 KB single-cycle SRAM
EEPROM 2KB of EEPROM
®
Internal ROM
Communication Interfaces
Eight UARTs
Universal Asynchronous Receivers/Transmitter (UART)
Four SSI modules
Synchronous Serial Interface (SSI) Inter-Integrated
Four I2C modules with four transmission speeds including high-speed
Circuit (I2C) Controller Area Network (CAN) Universal mode
Serial Bus (USB)
CAN 2.0 A/B controllers
USB 2.0 Device
System Integration

Micro Direct Memory Access (µDMA) ARM® PrimeCell® 32-channel configurable μDMA controller
General-Purpose Timer (GPTM) Six 16/32-bit GPTM blocks and six 32/64-bit Wide GPTM blocks
Watchdog Timer (WDT) Two watchdog timers
Hibernation Module (HIB) Low-power battery-backed Hibernation module
General-Purpose Input/Output (GPIO) Six physical GPIO blocks
Analog Support
Analog-to-Digital Converter (ADC) Two 12-bit ADC modules with a maximum sample rate of one million
samples/second
Analog Comparator Controller Two independent integrated analog comparators
Digital Comparator 16 digital comparators
JTAG and Serial Wire Debug (SWD) One JTAG module with integrated ARM SWD
Package 64-pin LQFP
Operating Range Industrial (-40°C to 85°C) temperature range

LM4F120H5QR Microcontroller Overview

The Stellaris LM4F120H5QR microcontroller combines complex


integration and high perfor-mance with the features shown in Figure

The Cortex-M4 core architecture consists of a 32-bit processor with a


small set of key periph-erals. The Cortex-M4 core has a Harvard
architecture meaning that it uses separate interfaces to fetch instructions
and data. This helps ensure the processor is not memory starved as it
permits accessing data and instruction memories simultaneously. From
the perspective of the
accesses. The interface between the Cortex-M4 and manufacturer speci
c hardware is through three memory buses ICode, DCode, and System
which are de ned to access di erent regions of memory.
Setup Keil Vision to Write Code.

1. Run the software by clicking the icon on desktop, if available, or by


clicking on Start ! All Programs !Keil Vision. An interface similar to
one shown in Figure 1.7 will open.

Figure 1.7: Keil interface on start

2. Click on Project tab and choose New Vision Project from the drop-
down list as shown in Figure 1.8
11

3. Select and create a directory, then assign a name to your project


(project name can be di erent from folder name) then click on Save.
Do not make a directory, le or project name with a space in it. A
space will prevent simulation from working properly .

Figure 1.9: Type the name of the project in Keil and save it

4. To select a microcontroller double click on Texas Instruments and


select TM4C1233H6PM. Click OK.(See Figure 1.10 and 1.11)
Figure 1.10: Select the manufacturer of your microcontroller
12 CHAPTER 1. LABORATORY HARDWARE AND TOOLS

Figure 1.11: Select the part number for your microcontroller

5. When prompted to copy ‘Startup TM4C123.s to project folder’ click


on Yes or No according to the requirement of your project.

Figure 1.12: Add or discard the startup le to the project

6. Right click on Source Group 1 under Target 1, click on Add New


Item to Group ‘Source Group 1’... and elect the type of le you want
to add (.s for assembly and .c for C le), write its name in given
space and click OK. (See Figure 1.13 and 1.14)
13

Figure 1.13: Add new le to the project

Figure 1.14: Select le type and save the new le

7. Double click on the le name under Source Group 1 in Project


window to open it in the editor pane. Here, you can write and edit
the code.
14 CHAPTER 1. LABORATORY HARDWARE AND TOOLS

Figure 1.15: Edit the le in the text editor window

8. Next step after writing the code is to build your code. As shown in
Figure 1.16 click on Project menu and select Build Target from the
drop down list. You can also build your project by clicking Build
button in Build bar. Build Output window at displays the errors,
warning and build messages during build process. Double-click a
message to open the corresponding source le. Build button
translates modi ed or new source les and generates the executable
le. The Rebuild command translates all source les regardless of
modi cations. Simulation highlighted at the bottom signi es that we
are not downloading our code on hardware.
9. After successsfully building the code, you can run the program
through the Debug menu. As shown in Figure select the Start/Stop
Debug Session option from the debug menu
or press the debug button. Click on \OK" for the pop up window
showing \EVALUATION MODE, Running with Code Size Limit:
32K".

10. Open your uVision to full screen to have a better and complete
view. In Figure the left hand side window shows you the registers
and the right side window shows the program code. There are some
other windows open. You may adjust the size of them to see better.
Run the program step by step as shown in, you can observe the
change of the values in the registers. Click on the Start/Stop Debug
Session again to stop executing the program.

You might also like