55:036

Embedded Systems and Systems Software

Spring, 2007

 

Fourth Laboratory Assignment

 

Due Dates:

 

     Prelab:  Tuesday, Feb. 27

     Lab Report:  Thursday, March  22

 

Objective:

 

The purpose of this lab is to gain experience with interrupts, alphanumeric LCDs, and pushbutton switches.

 

Lab Description:

 

For this lab, you will extend the simple waveform duty-cycle controller constructed in Lab 3.  The functionality to be implemented is as follows:


  1. The user should be able to select form three different square waveform frequencies: 10 HZ, 25 HZ or 50 HZ.  The waveform frequency is selected by pushbutton switch SW3 located in the lower right-hand corner of the QwikFlash card. Each press of this button should advance the waveform frequency cyclically through the sequence: 10 Hz -> 25 Hz -> 50 Hz -> 10 Hz -> ...
  2. For the currently selected waverform frequency, the duty-cycle should be adjustable over the range 0.1% through 99.9% in 0.1% increments using the RPG.
  3. At all times, the current waveform frequency and duty-cycle should be displayed on the LCD screen, in the following form:

 

F= 25 Hz

DC=75.6%

 

To receive full credit, your design must satisfy the following requirements:

  1. It should be capable of producing square waveforms at the three specified frequencies: 10 Hz, 25 Hz, 50 Hz with the frequency selected via the SW3 pushbutton.  The waveform frequency should be accurate to within the resolution error of the PIC timers.
  2. It should be possible, and easy, to adjust the duty-cycle of the waveform over the range 0.1% through 99.9% in 0.1% increments with accuracy within the resolution error of the PIC timers.
  3. If the waveform frequency is changed, the device should automatically begin producing a waveform at the new frequency with the currently selected frequency--e.g. if the device is set to produce a 10 Hz waveform with a 70.2% duty cycle and the selected frequency is changed to 25 Hz the device should immediately begin generating a 25 Hz square wave with a 70.2% duty cycle.
  4. As with Lab 3, it should be possible to traverse the entire duty-cycle range with a relatively small number of revolutions of the pulse generator.  Adjusting the device to a given duty-cycle should require only a few revolutions without sacrificing the ability to precisely control the duty-cycle in 0.1% increments.
  5. At all times, the current frequency and duty-cycle must be displayed on the LCD as described above.
  6. The lab must be implemented in assembly language.

 

Once your device is operating correctly, use a scope or logic analyzer to verify the accuracy of the waveform generation at the low end, middle, and high-end of the duty-cycle for each selected wave-form frequency.

 

Prelab:

 

Carefully review the class lecture notes and read Chapters 7 and 9 in the text to fully understand the basics of LCDs and PIC18x interrupts.

 

Carefully design your solution to the lab using flow charts and/or pseudo-code.  Do not start writing assembly code until you FULLY AND COMPLETELY UNDERSTAND the solution.

 

To be submitted on Tuesday, February 27:  Pre-lab report in the format specified in the Laboratory Guidelines document. The pre-lab report should include a detailed flowchart and/or pseudo-code code description of your algorithm.

 

Lab Report:

Your lab report (due on Thursday, March 22), should follow the general format described in Laboratory Guidelines document. In addition, answer the following two questions:
1. What, if any, errors did you observe in the measured frequency and duty-cycle of your waveforms versus the values displayed on the LCD at the specified measurement points?  Identify the source of any observed errors.

2.  Are there any undesirable aspects to your design that impedes its functionality or performance?  If so, explain how you would modify the design to fix these shortcomings.