Generic NOV-RAM
Non-Volatile Random Access Memory (generally abbreviated as NOVRAM, NV-RAM or NOV-RAM) is a special type of memory component which, due to its principle, may be written to cyclically, but in which the final data content is saved in the internal ROM area in the event of an external power failure. A capacitor integrated in the NOVRAM supplies the energy required to copy the contents of the RAM area, which is also integrated in the NOVRAM, to the ROM area in the event of a failure of the externally applied voltage. The application (in this case TwinCAT) only writes cyclically into the RAM area of the IC.
To use the optional NOV-RAM extension of the Beckhoff fieldbus cards (e.g. FC3101-0002 / FC3102-0002, FC3151-0002,FC5101-0002 / FC5102-0002, FC5151-0002, FC5201-0002 / FC5202-0002, FC5251-0002, FC7551-0002) under TwinCAT, an additional I/O device, to be found in the I/O Devices | Miscellaneous area, must be included as "General DP/NOV-RAM".
In the CX1100-000x power supply modules from the Beckhoff CX10xx series, the NOVRAM block, which is always present and in this case has a size of 8 kByte, is automatically detected during reading.
With the CX900x the ever-present NOVRAM block, which is a 128-kByte block in this case, is automatically recognized when reading.
Furthermore, the procedure described below also supports the Mini PCI NOVRAM modules with the order numbers C9900-R230,C9900-R231 and C9900-R232.
Only for TwinCAT 2.8 Writing data to attached and linked output variables via PLC I/O refresh, without using the PLC function blocks, would result in the respective data areas in NOVRAM being written to NULL when the system stops. See also: Configuration example for TwinCAT 2.8 |
Configuration example (TwinCAT 2.9):
Configuration example (TwinCAT 2.9)
Especially for the confiuration of CX1000 controllers it is important, that some variables survive a reboot. Usually no UPS is used along with this kind of devices. New to TwinCAT 2.9 is, that no PLC function blocks are necessary for read and write, and therefore synchronization, of dedicated remanent PLC variables anymore. (Hint: The term "persistent" is not used in this context for a reason!). The below described feature can also be used for the FCxxxx-0002 Fieldbus cards, of course.
The following dialog describes the necessary settings for the I/O driver to establish synchronized (remanent) PLC outputs, which survive a reboot.
Address: The address as well as the size of the NOVRAM which is to be set here, is usually found automatically after a "Scan for devices".
Auto Init linked PLC Outputs: This Checkbox must be activated for the implementation of remanent, means, with reboot synchronized variables.
The next step is to define output variables - with the right size and optionally right address offset - underneath 'Outputs' in the tree view (in the above picture these are e.g. the array variables 'Save Data1' and 'Save Data2'). If these outputs are going to be linked to PLC outputs (e.g. declared with AT %Q* ), they will overwrite the initial values of these PLC variables after reboot/start of PLC boot project, automatically. Means, the PLC program will continue with the last stored NOVRAM values in this case.
A special declaration of those PLC variables is not necessary (besides the fact that they need to be declared as located output variables, of course). Especially, a declaration as VAR xxx PERSISTENT or VAR xxx RETAIN, is not allowed in the above context.
Export Data to Disk: Writes the actual content of the NOVRAM to a XML based file on disk. Blocks of 1k (1024 Byte) size are separated within dedicated identifiers inside the XML file. That gives a better overview during reading/manipulating afterwards.
Import Data from Disk: Formerly created NOVRAM XML files (XML files about complete NOVRAM size or even partial) can be read back into NOVRAM. E.g., this can be used to preset the NOVRAM with a "manufacturer data set" at a dedicated address offset prior to machine shipping. Just explore an exported NOVRAM XML file, and it will self-describe its meaning!
Configuration example for TwinCAT 2.8:
In difference to the configuration of an ordinary DP-RAM card with TwinCAT, the data which has to be transferred to the NOV-RAM is not supposed to be linked to I/O variables underneath the "Inputs" or "Outputs" area of the device. Instead, an ADS command (e.g. from PLC) is used for direct writing of this persistent data to the NOV-RAM IC on the Fieldbus card. This means, the configured device has usually no variables underneath the "Inputs" and "Outputs" section in this case. Due to the technical habit of the NOV-RAM component, even cyclical data saving can be implemented.
The following picture shows an example of how to set up a Fieldbus card with NOV-RAM extension. However, the PCI address and other necessary device info is not configured properly in this example.
For the address and data length information to be entered here, please use the displayed data of the already configured fieldbus card (in the sample above "Device 1 (FC5201-0002)" or use the following button:
- Search..: With this button, the scan for PCI address corresponding to the Vendor ID, Device ID and Base Address of this card is started.
For additional details see the description of the various Beckhoff Fieldbus cards.
Access to the NOV-RAM via TwinCAT PLC Function Block:
With the help of the Function Block "FB_NovRamReadWrite", which is installed by default with the "TcIOFunctions.lib" library from TwinCAT v2.8 > Build 722, the NOVRAM IC can be read or written directly. Important is the device ID (in this sample it is ID 2, see picture below) of the NOVRAM device inside the TwinCAT System Manager, which can also be read by name (see: IOF_GetDeviceIDByName). For details, see the documentation of the PLC library.