550 565 03

 

Light-Link Communication channel

 

The function of a Communication Channel is to provide a mechanism for transferring data externally using different electrical standards to form a communication Port. The actual electrical interface is achieved by means of hardware, but the channel registers provide the user with facilities for selecting transfer timings and format, and for reading and writing data.

 

In terms of PD 60x DPIs, each have 2 Communication Ports. Channel 1 refers to a specific interface depending on the DPI type, i.e. PD 600 = RS 485, PD 601 = RS232, PD 602 = Ethernet. Connection to Channel 1 interfaces is made via an RJ45 connector or the terminals mounted on the associated base module. Channel 2 always refers to the built-in Light-Link interface.

 

Each time a write operation is made to one of the variables SpecialFeatures, NodeParam, Baudrate, ChConfig or DatamodeParam, and WriteEnable is True, the channel is initialised, in accordance with the new contents of the variables. This is also the case if a write operation is made to NodeParam via PNETSerialNo in the Service Channel, or to NetParam in the Service Channel. Therefore, a delay of several seconds should be expected before these write operations are completed.

 

If the configuration of the communication channel is set up in an inappropriate way, it may be impossible to re-establish any contact with the device. To work around this problem, the following functionality applies:

Following a MasterReset, the Light-Link communication channel is set to P-NET protocol at 76.8 Kb/s, slave mode only, SpecialFeatures.Flags all false. In this situation, the actual setting used cannot be read. What is read is the setting in the EEPROM, making it possible to see, how the channel will work after a normal reset.

Following a normal reset, or start of operating system in FLASH, the device will use the configuration selected in the EEPROM again.

 

Variables in a Communication Channel

RegNo.

Identifier

Memory type

Read out

Type

0

OutputBuffer

RAM ReadWrite

--------

Buffer

1

InputBuffer

RAM ReadWrite

--------

Buffer

2

 

 

 

 

3

SpecialFeatures

EEPROM RPW

--------

Record

4

 

 

 

 

5

NodeParam

EEPROM RPW

--------

Record

6

Baudrate

EEPROM RPW

Decimal

LongInteger

7

Retries

EEPROM RPW

Decimal

Byte

8

ReserveTimer

RAM ReadWrite

Decimal

Timer

9

ChConfig

EEPROM RPW

--------

Record

10

ReservePreset

EEPROM RPW

Decimal

Real

11

Reservation

RAM ReadWrite

Binary

Boolean

12

DatamodeParam

EEPROM RPW

--------

Record

13

Maintenance

EEPROM RPW

--------

Record

14

ChType

PROM ReadOnly

--------

Record

15

ChError

RAM ReadOnly

--------

Record

 

 

RegNo. 0: OutputBuffer

 

 

OutputBuffer:

Buffer[n] of STRING[p];

 

 

When configured to DatamodeOut (ChConfig.Functions = DatamodeOut or DatamodeInOut), data written to this buffer will be sent to the port.

Data is transmitted when there is at least one element in the buffer. Only the number of bytes corresponding to the actual length of the string is sent. The string length (1st byte) is NOT sent.

When writing to OutputBuffer, the ReserveTimer is pre-set with the value found in ReservePreset.

 

 

RegNo. 1: InputBuffer

 

 

InputBuffer:

Buffer[n] of STRING[p];

 

 

When configured to DatamodeIn (ChConfig.Functions = DatamodeIn or DatamodeInOut), data received at the port is transferred to this buffer.

Data is transferred to the buffer according to the conditions described under DatamodeParam. The string length (1st byte) is calculated and inserted - NOT received.

Transferring an element to the InputBuffer may generate a Software-interrupt.

 

 


RegNo. 3: SpecialFeatures

This variable is a record having the following structure:

 

Record

 

 

Flags:

Bit8;

 (*Factory setting: All flags False *)

 

MaxResponseTime:

Real;

 (*Factory setting: 2.0 seconds *)

End;

 

This record is used to define special functions for the communication channel.

 

Flags

 

SpecialFeatures.Flags

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

0: No write access

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1: No access

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2: Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3: Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4: Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5: PD 3000 Compatible

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6: Acknowledge Unconfirmed Request

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7: Don't Acknowledge Confirmed Request

 

 

 

 

 

 

 

 

 

 

 

