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

Page 174: Update_program_id( ) function

Advertising
background image

154

Functions

}

update_nv( )

Function

The update_nv( ) function copies from the structure referenced by the

nv-entry

pointer parameter to the network variable configuration table entry as specified

by the

index

parameter.

Important: This function has a mechanism that ensures that a reset or power

cycle during an EEPROM modification does not cause the device to go
unconfigured. This mechanism uses the error log to serve as a semaphore. Thus,

the error log is written to on every call to this function, even if the net effect of

the function is to not modify or write to the configuration data at all (because the
new contents match the old). Applications must minimize calls to this function to

ensure that the maximum number of supported writes for EEPROM is not

exceeded over the lifetime of the application.

See the ISO/IEC 14908 (ANSI/EIA/CEA-709.1)

Control Network Specification

for

a description of the data structure.

Syntax

#include <access.h>
void update_nv (const nv_struct *

nv-entry

, int

index

);

Example

#include <access.h>
nv_struct nv_copy;
network output SNVT_switch nvoSwitch;

void f(void)
{

nv_copy = *access_nv(nv_table_index(nvoSwitch));

// Modify the nv_copy here as necessary

...
update_nv(&nv_copy,nv_table_index(nvoSwitch));
}

update_program_id( )

Function

The update_program_id( ) function copies the 8-byte array referenced by the

pid_p

pointer parameter to the program ID stored in the device’s EEPROM.

Important: This function has a mechanism that ensures that a reset or power

cycle during an EEPROM modification does not cause the device to go

unconfigured. This mechanism uses the error log to serve as a semaphore. Thus,
the error log is written to on every call to this function, even if the net effect of

the function is to not modify or write to the configuration data at all (because the

new contents match the old). Applications must minimize calls to this function to
ensure that the maximum number of supported writes for EEPROM is not

exceeded over the lifetime of the application.

Advertising