Manual

Neuron C Reference Guide 117
muldivs( ) Function
The muldivs( ) function permits the computation of (
A
*
B
)/
C
where
A
,
B
, and
C
are all 16-bit values, but the intermediate product of (
A
*
B
) is a 32-bit value.
Thus, the accuracy of the result is improved. There are two versions of this
function: muldivs( ) and muldiv( ). The muldivs( ) function uses signed
arithmetic, while the muldiv( ) function (see above) uses unsigned arithmetic.
See also muldiv24( ) and muldiv24s( ) for functions which use 24-bit intermediate
accuracy for faster performance.
Syntax
#include <stdlib.h>
signed long muldivs (signed long
A
, signed long
B
, signed long
C
);
Example
#include <stdlib.h>
signed long a, b, c, d;
...
void f(void)
{
d = muldiv(a, b, c); // d = (a*b)/c
}
node_reset( ) Function
The node_reset( ) function resets the Neuron Chip or Smart Transceiver
hardware. When node_reset( ) is called, all the device’s volatile state information
is lost. Variables declared with the eeprom or config class and the device’s
network image (which is stored in EEPROM) are preserved across resets and loss
of power. The when(reset) event evaluates to TRUE after this function is called.
Syntax
#include <control.h>
void node_reset (void);
Example
#define MAX_ERRORS1 50
#define MAX_ERRORS2 55
int error_count;
...
when(error_count > MAX_ERRORS2)
{
node_reset();
}
when(error_count > MAX_ERRORS1)