Echelon NodeBuilder FX User Manual
Page 201
NodeBuilder FX User's Guide
187
SetLed( 1, DigitalOutput[1]::cpDigitalDefault.state );
setLockedOutBit( uFblockIndex, FALSE );
}
....
Add when-tasks Responding to I/O and Timer Events
You can add when-tasks to respond to I/O and timer-related events, as needed. Add these event
handlers to the main source file if they affect global I/O or timers, and add them to the individual
functional block’s source file if they affect functional block-specific items.
Add interrupt-tasks Responding to Interrupt Requests
You can add interrupt-tasks to respond to interrupt requests, as needed. Add these interrupt handlers
to the main source, and enable interrupt processing. Interrupt processing is typically enabled in the
reset task, but other tasks, such as the online and offline tasks, may also enable or disable the interrupt
system.
Add Code to when(nv_update_occurs(
with Input NVs
For functional blocks that implement input network variables, add code to the
when(nv_update_occurs(<nv>)) when-task in the subject functional block or functional block array,
where <nv> is the related input network variable or network variables. The Neuron C scheduler will
raise this event and execute the related when-task when at least one of the associated input network
variables has been updated. You can use the built-in Neuron C variables, such as nv_in_addr,
nv_in_index, or nv_array_index, to obtain more details about the update from within the when-task.
Code Wizard implements one input network variable when-task for each functional block or functional
block array in order to achieve short scheduler-cycles and therefore a responsive device.
Share Code with filexfer.nc when Handling Explicit Messages on a Device
Implementing FTP
When adding code that handles explicit messages and contains unqualified when(msg_arrives) event
handlers on a device that implements FTP with the sender-capability enabled, the sender routine does
itself implement such an event handler. There can only be one such event handler and this handler
must be the last when-task in compilation order; therefore, you must share your code with the code
provided in the filexfer.nc file. The FTP server implementation uses the #pragma scheduler_reset
directive if the sender-capability is enabled (this is the default). See the filexfer.nc and filexfer.h files
for more details.
Ignore NCC#310 and NC#463 Compiler Warnings
You may notice a few compiler warnings that appear when compiling unedited Code Wizard code,
referring to items being declared but never used (warning NCC#310), or referring to the const attribute
being casted away (warning NCC#463). The second warning, NCC#463, should only occur if support
for the file transfer protocol has been requested. Both messages can be safely ignored in this case.
You can eliminate NCC#310 warnings during a final clear-up phase during device development. This
will reduce memory requirements and reduce the size of the application image, thus reducing
download times. The items referred to by these NCC#310 warnings are utility functions provided for
your convenience. These functions are declared in common.nc and can safely be removed if not used.
Alternatively, you can use the #pragma disable_warning directive to disable selected warnings.
Implementing Changeable-Type Network Variables
You can use changeable-type network variables to implement generic functional blocks that work with
different types of inputs and outputs. For example, you can create a general-purpose device that can be
used with a variety of sensors or actuators, and then create a functional block that allows the integrator
to select the network variable type depending on the physical sensor or actuator attached to the device.