Example, Error_log( ) function, Syntax – Echelon Neuron C User Manual

Page 100: Fblock_director( ) built-in function

Advertising
background image

80

Functions

Example

#pragma relaxed_casting_on
eeprom far unsigned int widget[100];
far unsigned int ram_buf[100];

void f(void)
{

eeprom_memcpy(widget, ram_buf, 100);

}

Because the compiler regards a pointer to a location in EEPROM or FLASH as a
pointer to constant data, #pragma relaxed_casting_on must be used to allow for

the const attribute to be removed from the first argument, using an implicit or

explicit cast operation. A compiler warning still occurs as a result of the const
attribute being removed by cast operation. See the discussion of the

eeprom_memcpy( ) function in the

Memory Management

chapter of the

Neuron C

Programmer's Guide

.

error_log( )

Function

The error_log( ) function writes the error number into a dedicated location in

EEPROM. Network tools can use the

Query Status

network diagnostic command

to read the last error. The NodeBuilder Neuron C debuggers maintain a log of

the last 25 error messages.
The

Neuron Tools Errors Guide

lists the error numbers that are used by the

Neuron Chip firmware. These are in the range 128 ... 255. The application can

use error numbers 1 ... 127.

Syntax

#include <control.h>
void error_log (unsigned int

error_num

);

error_num

A decimal number between 1 and 127 representing an

application-defined error.

Example

#define MY_ERROR_CODE 1
...
when (nv_update_fails)
{
error_log(MY_ERROR_CODE);
}

fblock_director( )

Built-in Function

The fblock_director( ) built-in function calls the director function associated with

the functional block whose global index is

index

. If the

index

is out of range, or

the functional block does not have a director function, the fblock_director( ) built-
in function does nothing except return. Otherwise, it calls the director function

Advertising