198
Libraries
© 2008 Conrad Electronic
Timer3 (16 Bit) (
only Mega128
)
Example: Frequency Generation with 10*1,085 µs =10,85 µs Period and 2*1,085µs =2,17 µs Phase Shift
10
,
2
,PS_8);
6.19.3 Frequency Measurement
Timer_1 (16Bit) and Timer_3 (16Bit) (
only Mega128
) can be used for direct measurement of a
frequency. The pulses per second are being counted, the result is then delivered in Hertz units. The
maximum frequency is 64kHz and is yielded by the 16 bit counter. An example for this kind of
frequency measurement can be found under "Demo Programs/FreqMeasurement". By shortening the
measuring time also higher frequencies can be measured. The result has then to be re-calculated
accordingly.
6.19.4 Pulse Width Modulation
There are two independent timers available for pulse width modulation. These are Timer_0 with 8 bit and
Timer_1 with 16 bit. By use of a pulse width modulation Digital-Analog-Converters can be realized very
easily. On the Mega128 Timer_3 can be used additionally.
Timer0 (8 Bit)
Example: Pulse Width Modulation with 138,9 µs Period and 5,42 µs Pulse Width, changed to 10,84 µs
Pulse Width
// Pulse: 10*542,5 ns = 5,42 µs, Period: 256*542,5 ns = 138,9 µs
10
,PS0_8);
20
);
// Pulse: 20*542,5 ns = 10,84 µs
Timer1 (16 Bit)
Example: Pulse Width Modulation with 6,4 ms Period and 1,28 ms Pulse Width Channel A and 640 µs
Pulse Width Channel B
10
,
20
,
10
,PS_1024);
// Period: 100*69,44 µs = 6,94 ms
// PulseA: 20*69,44 µs = 1,389 ms
// PulseB: 10*69,44 µs = 694,4 µs
6.19.5 Pulse & Period Measurement
By use of Timer_1 or Timer_3 (
only Mega128
) pulse widths and signal periods can be measured.
Here by use of the Input Capture Function (specific register of the Controller) the time between two
signal slopes is measured. This function utilizes the Capture-Interrupt (
measured between a rising and the next falling signal edge. A period is measured between two rising
signal edges. Because of the Input Capture Function program delay times will not as an inaccuracy
Содержание C-Control Pro Mega Series
Страница 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Страница 9: ...VIII Inhalt 2008 Conrad Electronic ...
Страница 10: ...Part 1 ...
Страница 17: ...Part 2 ...
Страница 23: ...Part 3 ...
Страница 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Страница 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Страница 58: ...Part 4 ...
Страница 91: ...82 IDE 2008 Conrad Electronic ...
Страница 92: ...Part 5 ...
Страница 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Страница 136: ...Part 6 ...
Страница 231: ...Part 7 ...
Страница 240: ......