EE 314

/ Spring 2000
Microprocessor Systems

April 10 – April 24

Introduction

This experiment will take the remainder of the semester to fully develop and demonstrate. It will require several subtasks to be completed. The goal is to implement demonstrate a real-time, closed-loop control system. A closed-loop control system is defined as one that measures its own output and adjusts its input accordingly by using feedback. In this lab, you will be measuring water depth in a constantly draining bucket, and using that feedback information to control a pump to maintain a constant water depth.

The depth measurement circuit consists of a LM555 timer (see attached data sheet) acting as a capacitance controlled oscillator, and a wire loop that goes into the water bucket. This loop is a capacitor, and as the water level changes, so does its capacitance, which in turn changes the period of the LM555. The timer connects with the DigiLab board by tapping into the parallel port connection via the custom board that the parallel cable plugs into. When the counter is enabled, it will begin counting the number of pulses from the timer. The program should retrieve this data at regular intervals, so that it can be used to determine when the pump will be turned on and off. The software timing should be accomplished by implementing a slightly modified VEC8 procedure from Lab 7.

Before starting this lab you will need to become familiar with both the software and the hardware aspects of this problem. For the hardware, the DigiLab boards will be used to implement a counter and the parallel port interface. As can be seen from the attached Xilinx schematic, there are three control pins and eight data pins used by the feedback system to measure the output. These control pins are the reset for the counter, the enable for the counter, and a select for outputting the MSB/LSB (Most Significant Byte/Least Significant Byte) of the counter value from the DigiLab board to the PC. Data from the counter will be two bytes wide, so a data input command will have to be given twice to input the data through the 8-bit Parallel Port data register. Once the feedback data is processed, Pin 14 of the parallel port will be used to control the operation of the pump and adjust the water level to the desired level. Additional information about parallel port operation is readily available on the internet

There are two main goals. The first is to demonstrate that you can maintain a fixed water level depth regardless of how open the drain is (from fully closed to fully open). The second is to maintain a bar-graph video screen display showing the current water level.

The following requirements are to be met while achieving these goals:

1.  The control of the data sampling and display must be done with an interrupt service routine. This will mean replacing an existing routine with the new one, and then restoring the old one before exiting the program.

2.  The programming should be organized and written in C with in-line assembly language statements. The program can be run directly from the TCC produced executable. Compilation to assembly is NOT necessary (or productive).

Pre-lab (due at the beginning of the next lab period)

Get your team together to determine which tasks need to be done and which person will do each task. Determine how you will organize the subtasks and when they will be brought together to solve the whole problem. Present your plan to the laboratory instructor. A measure of the work includes how well you organize and break the project into appropriate pieces.

Laboratory Procedure (Report due at the last lab session)

1.   Write a procedure to fill the water tank. Then determine how long it takes the tank to empty.

2.   Write an interrupt procedure, which replaces the BIOS ISR type 08. This is the timer interrupt.

3.   Write a procedure to convert the 16-bit data from the bucket into usable depth information. Choose a time period in which the read/reset cycle will happen Explain your reasoning on what time period you choose. Derive a method to accurately measure the time.

4.   Organize the whole program to consist of the following steps:

(a)   Initialize the system by setting up the new ISR.

(b)   Start the system by filling the tank.

(c)   Choose one of four pre-determined water level to maintain.

(d)   Enter closed-loop control, which holds the water depth at an adjustable level and be able to raise or lower the level by one, while staying in closed loop control.

(e)   Show a water level bar graph, the current 16-bit sample from the counter, and the status of the pump on the video display.

(f)   Terminate closed-loop control and restore the original ISR.

5.   In the final report, elaborate on the design requirements for the project, the division of labor, and project management. Be sure to follow the standard report format.

Bonus Credit Options:

·  Use what you learned in Lab 8 about the PC speaker to output an audible "alarm" that is quiet when the water is a the desired level, but emits a series of beeps when it departs from the desired level.

·  Do the same as above, but make the series of beeps go faster the farther away the water level is from its desired value to indicate "increased urgency".

·  Extend the above idea such that the frequency (pitch) of the beeping tone also increases the farther away the water level is from its desired value.

·  Use what you learned in Lab 7 about DACs to output DC signals that can be displayed using a digital multimeter (DMM) to indicate the water depth and/or flow rate. Calibrate the DAC output(s) so that the DMM display indicates actual measurements of depth and/or flow rate.