Microprocessors Laboratory - Exercises page

UFSC/LISHA - Author: Hugo Marcondes, Wolfram Stacklies and Thiago Leao Moreira

Digital Voltimeter

Migrating to ATMega

The migration of Light Keyboard to ATMega was done changing program file, making a new Memory Map on avr8.h and using the gicr, instead of gimsk. The implementation can be viewed downloading the file atmega01.tgz.

Design Documentation

The file avr8.h defines the map of various AVR mcu, The AVR8 class defines the common registers of all AVR family mcu and it's specializations defines the I/O map for specifics mcu. The AT90S I/O map and ATMega I/O map was implemented on avr8.h

For the digital voltimeter was used the ATMega chipset, since the AT90S don provides a ADC.

The main.cc file provide the main program function, that does nothing and a class called DigitalVoltimeter. This one is responsible to configure the ADC and handle the ADC interrupt to write the converted value on the led's port.

All process of configuration is done on the class constructor, and to member function was provided to write on led port (output(char value);) and to handle the ADC interrupts (handle_adc();)

Operational Caracteristics

Sample rate

The AVR ADC was configured for Free Running Mode, this mean that the samples were made one after another. The ATMega made one conversion in about 65-260 microseconds, so the sample rate is at least 3.84 conversions per second.

Resolution

The working ADC resolution is of 1024 levels (10bits), since we have just 8 leds for output the conversion result on STK500, the visible resolution is of just 8bits, or 256 levels.

Max. Error - Theory

Our scale range is 4.9 Volts, using a resolution of 8bits, each level corresponds to 0.01914 ( 4.9 / 256 ). Thus, the maximum error is -/+ 0.0095 Volts.

Measured Error

The table below shows the measured input voltage vs. converted output voltage, at the resolution of 8 bits. The average error is shown below.
ValueConvertedError
0,00,00,0
1,00,980,02
2,52,490,01
4,04,00,0
4,884,880,0
Avg. Error0,006

Warning: Undefined array key "PATH_TRANSLATED" in /var/www/intranet/teaching/esl/ine5349-2004-1/work/g7/index.php on line 25

Warning: opendir(/digitalvolt): Failed to open directory: No such file or directory in /var/www/intranet/teaching/esl/ine5349-2004-1/work/g7/index.php on line 26