Providing a large ram space, Performing neuron c functions, Ge 234 for – Echelon Neuron C User Manual

Page 246

Advertising
background image

234

Neuron C Custom System Images

limit is cumulative, in other words, the two (or more) images cannot use

more than 64 bytes in total. Any unused RAM from this 64-byte area is
made available to the application program when it is linked. Custom

system images can only use far RAM variables. Include the far keyword

in any extern declarations of these variables (see point # 4, above).

6

You cannot access EEPROM variables from a custom system image.

Providing a Large RAM Space

The total amount of RAM space available to a custom system image at link time

is 64 bytes. However, if a custom system image needs a larger amount of RAM
for certain functions, a large RAM block can be declared by an application

program that uses the custom system image, and the application program can
make this known to the custom system image during reset. This functionality

can be placed inside a reset routine provided in an include file associated with

the custom image. An application using the custom image would then be
expected to include the include file, and call the reset routine from the

when(reset) task.
A pointer to this RAM block can be passed as a parameter to the appropriate
custom system image functions each time they are called. For a more efficient

implementation, the custom system image can use 2 bytes of its RAM space to

declare a global pointer to such a block of memory, and initialize the pointer to
NULL. When the application program resets, it has the responsibility of

correctly setting this global pointer variable to point to the block of memory, or at

least the responsibility of calling an initialization function (providing this
pointer).

Performing Neuron C Functions

The pure C code that is placed in a custom system image cannot contain
references to network variables, messages, I/O objects, timers, or other Neuron C

objects. However, the custom system image can be designed mainly for the

purpose of performing Neuron C related tasks, such as standard I/O device
management, message construction, or timer manipulation.
You can access Neuron C objects from a custom system image function by making

it the responsibility of the application program to actually perform the Neuron C
operation in a function. The custom system image can declare a RAM variable

that the application sets to a pointer to the application function. The custom

system image can then call the function in the Neuron C application program,
and effectively perform Neuron C operations.
For example, consider a custom system image that contains routines for

management of a standard LCD display device. This custom system image would
contain various routines for formatting information and for managing the display

in response to various commands from the application program. It is desirable to
have the custom system image code automatically perform the I/O operations to

update the device. It might also be necessary for such a custom system image to

have access to a large buffer in RAM. However, due to the pure C restriction and
the custom system image RAM memory restriction, neither of these requirements

can be implemented solely within the custom system image. The RAM buffer can

be provided by the application as discussed above.

Advertising