Microcomputer Systems -Lab 7: Parallel Input and Output Part 2 | ECE 3120, Lab Reports of Microcomputers

Material Type: Lab; Class: Microcomputer Systems; Subject: ECE Elect & Computer Engr; University: Tennessee Tech University; Term: Spring 2008;

Typology: Lab Reports

Pre 2010

Uploaded on 07/30/2009

koofers-user-lwe
koofers-user-lwe 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ECE-3120
Spring 2008
LAB 7 – Parallel I/O, part 2
3/26/08 Page 1 of 4 Lab 7
The purpose of this lab is to learn the use of the 68HCS12 parallel ports to interface to
simple devices, in a program that counts and displays switch activations on the LEDs and
7-segment digits. This is a continuation of the program started in Lab 6.
PRE-LAB:
Prepare pseudocode and the first draft of the program. This must be completed before
coming to the lab and shown to the lab instructor at the start of the lab session. Note: The
Pre-Lab must be typed into a proper *.ASM source file, following our standard Program
Format requirements.
Approved: Lab TA _____________________ Date ____________
PROGRAMMING ASSIGNMENT:
Write a fully-commented program for the Dragon12 board, following our standard
Program Format requirements
(http://iweb.tntech.edu/rhaggard/3120s08/Program_Format.htm), including appropriate
directives and labels for memory operands and constants, called Digits.asm. The
program should do the following:
This program will run forever in a loop, as most real embedded systems do.
So run the program continuously and never exit, except when the reset button
is pressed or power is cycled off-on.
The LEDs and 7-segment Digits must be time-multiplexed (periodic scanning)
over a suitable timing interval, as discussed in class and in the book. Thus all
Digits and LEDs will always display the proper values, with sufficient
brightness, without any visible flicker.
(from Lab6) Read the changes in value of two pushbutton switches (labeled
on-board as SW2 and SW5) reliably. So the switches must be de-bounced and
edge-detected so that one and only one count event is produced each time the
switch is pressed, no matter how long it is between pressing and releasing the
switch.
pf3
pf4

Partial preview of the text

Download Microcomputer Systems -Lab 7: Parallel Input and Output Part 2 | ECE 3120 and more Lab Reports Microcomputers in PDF only on Docsity!

Spring 2008

LAB 7 – Parallel I/O, part 2

The purpose of this lab is to learn the use of the 68HCS12 parallel ports to interface to simple devices, in a program that counts and displays switch activations on the LEDs and 7-segment digits. This is a continuation of the program started in Lab 6.

P R E - L A B :

Prepare pseudocode and the first draft of the program. This must be completed before coming to the lab and shown to the lab instructor at the start of the lab session. Note: The Pre-Lab must be typed into a proper *.ASM source file, following our standard Program Format requirements.

_Approved: Lab TA _____________________ Date _____________

P R O G R A M M I N G A S S I G N M E N T :

Write a fully-commented program for the Dragon12 board, following our standard Program Format requirements (http://iweb.tntech.edu/rhaggard/3120s08/Program_Format.htm), including appropriate directives and labels for memory operands and constants, called Digits.asm. The program should do the following:

  • This program will run forever in a loop, as most real embedded systems do. So run the program continuously and never exit, except when the reset button is pressed or power is cycled off-on.
  • The LEDs and 7-segment Digits must be time-multiplexed (periodic scanning) over a suitable timing interval, as discussed in class and in the book. Thus all Digits and LEDs will always display the proper values, with sufficient brightness, without any visible flicker.
  • (from Lab6) Read the changes in value of two pushbutton switches (labeled on-board as SW2 and SW5) reliably. So the switches must be de-bounced and edge-detected so that one and only one count event is produced each time the switch is pressed, no matter how long it is between pressing and releasing the switch.

Spring 2008

LAB 7 – Parallel I/O, part 2

  • (from Lab6) Whenever SW2 is pressed, increment the counter. Whenever SW5 is pressed, decrement the counter. Display the current value of the counter in binary (%00000000 to %11111111) on the 8 LEDs. Wrap-around the count to 0 after incrementing above $FF and wrap-around to $FF after decrementing below 0, which is the natural behavior of binary counters. LED PB7 is the MSB. A LED should be ON if that count bit = 1 and OFF if that count bit = 0.
  • (from Lab6) Only one of the two switches may be pressed at any given moment, never both simultaneously.
  • Also display the current value of the counter in decimal (000-255) on the three right-most 7-segment Digits. The left-most Digit must always remain off. Hint: you must convert the 8-bit binary counter value to 3 BCD digits, and then convert each digit to the proper 7-segment code, before sending these codes to the Digits.
  • Initially reset the counter to zero and turn off all the Digits and LEDs.
  • Use polling (not interrupts) for all I/O operations.
  • Include and use the standard files, HCS12.INC and DELAY.ASM.
  • Follow the overall program organization that was recommended in class for time-driven applications such as this one.
  • As always, the code must start at $1000.

The program may use directives to create data in memory locations beginning at $ as needed. Clearly define all data in your code!

Spring 2008

LAB 7 – Parallel I/O, part 2

Things to turn in as your Lab Report, attached in this order:

  1. This assignment sheet, with your name at the top, signed by the TA where shown.
  2. Your uncorrected pre-lab document (commented source code).
  3. A printout of the final Digits.asm and Digits.lst files. Put a NOLIST directive before each INCLUDE statement and a LIST directive after each INCLUDE statement to omit all included files lines from the LST file, but still show all your written code. You’ll need to print the listing file in landscape mode to make it fit. Use Notepad to print them.
  4. A printout from the terminal screen (method: highlight text, type ctrl+c, and paste into a Notepad or Word document, using Courier New as the font) that includes everything done. Add brief hand-written comments and highlight important values at each step in the procedure, showing the relevant memory contents and register contents. Good hand-written comments and explanations are ESSENTIAL to make this meaningful to the grader.
  5. Answer the following questions, in your document:
  1. What are the minimum and maximum values that you could use for the time delay in the main loop of this program? What would these values be if you had to use all four Digits and the LEDs? Explain all values.
  2. How can you change the time-multiplexed output to support a dimmer display without noticeable flicker through hardware changes only? How about through software changes only? Do NOT write any code.
  3. Describe a significantly different way to convert the binary count to its final 7-segment codes. Give the pros and cons of each method (i.e. this new way versus the way you did it in your program). Do NOT write the code, just describe the approach.

Finally, copy all your computer files for the report into your 3120 ClassDrop folder, under the new folder Lab7, on the campus network at \Athena.pclab.tntech.edu\ClassDrops\ECE\ECE3120-Haggard\your-name\Lab