Following a Master reset, all flags will be false. Performing a normal reset will restore the settings from the EEPROM.

 

Bit 0          If No write access is True, it means that no P-NET write requests are legal on this port. Any P-NET request holding one of the instructions STORE, AND, OR, TAS or LONGSTORE will result in a "Write protection" response. This goes for all requests, whether they are requests for this device, or gateway requests.

Bit 1          If No access is True, it means that no P-NET requests are legal on this port. In other words, this port only works as a P-NET master. Any P-NET slave request will result in a "Write protection" response. This goes for all requests, whether they are requests for this device, or gateway requests.

Bit 2          Not used

Bit 3          Not used

Bit 4          Not used

Bit 5          If “PD 3000 Compatible” is set True, the DPI will be able to function as a gateway between a PC and a PD 3000 controller. The “PD 3000 Compatible” flag must be set True for the port connected to the PD 3000 controller.

Bit 6          This facility is related to gateway requests only. A master requesting a slave through a gateway, first receives  “Answer comes later” from the gateway, and later on receives the “Later answer”. This “Later answer” is an Unconfirmed Request. If Acknowledge Unconfirmed Request is True, the receipt of unconfirmed P-NET requests (Later answers) will be acknowledged by the operating system automatically sending an immediate reply. Unconfirmed requests are requests holding "Later answers". This facility can be used to automatically retransmit unconfirmed requests the number of times indicated by Retries for the transmitting channel, if the transmitting channel receives no acknowledge from the receiving node. The value of Acknowledge Unconfirmed Request MUST be the same for all masters on the same link. By default, Acknowledge Unconfirmed Request is False. Setting Acknowledge Unconfirmed Request to True can improve performance with very noisy connections.

Bit 7          If Don't Acknowledge Confirmed Request is False, the receipt of confirmed requests will be acknowledged. The immediate reply will typically hold the response. This is the normal P-NET functionality. If Don't Acknowledge Confirmed Request is True, immediate reply will never be sent when this channel is a slave, and will never be expected from slaves when this channel is a master. All "responses" will instead be sent as "later answers", which are new requests including at least 2 destination addresses. This facility is used to speed up MODEM connections. In MODEM connections it takes some time from when data is sent into the MODEM until it is received on the other MODEM. In other words, it takes a fixed minimum time to send a frame. In this time, it will often be possible for the other channel (to which the gateway request is sent) to send a whole request and receive a whole response. Therefore, by not sending “Answer Comes Later”, the transmission time is reduced by approximately half. The value of Don't Acknowledge Confirmed Request MUST be the same for all devices on the same link.

 

MaxResponseTime

The value of this variable defines for how many seconds this device should wait for a response after sending a request and receiving “Answer comes later”. If no response is received within the specified time, the P-NET error “TIME OUT” is generated.

Note: Only FLASH OS version 1.19 or higher.

 

RegNo. 5: NodeParam

This variable is a record having the following structure:

 

Record

(* Factory setting *)

 

PNETNo:

Byte;

(* 0 *)

 

NoOfMasters:

Byte;

(* 0 *)

End;

 

This variable holds the node parameters for the communication channel.

The values of these registers may also be changed via Service.PNETSerialNo. When this is done, the values are always transferred to the EEPROM, regardless of the state of WriteEnable.

 

PNETNo

PNETNo defines the P-NET number (P-NET Node Address) of the channel.

 

NoOfMasters

NoOfMasters defines the number of masters for the channel.

 

 

RegNo. 6: Baudrate

 

 

Baudrate:

LongInteger;

(* Factory setting: 76800 *)

 

This variable selects the baud rate for the communication channel. If an illegal baud rate is selected, an error code is generated. Baud rate can hold the values 230400 or 76800.

 

Following a master reset, the default baud rate will be selected. Performing a normal reset will restore the value from the EEPROM.

 

 

RegNo. 7: Retries

 

 

Retries:

Byte;

(* Factory setting: 0 *)

 

This register defines the maximum number of retries made in case of transmission error, before the error is reported. The register only has meaning if the channel is a master.

The defined maximum number of retries is for each block in a LONG LOAD / STORE. Therefore, the value of Retries should be very low.

 

 

RegNo. 8: ReserveTimer

 

 

ReserveTimer:

Timer;

 

 

