You are on page 1of 2

B222L Microcontrollers and Programmable Logic Task 1 Specification

Automatic Gain Control (AGC) System

Your task is to design and implement AGC system using PIC18F252 microcontroller. AGC system should be able to
automatically adjust the gain of the input signal of varying amplitude so that the signal at the output retains
approximately constant amplitude during the system operation. Your system should therefore be able to convert the
analogue input into digital form, calculate the power of signal over a certain short period of time and multiply those
samples with appropriate scaling value before outputting them in order to keep the signal amplitude roughly
constant. The multiplied version of the signal should then be output and converted back to analogue domain via a
suitable designed DAC.
You should be able to demonstrate the operation of your system using MPLAB SIM simulator (Register Injection
and Register Trace simulator options). Test file with ADC data will be provided on the unit website, as well as
simple Matlab program to open and plot both input and output data files. Sample plots of input and output signals are
provided below.
Finally, you should be able to demonstrate the operation of the system using real, voltage type signal generated by
the function generator available in the lab.
For a higher mark you should be able to switch the AGC system on and off manually (by pressing the push button)
and enable the system to switch off automatically on no signal present detection. You can also try to increase the
accuracy of the system by using 10-bit instead of (basic requirement) 8-bit ADC and DAC system.
More details about the AGC project will be given in the lecture.

Marking Scheme (40 marks maximum):

Task Description Marks


1 Talk through program Input signal sampled at regular intervals using timer interrupt 10
feature and output to DAC, ADC configured and working properly,
8-bit DAC constructed and working; Sampling rate adjustable.
2 Simulation AGC system operation demonstrated using pre-generated test data. 8
PIC output stored into file and displayed. (Excel or Matlab
programs can be used for this task. Matlab code to do this will be
provided.)
3 Basic AGC system AGC system operation demonstrated in real-time using voltage 14
signal generated via function generator.
4 Advanced Features Manual on-off switch using push-button (interrupt); automatic 8
detection of no signal and automatic switch off etc.

It is expected that the students keep a LOG BOOK of all the activities performed with regards to this project.

Content of Logbook: Evidence of What, How, Why, When

All work relating to the tasks - during the timetabled lab each week and any additional time inside and outside the lab
- should be recorded in a personal journal/logbook - Each team member will need to keep their own logbook with
each entry starting date, place and the task worked on.

The following should be evident in the log books :-

A detailed circuit diagram should be developed that includes full labelling of all components, wires, pin
numbers etc.
For the Software section of the tasks flow charts, simulations, state diagrams or any other relevant approach
that simplifies the implementation and helps make sure that the code works correctly as expected.
All code should also be fully commented and formatted such that as time passes the reasons WHY
particular instructions, registers or memory locations have been used is recorded for future reference and for
the understanding of others.

1
B222L Microcontrollers and Programmable Logic Task 1 Specification

Example of PIC/AGC system input and adjusted output

PIC intput
1200

1000

800
ADC value

600

400

200

0
0 100 200 300 400 500 600 700 800 900 1000
sample number

PIC output
250

200

150
PORTB value

100

50

0
0 100 200 300 400 500 600 700 800 900 1000
sample number

(note the delay of the output signal and the AGC switch off section)

Timescales

Suggested Schedule:
Lab Weeks 1 (13/10/2011) - Introductory Lab for PIC
Lab Week 9 (8/12/2011) - AGC Assessment (Task1)

Note :

Attendance at the Laboratory is compulsory and the final course work mark is factored by the number of attendances.
If any student arrives late at the laboratory or leave the laboratory early, he/she would be registered as ABSENT

Repeating late-comer, would be considered absent.

You might also like