196
Libraries
© 2008 Conrad Electronic
{
Msg_WriteText(str2); Thread_Delay(
200
);
}
// "Thread2" is displayed
}
// after that the thread
// sleeps for 200ms
char str1[
12
],str2[
12
];
// global variable declaration
//------------------------------------------------------------------------------
// main program
//
void main(void)
{
str1=
"Thread1"
;
// variable declaration
str2=
"Thread2"
;
// variable declaration
Thread_Start(
1
,thread1);
// start new thread
while(true)
// endless loop
{
Thread_Delay(
100
); Msg_WriteText(str1);
}
// the thread sleeps for 100ms
}
// after that "Thread1" is displayed
6.19
Timer
In C-Control Pro Mega 32 there are two, in Mega128 are three independent timers available. These
are Timer_0 with 8 bit and Timer_1 with 16 bit (Timer_3 with 16 bit for Mega128 only). Timer_2 is
used by the firmware as an internal time base and is set firm to a 10ms interrupt. These internal
timers can be utilized for a multitude of tasks:
·
·
·
·
·
·
6.19.1 Event Counter
Here are two examples for how a Timer can be used for an Event Counter:
Timer0 (8 Bit)
// Example: Pulse Counting with CNT0
pulse(n);
// generate n Pulses
Содержание 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: ......