P-NET Channels

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. A more detailed description of the data types used in these modules can be found in the Process-Pascal Manual.

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.

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.