ECE 2534 Test 2: Assembly Subroutine and Timer Interrupts for LCD Control, Exams of Microprocessors

Instructions for writing an assembly subroutine to write a nibble to the lcd and a c main routine with an associated isr to generate timer interrupts every 0.25 seconds and increment leds. It also explains the generate and capture modes of the timer and their uses.

Typology: Exams

Pre 2010

Uploaded on 05/14/2009

angularmomentum
angularmomentum 🇺🇸

5

(2)

74 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE 2534 Test #2 3/10/08
1. Write an assembly subroutine to implement the following header:
#######################################################################
# Program: WriteNibble
# Description: Writes a nibble of command or data to the LCD with the proper timing.
# Register Usage: Input: r5 contains command or data in its least significant nibble
# r6 is 0 if command, 1 if data
# Output: none
# Scratch: r7-r12
# Note: Assumes instructions execute in 20nsec (50MHz clock)
#######################################################################
.equ LCD_CONT, 0x81440000
#bits: unused | LCD_E | LCD_RS | LCD_RW | AD_CONV Keep AD_CONV low
.equ LCD_DATA, 0x81440008
#bits 28-31 are the 4 data bits.
2. Write a main routine and associated ISR in C to cause the timer subsystem to
generate interrupts every 0.25 seconds and to increment the LEDs on each
interrupt. The main routine should initialize the LEDs to zero and terminate in an
infinite loop. You may assume that a C-callable routine named MicroBlazeIE
exists to set the IE bit in the machine status register.
Register
Address
Bits
IER
0x81800008
Unused | switches | timer | video
IAR
0x8180000C
MER
0x8180001C
TCSR0
0x83C00000
Unused | ENALL | PWMA0 | T0INT
ENT0 | ENIT0 | LOAD0 | ARHT0
CAPT0| GENT0 | UDT0 | MDT0
TLR0
0x83C00004
LEDS
0x81480000
3. Explain the operation of the generate and capture modes of the timer. Give an
example use for each mode.
pf3
pf4
pf5

Partial preview of the text

Download ECE 2534 Test 2: Assembly Subroutine and Timer Interrupts for LCD Control and more Exams Microprocessors in PDF only on Docsity!

ECE 2534 Test #2 3/10/

  1. Write an assembly subroutine to implement the following header: #######################################################################

Program: WriteNibble

Description: Writes a nibble of command or data to the LCD with the proper timing.

Register Usage: Input: r5 contains command or data in its least significant nibble

r6 is 0 if command, 1 if data

Output: none

Scratch: r7-r

Note: Assumes instructions execute in 20nsec (50MHz clock)

####################################################################### .equ LCD_CONT, 0x #bits: unused | LCD_E | LCD_RS | LCD_RW | AD_CONV Keep AD_CONV low .equ LCD_DATA, 0x #bits 28-31 are the 4 data bits.

  1. Write a main routine and associated ISR in C to cause the timer subsystem to generate interrupts every 0.25 seconds and to increment the LEDs on each interrupt. The main routine should initialize the LEDs to zero and terminate in an infinite loop. You may assume that a C-callable routine named MicroBlazeIE exists to set the IE bit in the machine status register. Register Address Bits IER 0x81800008 Unused | switches | timer | video IAR 0x8180000C MER 0x8180001C TCSR0 0x83C00000 Unused | ENALL | PWMA0 | T0INT ENT0 | ENIT0 | LOAD0 | ARHT CAPT0| GENT0 | UDT0 | MDT TLR0 0x83C LEDS 0x
  2. Explain the operation of the generate and capture modes of the timer. Give an example use for each mode.