User`s manual

212 digi.com Keywords
segchain
Identifies a function chain segment (within a function).
int func ( int arg ){
...
int vec[10];
...
segchain _GLOBAL_INIT{
for( i = 0; i<10; i++ ){ vec[i] = 0; }
}
...
}
This example adds a segment to the function chain _GLOBAL_INIT. Using segchain is equivalent to
using the #GLOBAL_INIT directive. When this function chain executes, this and perhaps other segments
elsewhere execute. The effect in this example is to reinitialize vec[].
shared
Indicates that changes to a multi-byte variable (such as a float) are atomic. Interrupts are disabled when
the variable is being changed. Local variables cannot be shared. Note that you must be running off the
main system clock to use shared variables. This is because the atomicity of the write cannot be ensured
when running off the 32 kHz clock.
shared float x, y, z;
shared int j;
...
main(){
...
}
If i is a shared variable, expressions of the form i++ (or i=i+1) constitute two atomic references to
variable i, a read and a write. Be careful because i++ is not an atomic operation.