ReserveTimer is automatically preset with the value from ReservePreset, each time the channel is reserved (Reservation Boolean set True by TestAndSet), and each time a string is sent to the OutputBuffer. If the ReserveTimer reaches zero before it is preset again, the Reserva­tion Boolean will be cleared automatically, and the error Reservation timeout will be generated. The ReserveTimer may also be preset by direct access.

 

 

RegNo. 9: ChConfig

This variable is a record having the following structure:

 

Record

(* Factory setting *)

 

Enablebit:

Bit8;

(* 00000000  *)

 

Functions:

Byte;

(* 1 *)

 

Ref_A:

Byte;    

(* 1 (AddressData parity) *)

 

Ref_B:

Byte;

(* 8 ( = 8 Databit) *)

End;

 

 

The ChConfig variable allows the user to determine which of the available functions in this channel are to be used.

 


Enablebit

ChConfig.Enablebit

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

0: Simulation (InputBuffer)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1: DatamodeIn Dynamic buffer element sizing enabled

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2: DatamodeIn StopChar function enabled

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3: DatamodeIn Pause function enabled

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4: Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5: DatamodeOut Add CR LF automatically

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6: Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7: Not used

 

 

 

 

 

 

 

 

 

 

 

If Simulation is selected, writing to the InputBuffer is legal, and data from the port will be ignored.

Refer to DatamodeParam for a description of DatamodeIn flags.

If DatamodeOut Add CR LF automatically is selected, the two characters CR and LF ($0D and $0A) are always sent immediately after an element from the OutputBuffer has been sent.

 

Functions

Functions holds the protocol of the channel:

 

 

00:

Disabled

 

01:

PNET Default Error check (1 byte)

 

02:

PNET Extended Error check (2 byte)

 

03:

DatamodeIn

 

04:

DatamodeOut

 

05:

DatamodeInOut

 

Ref_A - Parity

The value of this variable defines parity:

 

 

00:

None

 

01:

AddressData

 

02:

Even

 

03:

Odd

 

04:

Mark

 

05:

Space

 

 

 

 

 

AddressData parity is used for P-NET communication

.

 

Ref_B - NoOfDatabit

The value of this variable defines how many data bits are sent per byte. The number of data bits can be 5, 6, 7 or 8. In P-NET mode, the number of data bits will always be 8, regardless of the value of this variable.

 

 

RegNo. 10: ReservePreset

 

 

ReservePreset:

Real;

 

 

Preset value for ReserveTimer. Refer to ReserveTimer and Reservation for further description.

 

 

RegNo. 11: Reservation

 

 

Reservation:

Boolean;

 

 

This variable is used to reserve the communication channel. The reservation facility is used in relation to DatamodeOut, to prevent mixing of data written to the OutputBuffer from different applications. Reservation = True indicates, that the communication channel is reserved. The variable must be set True with the TestAndSet function, to reserve the communi­cation channel. A TestAndSet access to the Reservation Boolean resulting in a reservation, will pre-set the ReserveTimer with the value found in ReservePreset. When the OutputBuffer is no longer needed, it must be released again by setting Reservation = False.

 

The Reservation Boolean will be cleared automatically and a Reservation Timeout error will be generated, if the ReserveTimer reaches zero before it is pre-set again (by writing to OutputBuffer).

 

 

RegNo. 12: DatamodeParam

This variable is a record having the following structure:

 

Record

(* Factory setting *)

 

Pause:

Real;

(* 0 *)

 

ElementSize:

Byte;

(* 0 *)

 

StopChar:

Byte;

(* 0 *)

End;

 

This variable holds parameters concerning DatamodeIn only.

 

The combination of ChConfig and this variable determines, when data is transferred to Input­Buffer.

 

If ChConfig.Enablebit[3] is True, an element is transferred to the InputBuffer when data has been received, and no further data has been received within the time defined in Pause. The value in Pause is inserted in seconds and has a resolution of approx. 0.001 seconds.

 

An element is transferred to the InputBuffer when the number of bytes defined in ElementSize have been received. If ElementSize is = 0 or higher than the actual size of an element in InputBuffer, an element is transferred to the InputBuffer when the number of bytes corresponding to the actual size of an element in InputBuffer have been received.

 

If ChConfig.Enablebit[2] is True, an element is transferred to the InputBuffer when a character equal to StopChar has been received.

 

