550 601 04

 

 

Service channel (ch. 0).  All DPIs

All PD 600 DPI series devices have a service channel containing variables and functions common to the entire device.

 

RegNo.

Identifier

Memory type

Read out

Type

0

NumberOfSWNo

PROM ReadOnly

Decimal

Integer

1

DeviceID

PROM ReadOnly

--------

Record

2

 

 

 

 

3

Reset

Special function

--------

Byte

4

PNETSerialNo

Special function

--------

Record

5

RealDateTime

RAMBB ReadWrite

--------

Record

6

TimeDate

RAMBB ReadWrite

--------

Record

7

FreeRunTimer

RAM ReadOnly

Decimal

LongInteger

8

 

 

 

 

9

DeviceConfig

EEPROM RPW

--------

Record

10

 

 

 

 

11

 

 

 

 

12

NetParam

EEPROM RPW

--------

Record

13

WriteEnable

RAM ReadWrite

Binary

Boolean

14

ChType

PROM ReadOnly

--------

Record

15

CommonError

RAM ReadWrite

--------

Record

 

 

RegNo. 0: NumberOfSWNo

 

 

NumberOfSWNo:

Integer;

 

 

This variable holds the highest SWNo in the device.

 

 

RegNo. 1: DeviceID

This variable is a record having the following structure:

 

Record

 

DeviceNumber:

Word;

 

 

ProgramVersion:

Word;

 

 

ManufacturerNo:

Word;

 

 

Manufacturer:

String[20];

 

End;

 

This record identifies the device. The record includes a registered manufacturer number, the type number of the device, and a string identifying the manufacturer.

An example of the field values in the DeviceID record is shown below:

 

 

DeviceNumber = 601

 

ProgramVersion = 110

 

ManufacturerNo = 1

 

Manufacturer = PROCES-DATA DK

 

 

RegNo. 3: Reset

 

 

Reset:

Byte

 

 

By writing 255 ($FF) to Reset, the device performs a Reset, and ExternalReset in CommonError.ChError.His is set True.

 

 

RegNo. 4: PNETSerialNo

This variable is a record having the following structure:

 

Record

 

PNETNo:

Byte;

(* Node address *)

 

NoOfMasters:

Byte;

 

 

SerialNo:

String[20];

 

 

 

 

 

End;

 

The serial number is used for service purposes and acts as a 'key' for setting the P-NET Node Ad­dress and number of masters for the port used to access this variable. For example, if this variable is accessed from port 1, the P-NET Node Address and number of masters for port 1 are accessed.

A special function is included for identifying a device connected to a network containing many other devices, having the same or unknown node addresses, and to enable a change of the node address and number of masters via the P-NET.

Setting a new node address and number of masters via P-NET, is performed by writing the required node address, together with the serial number of the device in question, into the PNETSe­rialNo at node address $7E (calling all devices). All devices on the P-NET will receive the message, but only the device with the transmitted serial number will store the P-NET node address and the number of masters.

An attempt to write data to node address $7E will give no reply. Consequently the calling master must disable the generation of a tran­smi­ssion error when addressing this node.

In the device, the SerialNo = "XXXXXXXXPD", is set by PROCES-DATA, and cannot be changed. The eight “X”es indicate the serial number, and PD is the initials of PROCES-DATA.

 

Accessing this variable from port 1 gives access to PNETNo and NoOfMasters for port 1. Accessing this variable from port 2 gives access to PNETNo and NoOfMasters for port 2. Accessing this variable from Process-Pascal gives access to PNETNo and NoOfMasters for port 1.

 

 

RegNo. 5: RealDateTime

This variable is a record having the following structure:

 

Record

 

Local:

RealDate;

 

 

UTC:

RealDate;

 

 

TimezoneBias:

Integer;

 

 

DaylightBias:

Integer;

 

End;

 

This variable holds the date and time in the OleDateTime format as used by PC applications. The variable holds 2 fields of type LongReal, indicating the number of days since 30 December 1899, midnight. Days are represented by whole number increments starting with 30 December 1899, midnight as time zero. Hour values are expressed as the absolute value of the fractional part of the number. This is illustrated in the following table.

 

