55:036

Embedded Systems and Systems Software

Spring, 2006

 

Third Laboratory Assignment

 

Due Dates:

 

     Prelab:  Tuesday, Feb. 14

     Lab Report:  Thursday, March 2

 

Objective:

 

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

 

Lab Description:

 

For this lab, you will construct a simple waveform generator.  This device will be capable of producing a square wave with an adjustable frequency in the range 100 HZ – 2.5 KHZ. The square wave is to be produced on the RC2 pin of the PIC (accessible via the terminal strip at the top edge of the QwikFlash board). Frequency 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 frequency.  When the maximum frequency (2.5 KHZ) is attained, further clockwise rotation of the pulse generator should have no effect.   Turning the pulse generator counter-clockwise should decrease the frequency of the square wave until the minimum frequency (100 HZ) 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 producing waveforms over the entire frequency range (100 HZ - 2.5 KHZ)
  2. While monitoring the generated waveform on a scope it should be possible, and easy, to adjust the device to any integer frequency within the specified range of operation (to within the resolution error of the PIC timers). 
  3. Frequency adjustment should be approximately linear over the frequency range--i.e. a given amount of pulse generator rotation should vary the frequency by approximately the same number of HZ at any point in the operating range (more about this in class on 2/09/06).
  4. It should be possible to traverse the entire frequency range with a relatively small number of revolutions of the pulse generator.  Adjusting the device to a given frequency 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 2/09/06)
  5. Do not use interrupts.  Also, do not use the PWM or CCP facilities of the PIC.
  6. The lab must be implemented in assembly language.

 

Once your device is operating correctly, adjust it to produce a 100 HZ waveform. Carefully observe the waveform on the scope and record any observed frequency error.  Now adjust the frequency to 2.5 KHZ 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. Also, read Chapter 14, Math Subroutines.

 

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 14:  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 and a copy of your initial source code.

 

Lab Report:

Your lab report (due on Thursday, March 2, 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 period of your waveforms at 100 HZ and 2.5 KHZ?  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.