550 597 06

 

Standard variables outside channels

Overview

A PD 600 DPI series device has the variables outside channels shown in the following table.

 

Variable name

Variable description

SafetyLevel

Defines functionality for HiddenVars and ProtectedVars

HiddenVar 1 - 7

Variables that can be hidden

ProtectedVar 1 - 8

Variables that can be protected

EraseCount

Shows how many times FLASH has been erased

MinErasedBytes

Minimum number of erased bytes in FLASH

SealCount

Number of times WriteEnable has been set

InterfaceErrorBuffer

Stores information related to P-NET communication errors

ActualPowerdownTime

Stores information about how long power was lost

NodeList

Used for access of not declared variables

MaxPowerdownTime

Used to define “resume after power failure” time

CountryCode

Used to define decimal point separator

InputString

Used to store input from keyboard

InputStringChar

Character shown when a variable is being updated

BatteryState

State of built-in battery

UserFLASH 1 - 64

Up to 2 Mbytes of FLASH memory for user variables

GUID

A unique identifier for this device

 

 

SafetyLevel

 

     SafetyLevel: Bit8;

 

SafetyLevel defines the functionality of the built-in safety system. The purpose of the safety system is to protect certain variables either from being read via P-NET or from being changed via P-NET.

 

By default, this variable is not visible in the VIGO MIB view window.

 

SafetyLevel[0]: If True, HiddenVar1..7 can only be accessed from Process-Pascal. ProtectedVar1..8 and SafetyLevel can be read from P-NET as well as Process-Pascal, but can only be written to from Process-Pascal. If False, HiddenVar1..7 as well as ProtectedVar1..8 and SafetyLevel act as normal variables. If protection is required, SafetyLevel[0] should always be set True.

SafetyLevel[1]: If True, debugging of the Process-Pascal program is not possible. If debugging was already in progress when SafetyLevel[1] is set to True, the DPI must be reset before debugging is prevented.

SafetyLevel[2]: If True, neither Process-Pascal nor Operating System can be downloaded, regardless of WriteEnable. In this way, changing the program can be prevented.

SafetyLevel[3]: If True, it is not possible to set WriteEnable via P-NET. In this way, any configuration change of the DPI is prevented.

 

If a DPI is put into safe mode (SafetyLevel[0] is set True), functionality in the Process-Pascal application is needed to change the setting of the SafetyLevel variable, if for example the configuration of the DPI must be changed.

 

SafetyLevel is stored in RAM, and cleared after MasterReset.

 

HiddenVar 1 - 7

Any variable placed at one of these 7 Softwire numbers can be hidden, as described under SafetyLevel. The variables can be Process-Pascal constants, or normal variables. They cannot be FLASH variables.

Please find out more about additional restrictions on their use, in the section
Restrictions for User FLASH, HiddenVar and ProtectedVar variables.

 

By default, these variables are not visible in the VIGO MIB view window.

 

ProtectedVar 1 - 8

Any variable placed at one of these 7 Softwire numbers can be protected, as described under SafetyLevel. The variables can be Process-Pascal constants, or normal variables. They cannot be FLASH variables.

Please find out more about additional restrictions on their use, in the section
Restrictions for User FLASH, HiddenVar and ProtectedVar variables.

 

By default, these variables are not visible in the VIGO MIB view window.

 

EraseCount

EraseCount is a read-only variable holding information on how many times each FLASH sector for Process-Pascal variables has been erased. The variable is an array of the following type:

 

     EraseCount: ARRAY[1..40] of LongInteger;

 

The variable is stored in EEPROM and is not cleared by MasterReset.

 

MinErasedBytes

This variable holds information on how many bytes the operating system shall attempt to keep erased in FLASH. Refer to UserFLASH for further information.

 

SealCount

SealCount is a read only variable, holding information on how many times WriteEnable has been set True. This can be useful in approved systems, where the approving authorities can check, whether WriteEnable has been True since the last control.

 

The variable is stored in EEPROM and is not cleared by MasterReset.

 

InterfaceErrorBuffer

The InterfaceErrorBuffer is a buffer where the element type is a record having the following structure:

 

     InterfaceErrorRecord: Record

          SWNo : Word;

          VARAddr: LongInteger;

          VAROffset: LongInteger;

          ErrorCode: Word;

     End;

 

     InterfaceErrorBuffer: Buffer[10] of InterfaceErrorRecord;

 