Date and time

Representation

30 December 1899, 00.00

0.00

1 January 1900, 00.00

2.00

4 January 1900, 00.00

5.00

4 January 1900, 06.00

5.25

4 January 1900, 12.00

5.50

4 January 1900, 21.00

5.875

4 January 1900, 21.30

5.89583333

 

So, the RealDateTime fields represent date and time as a classic number line.

 

Local

The Local field represents the local date and time, adjusted for daylight saving and time zone, which are found in 2 fields of the RealDateTime record.

 

UTC

The UTC field represents UTC date and time.

 

TimezoneBias

TimezoneBias holds the difference in minutes between UTC time and local time. To calculate local time, the DPI subtracts the values TimezoneBias and DaylightBias from UTC. If the time zone is for example GMT+1, the value of TimezoneBias shall be set to –60.

 

DaylightBias

DaylightBias holds the difference in minutes between UTC time and local time. During daylight saving periods the value of DaylightBias shall be set to –60. During normal time periods the value shall be set to 0.

 

Unlike other records, the fields of the RealDateTime record are located in different kinds of memory. The Local and UTC fields are placed in RAM, and the TimezoneBias and DaylightBias fields are placed in EEPROM. For this reason, and because setting of one field may influence the other fields, it is only possible to access one field of the RealDateTime record at a time.

 

RegNo. 6: TimeDate

This variable is a record having the following structure:

 

Record

 

Second:

Byte;

(* 0 - 59 *)

 

Minute:

Byte;

(* 0 - 59 *)

 

Hour:

Byte;

(* 0 - 23 *)

 

Day:

Byte;

(* 0 - 6, Sunday = 0 *)

 

Date:

Byte;

(* 1- 28/29/30/31 *)

 

Month:

Byte;

(* 1 - 12, January = 1 *)

 

Year:

Byte;

(* 0 - 99, modulus 100 of the year *)

End;

 

This variable represents the Local time and date in individual fields for Second, Minute and so on. The "Day" field cannot be modified by the user, but will automatically show day of week.

 

 

RegNo. 7: FreeRunTimer

 

 

FreeRunTimer:

LongInteger;

 

 

This variable is a counter to which internal events are synchronised.

 

The timer runs when the device is running, remains unchanged during power failure, and continues after a reset.

 

The timer is incremented at a frequency of 256 Hz (1/256 secs.). It counts from zero after a MasterReset, to FFFFFFFF (hex) and then continues from zero again. This gives a time span of approx. 194 days.

 

The counter is synchronized with the built-in real time clock system.

 

 

RegNo. 9: DeviceConfig

This variable is a record having the following structure:

 

DeviceConfig: Record

            (* Factory setting *)

 

EnableBit:

Bit8;

(* 00000000 *)

 

Functions:

Byte;

(* 0 *)

 

Notification:

Byte;

(* 0 *)

 

User:

Byte;

(* 0 *)

End;

 

 

 

Enablebit

Enablebit[0] indicates whether variables in FLASH memory are protected by WriteEnable or not. Enablebit[0] = True indicates that WriteEnable must be set True to change variables in FLASH. Enablebit[0] = False (default) indicates that variables in FLASH can be changed without setting WriteEnable True.

 

EnableBit[1] is used to disable battery check. EnableBit[1] = False (default) indicates, that battery check is enabled. EnableBit[1] = True means “battery check disabled”. Refer to BatteryState for further details.

 

EnableBit[2] = True enables the RAM preserve facility, introduced in version 2.10.

By default, the facility is disabled.

When enabled, the DPI will require a power supply voltage at approx. 18 V or higher to start.

During power down, when the voltage reaches 18 V, the checksum value of all RAM in use is calculated, after which the DPI generates a reset and waits for the supply voltage to exceed 18 V again.

During power up, the RealTimeClock circuitry is checked to ascertain whether the battery voltage has been too low during power failure. If so, the RAM contents will normally be cleared (MasterReset). However, when the RAM preserve facility is enabled, the checksum value is calculated, and compared to the one calculated during power down. If equal, the RAM contents is preserved, time is set to the value prior to the power failure, and the ResetCode “7” is generated.

