P-NET Channel Structure

One of the most important aspects of the P-NET fieldbus, is its integrated use of Channels. A Channel is a set of data associated with a particular entity, such as an input or an output, which has been structured in a defined and logical way. This means that all master devices connected to P-NET can access part or all of a channel’s contained values, without the need to have knowledge of the internal mechanism of the P-NET device itself.

The principle could be thought of as a translation of the device’s internal memory addresses into a universal set of external access addresses, understood by the P-NET protocol. Take for example, a device that has been designed to measure an analogue input.

The manufacturer of such a device using a particular micro-controller may find that the memory location of data providing the measurement result would be in a different internal location compared with a similar device using a different micro-controller. Furthermore, if the device were designed to deal with more than one analogue input, the measurement value of each would be found at a variety of random addresses. This would also be further complicated by the fact that any associated data e.g. an enable/disable control for a particular input, may not be located in any logical sequence, and may even use a different memory type.

One advantage of having channels, is that if each set of data associated with say a number of digital outputs is the same, then the definition of such a structure can be held within an application program only once, and it is then only a matter of addressing a channel number, rather than having to know a lot of random addresses.

Another advantage is that having a defined collection of data all associated with the single measurement or process, such as its scaling, counting of change of state, its configuration and detected errors, means that the channel can then be regarded as a single entity or Object.

Data within channels is held within sequentially numbered registers. Each register may hold data of different types. For instance, an analogue measurement would require to be represented as a floating point number (Real) and therefore require 4 bytes of random access memory (RAM), whereas a register dealing with channel configuration may consist of a Record of data consisting of many bytes of Write protected EEPROM memory.

Channels are structured to consist of 16 addressable registers numbered from 0 to 15. A register may hold simple data types (Real, integer, byte, etc.), or data structured as an array or record.

Addressing

Each device or module connected to P-NET has a user configured address number known as its Node Address (NA).
Each node also has a user-defined name associated with it. Furthermore, each different type of node also has a type name and a definition of how the node is structured in terms of the number and type of channels it holds, and how the channels are structured.
Each channel within a node is given a pre-defined name and number, and so is each register within each channel.
The names associated with the node, its channels and registers are called Identifiers.

Therefore, the way data is accessed at the P-NET level is numerically, firstly by means of a Node Address, and then with the Channel No. + Register No., which is called the Softwire Number (SWNo.) At the user or programming level, access can be made by using a string of names, of the form: Project_Name:Node_name.Channel_name.Register_name.[Field name], which is called the Physical Identifier (PhysID)

Data Types

When data is stored within electronic memory, it is structured using a string of ones and zeros. These groups of bits (Binary digITS) can be interpreted in many different ways. For example, a group of 32 bits (4 bytes) could be interpreted as a floating-point number (Real), a signed whole number (long integer), a word made up of 4 alpha-numeric characters (String), or just 32 individual on/off states (Array of Boolean).

It is therefore important that the mechanism that writes the data in a particular memory location and the mechanism that reads the data from that location, both know what the data is intended to represent. It would of course be hopeless if the writing mechanism intended the data to be a floating-point number and the reading mechanism thought it was a whole number!

Therefore, when defining how a P-NET channel is structured, it is essential that the Data Type of each of the channel registers is also provided, so that both writing and reading parties interpret the data in the same way.

Memory Types