The buffer can hold a number of records with information on recently detected P‑NET errors. An element is transferred to the InterfaceErrorBuffer by the operating system, when a P‑NET error occurs. By means of the statement Enable(Error) in Process-Pascal, the user defines what type of P-NET errors will result in a transfer of an element to the Interface­ErrorBuffer. Refer to the Process-Pascal manual for further information on the Enable(Error statement.

Since the variable InterfaceErrorBuffer is of type buffer, a complete element must be read, and it is not pos­sible to just read a single field in a buffer ele­ment. A new variable of the same type as an element in the buffer should be declared. When an error occurs, the entire element can be transferred from the Interface­ErrorBuffer to the variable of type InterfaceErrorRecord. Now the fields of the variable can be accessed separately.

NOTE: When activating the automatic error detecting system and a report element is stored in the buffer, a relevant program must be written to read this report element from the InterfaceErrorBuffer, to prevent the buffer from running full.

It is possible to connect a SoftwireInterruptTask to the InterfaceErrorBuffer. The corresponding SoftwireInterruptTask task will then be automatically activated each time an element is transferred to the buffer by the operating system.

 

The InterfaceErrorRecord is defined to include the following fields:

SWNo holds the Softwire number of the variable that caused the error. That is, the index to the Softwire table inside this DPI.

The standard function VARNAME(SOFTWIRENo) returns the string constant after NAME for the module variable, if it is declared. Refer to chapter VARIABLE DECLARATION in the Process-Pascal manual.

VARAddr holds the logical address of the vari­able within the interface module. For simple interface modules (I/O modules), the contents of VARAddr is a number, which com­bines the channel number and the register number of the variable. If the mod­ule is a con­troller or a DPI, VARAddr holds the Softwire number of the variable in the controller/DPI that caused the error.

VAROffset holds an offset for the variable (in the interface module) that caused the error. The field variable VAROffset can be used to locate a field within a complex variable.

ErrorCode holds the error code relating to the interface error. The content of the ErrorCode reflects the control/status field from the P-NET frame. The ErrorCode field is de­clared as a word, where each bit has the following meaning:

 

15

 

 

 

 

 

 

 

7

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0: TransmissionError

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1: HisError

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2: ActError

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3: BufferError

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4: 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5: 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6: 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7: 0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8: Control/Status according to the P-NET Standard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

9: Control/Status according to the P-NET Standard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

10 :Control/Status according to the P-NET Standard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

11: Control/Status according to the P-NET Standard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

12: Control/Status according to the P-NET Standard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

13: Control/Status according to the P-NET Standard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

14: Control/Status according to the P-NET Standard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

15: Control/Status according to the P-NET Standard

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ActualPowerdownTime

 

     ActualPowerdownTime: LongInteger;

 

This variable indicates for how long the DPI was down prior to the last reset. The value is in seconds.

A SoftwireInterrupt on ExternalStore may be declared on this variable. If this is done, the related task will be activated after each reset.

 

NodeList

Nodelist is defined as an array of records, where the record is defined as follows:

 

     NodelistElement: Record

          Code: Byte;

          StdChannel: Boolean;

          DeviceType: Integer;

          NodeAddr: String[10];

     End;

 

And the complete array is defined as:

 

     Nodelist: Array[1..10] of NodelistElement;

 

Nodelist is used for accessing variables not directly declared in Process-Pascal. This is performed by means of the PointerToNode statement. How this is accomplished is described in the Process-Pascal manual.

Accessing variables through Nodelist is only possible from within the Process-Pascal program in this DPI (there are no gateway functions related to the Nodelist).

The number of elements in Nodelist, and the length of the NodeAddr (max 25), is defined individually in the Process-Pascal program.

The Code field indicates the capabilities for the node to access, and is defined in the following way:

7

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0:

0: Offset legal,

1: Offset illegal

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1:

0: Bit addressing legal,

1: Bit addressing illegal

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2:

0: IEEE Real format,

1: OldReal

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3:

0: 2 byte addressing,

1: 4 byte addressing

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4:

0: Softwire addressing,

1: Physical addressing

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5:

0: Simple NodeAddr,

1: Extended/Complex NodeAddr

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7:

0: Use offset in Long,

1: No offset in Long

 

 

 

 

 

 

 

 

 

 

MaxPowerdownTime

 

     MaxPowerdownTime: LongInteger;

 

This variable is used to configure the DPI to continue in Process-Pascal where it stopped due to a power failure. The value is in seconds. The variable is stored in EEPROM.

 

If the value of ActualPowerdownTime is lower than the value of MaxPowerdownTime after a reset caused by power failure, it means power was off for a shorter time than defined in MaxPowerdownTime, and the DPI will continue in Process-Pascal where it was interrupted due to power failure. This facility is called Resume after power failure.

 

Setting the value of MaxPowerdownTime higher than 0 enables resume after power failure. If Resume after power failure is enabled, the DPI waits after reset until the power supply voltage exceeds approx. 18 V. If this does not happen within 1 second, error “Power supply voltage too low” is generated.

The DPI will start saving the processor state when the power supply voltage drops below approx. 18 V if Resume after power failure is enabled. When the processor state is saved, the DPI automatically generates a reset, where it waits for the power supply voltage to exceed 18 V again.

 

CountryCode

 

     CountryCode: Integer;

 

This variable is used to select the decimal separator when converting variables to strings.

 

0 corresponds to comma (,), 1 corresponds to point (.).

 

InputString

 

     InputString: String[10];

 

When connected to a display/keyboard device (for example PD 680), this variable holds the characters keyed in. If a variable on the display is selected for update, the InputString is shown instead of the value of the variable. The unused characters show the InputStringChar character. When “=” is pressed, the InputString is converted from string to the type of the selected variable, and the result is written to the variable.

 

InputStringChar

 

     InputStringChar: Byte;

 

Refer to InputString.

 

 

BatteryState

 

     BatteryState: Record

          BatteryLow: Boolean;

          NoBattery: Boolean;

     End;

 

Every 4 minutes, and following a reset, the voltage of the built-in battery is checked. From OS 2.05 and upwards, this action is always carried out, regardless of whether or not the provided battery check is enabled in Service.DeviceConfig. In previous OS versions, battery check must be enabled to obtain this same functionality. If the voltage is below 2 V, BatteryLow is set True. When this occurs for the first time, it indicates that the battery will remain operational for about another month, and therefore should be exchanged at the earliest opportunity. If the battery voltage is higher than 2 V, BatteryLow is set False.

 

The “battery low” error in Service.CommonError  (historical error only) is only set if the provided battery check is enabled in Service.DeviceConfig. This applies to all versions of the operating system.

 

Following a power-up, the state of the built-in Real Time Clock is checked. If the battery voltage has been too low during the period of no power, the Real Time Clock reports it, and the following occurs: If battery check is enabled in Service.DeviceConfig, a master reset due to the battery low error is generated in Service.CommonError, and NoBattery is set True. If battery check is disabled, a “normal” power-up reset historical error is generated, and NoBattery is set False. This applies to all versions of the operating system.

 

UserFLASH 1 - 64

The Pd60XFlash.INC file for a PD 600 series DPI holds 64 declarations of variables located in FLASH. These declarations may be changed by the user, but shall keep the same softwire numbers.

 

The FLASH memory is organized into 2 Kbyte blocks. This means that any variable stored in FLASH will occupy at least 2 Kbytes.

 

The physical FLASH memory is organized into sectors of 64 Kbytes each. Only a complete sector can be erased. It is not possible to write data to a sector that has not been erased. This is automatically handled by the operating system, by means of an allocation table and a de-fragment system. However, for this to work, at least 128 Kbytes of FLASH must be reserved for de-fragmentation. When storing a variable in FLASH, all memory needed for the variable must be erased. This is also handled automatically by the operating system, which ensures, that the number of bytes defined in the variable MinErasedBytes is always erased. It is recommended to set the value of this variable to the size of the largest variable located in FLASH. Setting the value of MinErasedBytes very high, will result in many erase operations, which will decrease the lifetime of the FLASH memory.

 

There are up to 2 Mbytes available for FLASH data.

 


Restrictions for User FLASH, HiddenVar and ProtectedVar variables

When using User FLASH, HiddenVar and ProtectedVar for storing Process-Pascal variables, there are some restrictions and limitations compared with using variables located in RAM. What is common for the three types is that they possess some special ‘get’ and ‘set’ functions. In the following paragraphs, they will be referred to as Get/Set variables, in order to make the text more readable.

 

It is not possible to copy a Process-Pascal variable located in a Get/Set variable to another variable located in a Get/Set variable. If this is required, a temporary variable in RAM must be used. Copy the source Get/Set variable to the RAM variable, and then copy the RAM variable to the destination Get/Set variable. This restriction only applies to variables of complex type.

 

It is not possible to perform “String compare” on a variable located in a Get/Set variable. If this is required, a temporary variable in RAM must be used. Load the Get/Set variable into the RAM variable, and perform string compare on the RAM variable.

 

It is not possible to perform any string manipulation on a Get/Set variable. If this is required, a temporary variable in RAM must be used. Load the Get/Set variable into the RAM variable, perform the required string manipulation on the RAM variable, and store back the RAM variable into the Get/Set variable.

 

It is not possible to copy a Process-Pascal variable located in a Get/Set variable to an external variable (a variable in another P-NET device), or vice versa. If this is required, a temporary variable in RAM must be used. Copy the source Get/Set variable to the RAM variable, and then copy the RAM variable to the external variable, or vice versa. This restriction only applies to variables of complex type.

 

A complex variable (a Record or an Array) stored in a Get/Set variable, cannot be moved directly to a Buffer. If this is required, a temporary variable in RAM must be used. Copy the source Get/Set variable to the RAM variable, and then copy the RAM variable to the Buffer, or vice versa.

 

Get/Set variables cannot be used for variables of type Buffer.

 


GUID

This variable holds a string, which uniquely identifies this device. By default, this variable is not visible in the VIGO MIB view window.

 

 

Related topics

Process-Pascal Manual

DPI State diagram