55:036

Embedded Systems and Systems Software

Spring, 2007

 

Third Laboratory Assignment

 

Due Dates:

 

     Prelab:  Tuesday, Feb. 13

     Lab Report:  Thursday, March 1

 

Objective:

 

The purpose of this lab is to gain experience with digital I/O, timers and complex timing issues, and rotary pulse generators.

 

Lab Description:

 

For this lab, you will construct a simple system to control the duty cycle of a square wave. The duty cycle is the percentage of the waveform period for which the waveform is at its high (logical one) value. This device will be capable of varying the duty cycle of a 10 HZ square wave over the range 0.1% through 99.9% in 0.1% increments.. The wave form is to be produced on the RC2 pin of the PIC (accessible via the terminal strip at the top edge of the QwikFlash board). Duty cycle adjustment is done using the rotary pulse generator on the QwikFlash board.  This pulse generator is permanently connected to pins RD0 and RD1 of the PIC.  Turning the pulse generator clockwise should increase the duty cycle.  When the maximum duty cycle (99.9%) is attained, further clockwise rotation of the pulse generator should have no effect.   Turning the pulse generator counter-clockwise should decrease the duty cycle of the square wave until the minimum duty cycle (0.1%) is attained.  At this point, further counter-clockwise rotation should have no effect. To demonstrate your program, you should connect RC2 to a scope and observe the waveform behavior as the pulse generator is turned.

 

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

  1. It should be capable of generating duty cycles over the entire range from 0.1% through 99.9% in 0.1% increments
  2. While monitoring the generated waveform on a scope it should be possible, and easy, to adjust the device to any duty cycle within the specified range of operation (to within the resolution error of the PIC timers). 
  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.  However, this feature should not come at the expense of requirement 2 above. (more about this in class on Thursday, Feb. 8)
  4. Do not use interrupts.
  5. The lab must be implemented in assembly language.

 

Once your device is operating correctly, adjust it to produce a waveform with the minimum possible duty cycle (0.1%). Carefully observe the waveform on an and record any observed error.  Now adjust the duty cycle to the maximum value (99.9%) and repeat the process.

 

Prelab:

 

Carefully read Chapter 8 in the text and be sure that you understand how to measure RPG rotation, including rate-sensitive RPG.

 

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 13:  Pre-lab report in the format specified in the Laboratory Guidelines document. The pre-lab report should include a flowchart and/or pseudo-code code description of your algorithm.

 

Lab Report:

Your lab report (due on Thursday, March 1, 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 duty cycle of your waveforms at 0.1% and 99.9% duty cycles?  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.