程序代写代做代考 ELEC 3662: Embedded Systems

ELEC 3662: Embedded Systems
The Mini
ELEC3662, L. Mhamdi

Project
1
Project Description
Interface the Tiva LaunchPad with a Keypad and LCD to display simple calculations.
All is on TINA_Cloud and CCS
ELEC3662, L. Mhamdi
1-2
2
Software
Step 1: Create the Project
qCreate a new Keil-v5 project, with relevant preprocessors directives and GPIOs defines, header files, etc.
qSince lots of delays are required, its recommended to use a 80 MHz clock frequency (PLL) for ease of calculations.
qFor better organization and code re-use, create
separate files (.c and .h)
ELEC3662, L. Mhamdi
1-3
3
1

Step 2: KEYPAD Functions
qCreate a function keypadInit(): PORTD and PORTE setup and number of rows/columns of the matrix.
qCreate a function unsigned char readKeypad(): This function returns the key pressed in the keypad matrix.
qCreate a function char decodeKeyPress(unsigned char k): This function returns the value of the pressed keypad button.
¨ The previous 2 functions could be combined into
just one function.
1-4
ELEC3662, L. Mhamdi
4
Step 2: LCD initialisation
qCreate a function lcdInit()
qCheck the ¡®Initializing by Instruction¡¯ section
in HD44780 data sheet (pg. 45-46).
qPin and port settings using some ¡°#define¡±s qFind out the correct delay, for min 15 ms, 4.1
ms and 100 ys.
qRS set to 0 (1 for data), RW to 0 (GND) qCreate a lcdENPulse() to latch commands qFollow & understand Fig 24, pg. 46 Datasheet!
ELEC3662, L. Mhamdi
1-5
5
lcdInit()
qRefer to Data sheet, pg.46
qInterface set to 4- bit mode
q Special instructions are 8- bit!
ELEC3662, L. Mhamdi
1-6
6
2

Step 3: Set-up Inst
qCheck Data sheet (¡°Instruction Description¡±) for set-up instructions
qCreate a function lcdWriteCommand(unsigned char c)
qRemember, we are sending 4-bit data at a time, ¡°nibble¡±, 2 line with a 5×8 font.
qSet up: 001DL NF** accordingly
qSet up the Display, Cursor and Blink ON
ELEC3662, L. Mhamdi
1-7
7
LCD Functions
qlcdClearScreen(): clear and home the LCD display qlcdGoto(unsigned char address): move the
position of the cursor to a specified DDRAM address
¨ You can use more functions (your own) Writing Data/Command:
qlcdWriteData(char c) & lcdWriteCommand(unsigned char c)
ELEC3662, L. Mhamdi
1-8
8
Calculation Functions
q Create a calculator function that outputs the result of simple calculations, such as adding, subtracting, multiplying or dividing two numbers.
ELEC3662, L. Mhamdi
1-9
9
3

Demo
qYou are required to create a demo where you display the results of the keypad input buttons (calculations) on the LCD screen to prove you have correctly implemented the above functions.
qExtras …
vExecuting floating-point calculations, nested calculations (more than one operand, etc).
v Create password to access the keypad, and add an option for the user to change the password.
vDisplay Graphics on the LCD. ELEC3662, L. Mhamdi
1-10
10
Mini_Project Assessment
Assessment
Source Code + Description*
Demo + Q&A
Total
Keypad
15%
10%
25%
LCD + Calculations
20%
15%
35%
Deadline
Week 12
Week 13
Description* = A poster containing a flowchart, a schematic and an abstract
description
ELEC3662, L. Mhamdi
1-11
11
example
Floating point operations
ELEC3662, L. Mhamdi
1-12
12
4