Memory basically comes in two forms. These are volatile memory, which will lose its contents if power is lost, and non-volatile memory, which will hold its contents even if power is removed. There are also a number of technologies used to form memory, such as common random access memory (RAM), Programmable Read Only Memory (PROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash memory, etc.

There are also a number of ways of controlling when and how data can be written to memory, which may depend on the value of a control variable following a reset or a power failure and/or the state of any write protection. This leads to a number of memory type definitions, which must also be declared when defining a Channel.

This is just as important to a user as knowing the data type, where it needs to be known whether certain data will be saved during a power failure or reset, or whether a write enable bit needs to be raised to change current data. The various memory type definitions are shown below.

Read Only

PROM ReadOnly:
The PROM is always write protected and can never be changed.
This kind of memory is used to store data such as device identities, serial numbers etc.

RAM ReadOnly:
The variable is stored in RAM and is only accessible for Reading.
This kind of memory is used to store data associated with timers and errors. The data is lost if power is removed or a reset applied.

Read Protected Write

EEPROM RPW FLASH RPW (Read, Protected Write)
Variables with memory type EEPROM RPW are located in EEPROM. Variables with memory type FLASH RPW are located in data FLASH.

The variable is always write protected directly following a reset. By setting WriteEnable to TRUE, the contents of the variable can be changed. The contents of the variable will remain unchanged after a normal reset or Master reset (DPI), and during and after a power failure. This memory type is used to hold configuration data, which is occasionally needed to be changed, but must not be lost during a power failure.

RAM RPW (Read, Protected Write)
The variable is always write protected following a reset. By setting an input simulation boolean to TRUE, the contents of the RAM can be changed.

Read Write

RAMBB ReadWrite (RAM with batteryback-up)
The variable can be changed instantly. The contents of the variable will remain unchanged after a normal Reset (including power failure), but will be initialized to a default value (typically zero), after a Master Reset.
This type of memory is used in DPIs for normal Process Pascal program variables and those associated with time and date.

RAM ReadWrite
The variable can be changed instantly. After a reset or a power failure, its value is set to zero. This memory type is typically used for measurement registers and counters in slave I/O modules, where the value can be set via P-NET.

FLASH ReadWrite
The variable can be changed instantly. The contents of the variable will remain unchanged after a normal reset or Master reset (DPI), and during and after a power failure. This memory type is used to hold configuration data, which is occasionally needed to be changed, but must not be lost during a power failure.

Read Write, Protected BackUp Write

RAM InitEEPROM
The variable is stored in both RAM and EEPROM. After a reset, the variable is copied from EEPROM into RAM. When the variable is changed via P-NET, the value is changed in RAM. If WriteEnable is TRUE, the value is changed in both RAM and EEPROM when the variable is changed via P-NET.
This memory type is useful for holding adjustable set point (I/O module), or communication channel parameter data (DPI), sent via P-NET, where it may be important not to loose the latest, or at least a default setting during a power failure.

RAM AutoSave – I/O modules only
This has the same function as RAM InitEEPROM, with the addition that the contents of RAM are automatically copied to EEPROM, at a frequency of approximately 10 hours. This type is useful where the power up or reset ‘default data’ is constantly changing, such as with some kind of counter or timer.

Reset

Performing a reset is an activity that ensures that a PD 600 series device reverts to a known and initial state. Such an action will be performed automatically when power is restored following a power failure, or manually using a number of methods. The effect on previously held data depends on what kind of memory is being utilised. See Memory types

Performing a normal reset
In all module types, a normal reset is performed either by switching the power off and back on again, or by writing 255 ($FF) to Register No. 3 in the service channel via P-NET. With a DPI module, a normal reset can also be achieved by pressing the reset button for a short period. Refer to the description of the individual memory types for a definition of what happens to memory contents as a result of a normal reset.

If a normal reset is caused by a power failure, a DPI can be configured to continue program execution from where it was interrupted by the power failure, when power is switched back on again. This facility is used to ensure that, for example, storing of a large variable is completed after a power failure. Refer to section Standard variables outside channels, MaxPowerdownTime, to see how this facility is enabled and used, and under what conditions the system works.

Master Reset

Performing a master reset
A master reset only applies to DPIs. A master reset can be performed in 2 different ways:

Either the DPI battery is removed and the power to the device switched off, or the reset button is pressed and held in for approx. 10 seconds. Refer to the description of the individual memory types for a definition of what happens to memory contents as a result of a master reset.

EEPROM variables

Process-Pascal variables stored in EEPROM memory are preserved after a normal reset, as well as after a master reset.

FLASH data memory

Process-Pascal variables stored in FLASH data memory are preserved after a normal reset, as well as after a master reset.

The Service Channel

One of the rules governing the use and structure of channels is that any device connected to P-NET should have a Service Channel. This channel is always the first within a group of channels. The address of the channel is always zero.

The Service channel ensures that every device always uses the same Softwire Numbers (SWNos.) for certain data common to all devices. For example, the Device Type will always be found at SWNo $01, i.e. Channel 0, register 1. Any errors within a module will be registered in SWNo. $0F, i.e. the 16th (last) register in Channel 0.

Some registers within a device’s Service Channel may not be used, whereas some registers may provide a service not found in other devices. This is why, within the specification of a device, the service channel is always described along with other contained channels (see separate specifications).

Channel Definitions

A definition of the Softwire Nos., Identifiers, Memory Types, Data Formats and Data Types of all channels contained within devices included within this manual, is provided later in this document, in the form of tables and descriptions. Such a definition is also held within VIGO in the Memory Information Base (MIB).

The latter is used to provide information to application programs written to communicate with devices connected to P-NET.