Example Of Reading And Writing From The Nvram - WAGO 750 Series Manual

Linux fieldbus coupler
Hide thumbs Also See for 750 Series:
Table of Contents

Advertisement

8.5 Example of Reading and Writing from the NVRAM

The NVRAM (Non Volatile Random Access Memory) is a non-volatile
memory that retains its information even after the Linux fieldbus coupler has
been switched off.
Benefit of the NVRAM:
• Short access times similar to RAM.
• Can be written to like a RAM
• Storage of data in the event of power loss similar to flash memory.
Access to the NVRAM
Access to the NVRAM is done via the nvram device file which is located in
the dev directory of the Linux fieldbus coupler. The NVRAM can be written
and read byte by byte. The following functions allow user space access to the
NVRAM:
WAGO-I/O-SYSTEM 750
Linux Fieldbus Coupler
Example of Reading and Writing from the NVRAM
int open (const char *pathname, int flags);
This function opens the indicated file and returns the file descriptor. The
file descriptor is a reference to the open file.
pathname: Path of the device file: /dev/nvram
flags: O_WRONLY, O_RDONLY, O_RDWR
ssize_t read(int fd, void *buf, size_t count);
This function reads a specified number of bytes from the referenced file
and returns the number of bytes read.
fd: File descriptor returned by the
buf: A pointer to the buffer into which to read the data.
count: Number of bytes to be moved to the target buffer.
ssize_t write(int fd, const char *buf, size_t count);
This function writes a specified number of bytes to the referenced file and
returns the number of bytes written.
fd: File descriptor returned by the
buf: A pointer to the buffer from which to write the data to the memory.
count: Number of bytes to be written.
Application Examples • 183
function.
open
function.
open

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

750-860

Table of Contents