Syntax, Example 1, Example 2 – Echelon Neuron C User Manual

Page 142: Random( ) function

Advertising
background image

122

Functions

device interface (XIF) file. Thus, network tools can handle the network address

assignment for the variable properly. If any member of an array is propagated,
the polled attribute is blocked for all elements of the array. If a propagate( ) call

appears without arguments, all output variables’ polled attributes are blocked.

Syntax

void propagate ( [

network-var

] );

network-var

A network variable identifier, array name, or array

element. If the parameter is omitted, all output network

variables for the device are propagated.

Example 1

// The pragma permits network variable addresses
// to be passed to functions with non-const pointers,
// with only a warning.

network output UNVT_whatever nvoWhatever;

void f(const UNVT_whatever* p);

when (...)
{

f(&nvoWhatever); // Process by address in function f

propagate(nvoWhatever);

// Cause NV to be sent out

}

Example 2

network output const eeprom SNVT_address nvoAddress;

// Propagate nvoAddress on request
when (...)
{
propagate(nvoAddress);
}

random( )

Function

The random( ) function returns a random number in the range 0 ... 255. The

random number is seeded using the unique 48-bit Neuron ID. The random( )
function is computed from the data on all three CPU buses. If, after each reset,

the random( ) function is called at exactly the same time, the returned random

number is the same. However, if your device does anything different, based on
I/O processing or messages received, or based on data changes, and so on, the

random number sequence is different.

Syntax

unsigned int random (void);

Advertising