189
C-Control Pro Mega Series
© 2008 Conrad Electronic
n
16 bit word
base
base of the number system
text
pointer to destination string
offset
offset that is applied to the position where the string is copied
minwidth minimal width of the string
If offset has the value STR_APPEND (
0xffff
) then the length of the destination string is assumed as
offset. In this case the source string is copied behind the destination string.
6.18
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. When multi threading after a certain number of processed Byte instructions 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 activated or are ready for processing. The main program counts as first
thread. Therefore thread "0" is active at all times even if no threads have explicitly been started.
The priority of threads can be influenced by changing the number of Bytecodes which one thread is
allowed to execute until the next thread change takes place (see
number of cycles until the change takes place, the lower the priority of the thread. The execution
time of one Bytecode is appr. 7 – 9 microseconds. With certain Bytecode instructions however this
will take longer (e. g. Floating Point Operations).
Also internal Interpreter functions count as cycles. Since e. g.
character arrives from the serial interface a cycle can in exceptional cases become quite long.
A thread will receive as much space for its local variables as has been assigned to in the
of the project. The exception is thread "0" (the main program). This thread will receive the
entire memory space that has been left over by the other threads. Therefore it should be planned in
advance how much memory space may be needed by each additional thread.
In order to start additional threads "Multi Threading" must be activated in
the additional threads the correct values must be set in
When working with threads
must always be used. If
nevertheless e. g. an AbsDelay(1000) is used the following effect may occur: Since the thread will
only change to the next thread after 5,000 cycles (default value), the thread would run for 5,000 *
1,000ms = 5,000 seconds before the next thread would be able to start working.
Thread Synchronisation
Sometimes it is necessary for a thread to wait for another thread. This may e. g. be a common
Summary of Contents for C-Control Pro Mega Series
Page 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Page 9: ...VIII Inhalt 2008 Conrad Electronic ...
Page 10: ...Part 1 ...
Page 17: ...Part 2 ...
Page 23: ...Part 3 ...
Page 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Page 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Page 58: ...Part 4 ...
Page 91: ...82 IDE 2008 Conrad Electronic ...
Page 92: ...Part 5 ...
Page 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Page 136: ...Part 6 ...
Page 231: ...Part 7 ...
Page 240: ......