PACSystems RX3i Serial Communications Modules User`s Manual


Add to my manuals
269 Pages

advertisement

PACSystems RX3i Serial Communications Modules User`s Manual | Manualzz

Statements to Exchange CPU Data: EXNEXT

The EXNEXT statement process the next Controlled data exchange that is ready. EXNEXT can provide master-like protocol behavior. EXSTAT must always be called after EXNEXT, except when EXNEXT returns 0. If EXNEXT returns 0, no exchange is ready for execution, so

EXSTAT should not be called.

Data exchanges that will be handled by EXNEXT statements in the SPL script must be set up in the port configuration to have an Exchange Type of Controlled. Controlled Exchanges can be configured for the following types of Operation:

Read Continuous

Read Continuous Bit-Control

Read Single Bit-Control

Write Continuous

Write Continuous Bit-Control

Write Single Bit-Control

Bit-controlled exchanges must be triggered by the PLC CPU application program to be ready for reading or writing by the SPL script. The Read Continuous and Write Continuous exchanges are always ready for reading or writing by the SPL script.

When the EXNEXT statement is encountered in the SPL script, the module evaluates the configured Controlled Exchanges in numerical order. It executes the first Controlled Exchange that is ready. The next time an EXNEXT occurs in the SPL script, the module starts its evaluation with the next exchange after the one that was just performed. Because the exchanges are evaluated in order, starting with the least recently-evaluated exchange, each exchange is processed if it is ready. That means a read or write continuous exchange will not dominate the SPL script's processing time. In the example below, EXNEXT first executes

Exchange 1, which has an operation type of Write Continuous. The next time EXNEXT is encountered in the SPL script, it first evaluates exchange 2, but it is not ready (its CPU control bit is not set). EXNEXT skips exchanges 3 and 4 because their Exchange Type is Validated. It then executes exchange 5. The next occurrence of EXNEXT would execute exchange 6 if it is still ready.

EXNEXT Exchange 1: Commanded, Write Continuous

Exchange 2: Commanded, Read Single Bit-Control

Exchange 3: Validated, Read

Exchange 4: Validated, Read

Exchange 5: Commanded, Read Continuous

Exchange 6: Commanded, Write Continuous Bit-Control

Exchange 7: Validated, Read/Write

Exchange 8: Validated, Write

9

GFK-2460E Chapter 9 Serial Protocol Language (SPL) 9-21

9

The module sets the ERROR global variable if an error occurs during the execution of

EXNEXT. If ERROR=0 (no error) after EXNEXT is executed, various EXCHANGE collection values are populated.

Syntax:

EXNEXT

Example:

EXCHANGE.buffer = ArrayVar.0 !any data to be read or written will begin here.

EXNEXT

!if EXCHANGE.exnum is non-zero then an exchange was triggered.

!if ERROR = 0 then no error occurred.

As shown above, the global variable element EXCHANGE.buffer must be assigned to an array variable element before the SPL script calls EXNEXT.

If the triggered exchange is a write exchange, the array specified by EXCHANGE.buffer is filled with data from the CPU.

If the triggered exchange is a read exchange, the SPL script must fill values into the array elements specified by EXCHANGE.buffer before calling EXSTAT.

EXNEXT sets the EXCHANGE.exnum variable to the exchange number (1-64) that was executed. If no exchange is executed, EXCHANGE.exnum is set to zero instead.

Global Variables for EXNEXT

The EXCHANGE global variables marked with S below must be assigned correct values before executing an EXNEXT command, or the data will not be transferred. In the table, S = must be set before call, R = Returned when function completes

.exnum R Exchange number triggered or validated

.id

R Exchange Target ID

.type R Exchange Target Type

.rw R Command is read (0) or write (1)

.buffer S Name of declared data array

.addr

R Target

.length

R Length of data in bytes.

0-255

0-255

0-254

0 or 1

Valid variable name

0-1024

9-22 PACSystems* RX3iSerial Communications Modules – June 2010 GFK-2460E

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

Download PDF

advertisement

Table of contents