![]() |
Tutorial for learning avr assembler language of AVR-single-chip-processors AT90Sxxxx of ATMEL using practical examples. Simple 8-bit-analog-digital-converter with PWM on the STK500 board |
The picture on the left shows the whole test hardware to connect to the STK500
board. The port pins are viewed from above the board.
Some further hints on that test application. The hardware components can be
placed on a small external test board. The connections to the STK500 board
can be done by using the STK500 supplied two-wire cables, if proper pins are
mounted to the small additional board. Don't forget that the LEDs in this
test application must be connected to port C, because we need port B for the
analog inputs. Due to this, we can't use this hard- and software for the
STK200 board (which has attached the LEDs to port B by hard wiring). After
finishing work with this test setting, don't forget to reconnect the LEDs
to port B again, using the 10-wire parallel cable, other programs might
not work correctly with the LEDs connected to port C.
Loading and unloading of the RC filter is shown in the simulation graphic.
The modulation of the PWM output by the rectangle U(PWM) is still visible
in the voltage of RC1. This modulation is strongly reduced on RC2. But U(RC2)
shows a delay, its lacking behind the mean voltage on U(RC1). This delay of
the mean value is even higher on U(RC3).| 1 1000.0000 | 2 0100.0000 | 3 0010.0000 |
4 0001.0000 | 5 0000.1000 |
|---|---|---|---|---|
| V=2,5V 1000.0000 | V=1,25V 0100.0000 |
V=0,625V 0010.0000 | V=0,3125V 0001.0000 |
V=0,15625V 0000.1000 |
| V=0,46875V 0001.1000 | ||||
| V=0,9375V 0011.0000 | V=0,78125V 0010.1000 | |||
| V=1,09375V 0011.1000 | ||||
| V=1,875V 0110.0000 | V=1,5625V 0101.0000 |
V=1,40625V 0100.1000 | ||
| V=1,71875V 0101.1000 | ||||
| V=2,1875V 0111.0000 | V=2,03125V 0110.1000 | |||
| V=2,34375V 0111.1000 | ||||
| V=3,75V 1100.0000 | V=3,125V 1010.0000 |
V=2,8125V 1001.0000 | V=2,65625V 1000.1000 | |
| V=2,96875V 1001.1000 | ||||
| V=3,4375V 1011.0000 | V=3,28125V 1010.1000 | |||
| V=3,59375V 1011.1000 | ||||
| V=4,375V 1110.0000 | V=4,0625V 1101.0000 |
V=3,90625V 1100.1000 | ||
| V=4,21875V 1101.1000 | ||||
| V=4,6875V 1111.0000 | V=4,53125V 1110.1000 | |||
| V=4,84375V 1111.1000 |
The graphic left shows the algorithm for the whole control of the AD conversion.