If the InputBuffer is full when an element should be inserted, an InputBuffer full error is generated.

 

Each byte received is in fact transferred directly to the InputBuffer. When the first byte to a new buffer element is received, the buffer element is automatically "reserved" because the "Number of free elements" counter decrements by 1. The received byte is inserted in the buffer element, and the actual length of the string is set to 1. Now, the next bytes received are inserted in the reserved element and the actual length of the string incremented, until one of the conditions for transferring data to InputBuffer is fulfilled. When this occurs, the "Number of elements" counter is incremented by 1, and an interrupt may be generated (if selected).

 

The counters "Number of free elements" and "Number of elements" are described along with general Buffer facilities in the P-NET Standard.

 

If ChConfig.Enablebit[1] is True, "Dynamic buffer element sizing" is enabled. Normally, a read access to a buffer with "No of elements" = 0, results in a BufferError (Buffer empty). However, with "Dynamic buffer element sizing" the bytes received at the time of the read operation, are returned. As always, the actual number of bytes is returned in the first byte (the String length). After this read, reception is continued in a new buffer element.

 

 

RegNo. 13: Maintenance

This variable is a record having the following structure:

 

Record

(* Factory setting *)

 

Date:

Byte;

(* 0 *)

 

Month:

Byte;

(* 0 *)

 

Year:

Byte;

(* 0 *)

 

Category:

Byte;

(* 0 *)

End;

 

The Maintenance variable is used for service management and maintenance purposes, and may hold the last date of service and an indication of the type of service.

 

 

RegNo. 14: ChType

This variable is a record having the following structure:

 

Record

 

 

ChannelType:

Word;

 

 

Exist:

Bit16;

 

 

Functions:

Bit16;

 

End;

 

 

The ChType variable indicates what type of channel this is, how many channel registers are used, and what functions this channel offers.

 


ChType has the following values:

 

ChannelType= 14   (Communication Channel:

 

Exist =

Bit no

15

 

 

 

 

 

 

7

 

 

 

 

 

 

0

Value

1

1

1

1

1

1

1

1

1

1

1

0

1

0

1

1

 

Functions =

Bit no

15

 

 

 

 

 

 

7

 

 

 

 

 

 

0

 

Value

0

0

0

0

0

0

0

1

0

0

1

1

1

1

1

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Channel can be disabled

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

P-NET default error check

(1 byte)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

P-NET extended error check

(2 byte)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DatamodeIn

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DatamodeOut

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DatamodeInOut

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

RS485

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

RS232

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Light-Link

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

When selection of unsupported Baud rates, Parity modes, protocols etc. is tried, a configuration error is generated in ChError. The error is cleared when correct values are inserted.

 

 

RegNo. 15: ChError

This variable is a record having the following structure:

 

Record

 

 

His:

Bit8;

 

 

Act:

Bit8;

 

End;

 

 

ChError for Communication channel

 

7

6

5

4

3

2

1

0

 

 

 

 

 

 

 

 

 

 

 

 

0: Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1: Not used

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2: P-NET sync. Error

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3: Configuration error

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4: Reservation timeout

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5: Parity/Framing error

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6: InputBuffer overrun

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7: Device error

 

 

 

 

 

 

 

 

 

 

 

Bit 7   Device error. If this bit is set, the rest of the bits have no meaning because a device error can cause random error codes on the individual channels (see also "Service channel").

Bit 6   InputBuffer overrun error is generated when transferring to the InputBuffer in DatamodeIn is not possible, because the buffer is full. The error is cleared in ChError.Act be reading the Input­Buffer.

Bit 5   Parity/framing error is generated if parity or framing error is detected on any of the received data for the InputBuffer. The error is cleared in ChError.Act when the Input­Buffer is read.

Bit 4   Reservation Timeout is generated if the Reservation boolean is cleared because the Reservation timer reached zero. The error is cleared in ChError.Act by writing to the Reservation variable.

Bit 3   Configuration erroris generated when an illegal configuration is attempted. The error is generated in ChError.His and in ChError.Act. The error is cleared in ChError.Act by a legal write operation (a legal configuration).

Bit 2   P-NET sync. error is generated when a P-NET synchronization error occurs. This is typically a result of different NoOfMasters in devices connected to the same link. Refer to the P-NET standard for further information. The error is cleared when synchronization is regained.