ECE 353 Introduction to Microprocessor Systems - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

ECE 353 Introduction to Microprocessor Systems

Description:

Look-Up Table (LUT) ... will use a look-up table to convert the value in ... four bits of R0 to its ASCII hexadecimal equivalent number and store result in R1. ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 12
Provided by: mik57
Category:

less

Transcript and Presenter's Notes

Title: ECE 353 Introduction to Microprocessor Systems


1
ECE 353Introduction to Microprocessor Systems

Discussion 4
2
Topics
  • Look-up Table (LUT)
  • Using loops
  • QA

3
Look-Up Table (LUT)
  • What? table of related values stored in
    memory for use by the program. (Examples
    temperature conversions, calibration info)
  • Why?
  • - memory access may be much faster than doing
    some set of calculations
  • - natural solution for database type of
    information.

4
Look-Up Table (LUT)
  • Example A.) Write a code fragment that will use
    a look-up table to convert the value in the least
    significant four bits of R0 to its ASCII
    hexadecimal equivalent number and store result in
    R1.

5
Look-Up Table (LUT)
Filename main.s Author ECE 353
student Description main program file for
Discussion 4 Look-up Table (LUT)
examples ARM use ARM instruction
set EXPORT __main AREA FLASH, CODE,
READONLY __main part A assumes value in
R0, so preload a sample value MOV R0,
11 AND R0, R0, 0xf only want least sig.
four bits ADR R2, HexLUT load start address
of LUT LDRB R1, R2, R0 do look-up B
__main HexLUT DCB "0123456789ABCDEF" END
6
Look-Up Table (LUT)
  • Example B.) Write a code fragment that will use
    a look-up table to return in R0 the 16-bit
    square of the unsigned byte in R0. Only compute
    the first and last three entries in the table.

7
Look-Up Table (LUT)
Filename main.s Author ECE 353
student Description main program file for
Discussion 4 Look-up Table (LUT)
examples ARM use ARM instruction
set EXPORT __main AREA FLASH, CODE,
READONLY __main part B assumes value in R0,
so preload a sample value MOV R0, 1 AND R0,
R0, 0xff only want lsb ADR R2,
SquareLUT load start address of
LUT MOV R0, R0, LSL 1 multiply by 2 since
half-word lookup LDRH R0, R2, R0 do
look-up B __main SquareLUT DCW 0, 1,
4 first three entries more values we dont
show here DCW 64009, 64516, 65025 last three
entries END
8
Looping
  • Write a code fragment that will get up to 100
    characters from a byte I/O port at address
    0x00011000 and store them in an array. If a zero
    value is read from the port, store the zero and
    then quit. Otherwise, when 100 characters have
    been read, store a zero terminator in the array
    and quit.
  • Outline
  • Setup storage area
  • Setup parameters
  • Code
  • initialization
  • loop
  • read port values
  • check for zero value (branch to done if zero)
  • store value
  • update count
  • loop if lt100 values
  • done -gt store zero

9
Looping
  • Write a code fragment that will get up to 100
    characters from a byte I/O port at address
    0x00011000 and store them in an array. If a zero
    value is read from the port, store the zero and
    then quit. Otherwise, when 100 characters have
    been read, store a zero terminator in the array
    and quit.
  • Filename main.s
  • Author ECE 353 staff
  • Description main program file for discussion
    problem Looping
  • ARM use ARM instruction set
  • EXPORT __main
  • AREA FLASH, CODE, READONLY
  • __main
  • loop

10
Looping
  • Write a code fragment that will get up to 100
    characters from a byte I/O port at address
    0x00011000 and store them in an array. If a zero
    value is read from the port, store the zero and
    then quit. Otherwise, when 100 characters have
    been read, store a zero terminator in the array
    and quit.
  • Filename main.s
  • Author ECE 353 staff
  • Description main program file for discussion
    problem Looping
  • ARM use ARM instruction set
  • EXPORT __main
  • MAXITER EQU 100
  • PORT EQU 0x00011000
  • AREA SRAM, DATA, READWRITE
  • array SPACE MAXITER 1 need byte for terminator
  • AREA FLASH, CODE, READONLY
  • __main
  • MOV R0, MAXITER max iteration count
  • MOV R1, PORT port address
  • LDR R2, array array address
  • loop

11
Questions?
Write a Comment
User Comments (0)
About PowerShow.com