This functionality is relevant because the RAM can preserve its contents at a lower voltage than required for the RealTimeClock circuitry to operate. The downside of this is that the power supply voltage must be approx. 18 V or higher.

Also note that if the power failure is a result of removing the DPI from the base module, or removing the wires between power supply and cluster, there may not be enough time to calculate the checksum value.

The new RAM preserve system requires version 2.10 or higher of both BOOT and FLASH OS. If EnableBit[2] is set True in FLASH OS 2.10 or higher, and BOOT OS version is lower, the error “BOOT OS too old” will be generated.

 

EnableBit[3..7], Functions, Notification and User are not used.

 

 

RegNo. 12: NetParam

This variable is a record having the following structure:

 

Record

 

Baudrate:

LongInteger;

 

 

ErrorCheck:

Boolean;

 

 

NoOfMasters:

Byte;

 

End;

 

This variable holds the net parameters Baudrate, ErrorCheck and NoOfMasters for the port used to access the variable. For example, if the variable is accessed from port 1, the net parameters for port 1 are accessed. The variable can’t be accessed from Process-Pascal.

 

The variable is stored in memory type EEPROM RPW, meaning it can only be changed if WriteEnable is True.

 

Baudrate

Baudrate holds the bit rate for the port from which the variable is accessed. Which values are legal depends on the type of the port.

 

ErrorCheck

ErrorCheck holds the errorcheck method used for the port from which the variable is accessed. False means “Default (1 byte) errorcheck”, and True means “Extended (2 byte) errorcheck”.

 

NoOfMasters

NoOfMasters holds the number of masters for the port from which the variable is accessed.

 

 

RegNo. 13: WriteEnable

 

 

WriteEnable:

Boolean;

 

 

Write protected variables can only be changed when the value of WriteEnable is True. After Reset, the value of WriteEnable is False.

 

NB: Typically, write protected variables are stored in EEPROM or FLASH. Writing to EEPROM is limited to 106 cycles for each variable. Writing to FLASH is limited to 105 cycles for each variable.

 

The DPI is equipped with a hall sensor, which is able to detect, whether a magnet is placed near the device. If the hall sensor detects a magnet, WriteEnable cannot be set True. This can be used to seal the device, thus preventing any download, debugging or configuration change.

 

Each time the value of WriteEnable is set True, the value of SealCount is incremented by 1. This makes it possible to detect, whether WriteEnable has been set True, and thus whether the configuration of the DPI has possibly been changed.

 

 

RegNo. 14: ChType

This variable is a record having the following structure:

 

Record

 

ChannelType:

WORD;

 

 

Exist:

Bit16;

 

 

Functions:

Bit16;

 

End;

 

Each channel in the device is described by an individual ChType variable. The ChType variable is a record, holding a unique number for the channel type, and a True Boolean value for each of the registers that are represented within the channel. The register number in a channel corresponds to the index number in the Boolean array. In addition to these fields various other fields can be found in the record, depending on the channel type. For the service channel, the record has the structure shown above, having the following field values:

 

ChannelType = 1

 

Exist =

15

 

 

 

 

 

 

 

7

 

 

 

 

 

 

0

1

1

1

O

0

0

1

0

1

1

1

1

1

0

1

1

 

Functions =

15

 

 

 

 

 

 

 

7

 

 

 

 

 

 

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

 

 

RegNo. 15: CommonError

This variable is a record having the following structure:

 

Record

 

ChError: Record

 

 

 

 

His:

Bit8;

 

 

ResetCode:

Byte;

 

 

Act:

Bit8;

 

 

End;

 

 

 

ComHis:

Bit16;

 

 

ComAct:

Bit16;

 

End;

 

The following functional description of ChError.His and ChError.Act applies in all channels:

 

1)    When an error is detected, the corresponding bits in ChError.His and ChError.Act are set True.

2)    When the error disappears, the corresponding bit in ChError.Act is cleared.

3)    After reading ChError.His, ChError.Act is copied to ChError.His.

4)    Transmission responses from the device include an Actual Data Error bit. This bit will be True if any bit in ChError.Act is True.

