195
C-Control Pro Mega Series
© 2008 Conrad Electronic
Description
The thread gets the state "waiting". The state can be changed back to "inactive" with calls to
() or
Parameter
thread (0-13) thread number
signal signal value
6.18.11 Thread Example
// demo program of multithreading
// this program makes no debouncing, therefore a short trigger of the switch
// can lead to more than one string outputs
void thread1(void)
{
while(true)
// endless loop
{
if(!Port_ReadBit(PORT_SW2)) Msg_WriteText(str2);
// SW2 is pressed
}
}
char str1[
12
],str2[
12
];
void main(void)
{
str1=
"Switch 1"
;
str2=
"Switch 2"
;
Port_DataDirBit(PORT_SW1, PORT_IN);
// set Pin to input
Port_DataDirBit(PORT_SW2, PORT_IN);
// set Pin to input
Port_WriteBit(PORT_SW1, 1);
// set pull-up
Port_WriteBit(PORT_SW1, 1);
// set pull-up
Thread_Start(
1
,thread1);
// start new Thread
while(true)
// endless loop
{
if(!Port_ReadBit(PORT_SW1)) Msg_WriteText(str1);
// SW1 is pressed
}
}
6.18.12 Thread Example 2
// multithread2: multithreading with Thread_Delay()
// necessary library: IntFunc_Lib.cc
void thread1(void)
{
while(true)
Содержание 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: ......