197
C-Control Pro Mega Series
© 2008 Conrad Electronic
With Mega128 for reasons of the hardware the use of Timer_0 as counter is not possible!
Timer1 (16 Bit)
// Example: Pulse Counting with CNT1
pulse(n);
// generate n Pulses
6.19.2 Frequency Generation
To generate frequencies Timer_0, Timer_1 and Timer_3 can be utilized as follows:
Timer0 (8 Bit)
1. Example:
// Square Wave Signal with 10*1,085 µs = 10,85 µs Period Duration
Timer_T0FRQ(
10
, PS0_8)
2. Example: Pulsed Frequency Blocks (Project FRQ0)
void main(void)
{
int delval;
// Variable for the On/Off Time
delval=
200
;
// Value Assignment for Variable delval
// Frequency: Period=138,9 µs*100=13,9 ms,Frequency=72Hz
100
,PS0_1024);
// Timer is set to Frequency
while (
1
)
{
AbsDelay(delval);
// Time Delay by 200ms
// Timer is stopped
AbsDelay(delval);
// Time Delay by 200ms
// Timer will be switched on with
// Timer Prescaler PS0_1024.
}
}
The program will on Mega128 not work in USB mode since output PB4 is in conjunction with the USB
interface used on the Application Board.
Timer1 (16 Bit)
Example: Frequency Generation with 125 * 4,34 µs = 1085µs Period
125
,PS_64);
Содержание 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: ......