5)    Transmission responses from the device include a Historical Data Error bit. This bit will be True if any bit in ChError.His is True.

 

ComHis and ComAct

ComHis and ComAct are unique fields in the Service channel, and hold an error status relating to all channels, where the bit number corresponds to the channel number.

Each channel has an error register: ChError. If any bit (0 - 6) in ChError.His in a particular channel is True, the bit corresponding to that channel in ComHis is True. If any bit (0 - 6) in ChError.Act in a particular channel is True, the bit corresponding to that channel in ComAct is True.

When a channel becomes error free, the corresponding bit in ComAct is automatically cleared. If a channel is error free, the corresponding bit in ComHis will be cleared when reading ChError.His for that channel.

 

ChError.His and ChError.Act

The 8 bits in ChError.His and ChError.Act have the following meaning:

7

 

 

 

 

 

 

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0: Any Channel Error (ComHis / ComAct <> 0)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1: MasterReset

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2: EEPROM Memory Fault

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3: Real Time Clock Fault

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4: Battery low (.His only)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5: FLASH Memory Fault

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6: Power supply voltage too low / BOOT OS too low

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7: Reset

 

 

 

 

 

 

 

 

 

 

 

Bit 0

Any Channel Error = True means, that an error or an unacknowledged error exists in one or more channels.

Bit 1

MasterReset is set True after a MasterReset. After a MasterReset all RAM is cleared or initialised to default values. A MasterReset is performed if the Reset button is activated for more than 10 seconds, or if the built-in lithium battery is low during power failure.

Bit 2

EEPROM Memory Fault is set True if the automatic memory test finds an error in the EEPROM memory. The EEPROM memory is only tested during Reset, so the only way to clear this error code is to reset the device.

Bit 3

Real Time Clock Fault is set True if an error is detected in the Real Time Clock circuitry. The RTC circuitry is only tested during Reset, so the only way to clear this error code is to reset the device.

Bit 4

Battery low is set True if the automatic battery check system detects that the battery voltage is too low. When this error occurs, the battery will still be able to maintain RAM and the Real Time Clock for at least one month. So, this error means: Change battery within a month. The battery voltage is checked after reset, and every 4 minutes. Refer to BatteryState for further details.

Bit 5

FLASH Memory Fault is set True if an error occurs during a write to flash operation. The only way to clear this error is to reset the device.

Bit 6

Power supply voltage too low is set True if the power supply voltage is below 18 V, and “Resume after power failure” is enabled – refer to MaxPowerdownTime for further details. From version 2.10, the meaning of this bit has changed to “BOOT OS too old”. Refer to DeviceConfig.EnableBit[2] description.

Bit 7

Reset is set True after a reset of the DPI. If reset was caused by MasterReset, or any error giving a ResetCode equal to or higher than 16, Reset is set True in as well ChError.Act as ChError.His. Otherwise, Reset is set True in ChError.His only.

 

 

Code

A ResetCode stored in the byte immediately following ChError.His indicates the reason for the Reset, as shown in the table:

 

ResetCode

Reason for Reset

1

255 ($FF) stored in Service.Reset: Reset from P-NET

 

 

3

Reset button pressed

4

Power failure

5

MasterReset due to low battery

6

MasterReset due to Reset button pressed for more than 10 seconds

7

RAM preserved after power loss with low battery voltage

16

Watchdog Reset

17

Instruction error

18

Address error

19

Privilege violation

20

Access error

21

Division by zero

22

Uninitialized interrupt

23

Spurious interrupt

24

Stack overflow

 

 

32

Any other reason

 

ResetCode is not cleared as a result of reading it.

 

When an error in Data-FLASH occurs, the value of ResetCode is overwritten by a code indicating the type of Data-FLASH error, according to the following table:

 

ResetCode

Meaning

40

FLASH programming error – is was not possible to store the required value in FLASH

41

FLASH erase error – the FLASH could not be erased

42

FLASH programming error – is was not possible to store the required value in FLASH during de-fragment

43

FLASH missing sectors – there were no erased sectors where data could be written

44

FLASH not erased when write to FLASH was attempted

 

Refer to UserFLASH for further information.