Echelon Neuron C Bedienungsanleitung Seite 221

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 267
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 220
Neuron C Reference Guide 201
Symbol Description
_NCC5 Defined for version 5 of the Neuron C compiler. This
version corresponds to Version 2.2 of the Neuron C
language.
_NEURONC Defined for all versions of the Neuron C compiler.
_NODEBUILDER Defined for the Neuron C compiler that is included with
the NodeBuilder FX Development Tool, and later versions.
_SHORTSTACK Defined for the Neuron C compiler that is included with
the ShortStack LonTalk Interface Developer utility for
model files.
Built-In Semaphore
For Series 5000 chips, you use the Neuron C __lock { } keyword, followed by a
code block, within the application or the interrupt service routine (the interrupt
task) to acquire the built-in binary semaphore and synchronize access to shared
resources. The __lock keyword precedes a block of code (within a pair of curly
braces) that is controlled by the semaphor.
The semaphore is not supported for the lowest system clock rates (5 MHz and 10
MHz).
You can use the __lock keyword within either Neuron C code or pure C code (for
example, within a library).
Example:
interrupt (IO_0) {
... // do something not guarded by the semaphore
__lock { // acquire semaphore
... // do something guarded by the semaphore
} // release semaphore
... // more unguarded code
}
Because there is only one semaphore, you cannot nest locks. Nested locks yield a
compiler error, NCC#585. While the compiler detects and prevents direct nesting
of __lock{ } constructs within the same function, when task, or interrupt task, the
compiler does not detect runtime nesting.
Example: The following example illustrates nesting of locks at runtime.
void f() {
__lock {
... // do something
}
}
interrupt (IO_0) {
Seitenansicht 220
1 2 ... 216 217 218 219 220 221 222 223 224 225 226 ... 266 267

Kommentare zu diesen Handbüchern

Keine Kommentare