Instructions
354Libraries
© 2013 Conrad Electronic
5.24.15 Str_Printf Example
// CompactC
void main(void)
{
char str[80];
// Integer
Str_Printf(str, "arg1: %d\r", 1234);
Msg_WriteText(str);
// Ouput of integer, floating point, string und hex number
Str_Printf(str, "arg1: %8d arg2:%10.3f arg3:%20s arg4: %x\r",
1234, 2.34567, "hello world", 256);
Msg_WriteText(str);
Str_Printf(str, "arg1: %u arg2: %.2u\r", 65000, 0xff);
Msg_WriteText(str);}
}
' Basic
Sub main()
Dim str(80) As Char
Str_Printf(str, "arg1: %08d arg2:%10.3f arg3:%20s arg4: %x\r",
1234, 2.34567, "hello world", 256)
Msg_WriteText(str)
Str_Printf(str, "arg1: %u arg2: %.2u\r", 65000, &Hff)
Msg_WriteText(str)
End Sub
5.25 Threads
Multi Threading
Multi Threading is a so to speak parallel execution of several tasks in a program. One of these tasks
is called “Thread”. When Multi Threading it will rather rapidly be toggled between the various threads
so the impression of simultaneousness is created.
The C-Control Pro firmware supports besides the main program (Thread "0") up to 13 additional
threads. With Version 2.12 of the IDE the multithreading changed. Before 2.12 the user could set in
the project options the number of Bytecodes that were executed before there was a thread change.
This behavior was unfair, because some Bytecodes (especially floating point) needed much more
CPU time than other Bytecodes. Now the multithreading scheduler works with time cycles. A user
can assign the number of 10ms cycles a thread has before the next threads get executed.
In multithreading, after a certain number of time cycles the current thread will be set "inactive" and
the next executable thread is searched for. After that the execution of the new thread will be started.
The new thread may again be the same as before depending on how many threads had been activ-
ated or are ready for processing. The main program counts as first thread. Therefore thread "0" is