Expanded ADS Function Blocks
The expanded ADS function blocks make it possible to create a client-server communication between an ADS device and a PLC task. With the ADS device it can be a case of a Windows application (uses the AdsDLL/AdsOcx) or another PLC run-time system. Communication between the ADS device and the PLC task is processed using the following service primitives:
- Request
- Indication
- Response
- Confirmation
Communication between an ADS device and a PLC task proceeds as follows: an ADS device sends a request to the target device (PLC task). This request is registered in the target device by an indication. The target device (PLC task) thereupon carries out a corresponding service. The service to be carried out is encoded via the index-group/offset parameter. Next the PLC sends a response to the ADS device. The response is registered as confirmation by the ADS source device.
Only one instance of the indication and response function block can meaningfully be used per PLC task (one instance of ADSREADIND, ADSREADRES, ADSWRITEIND, ADSWRITERES, ADSRDWRTIND and ADSRDWRTRES ). Corresponding with the available ADS services: READ, WRITE and READ & WRITE there is an appropriate indication or response function block for each service.
Expanded ADS function blocks
Service | Name | Description |
---|---|---|
READ | ADSREAD-Indication. | |
ADSREAD-Response | ||
WRITE | ADSWRITE-Indication | |
ADSWRITE-Response | ||
READ & WRITE | ADS-READ & WRITE-Indication | |
ADS-READ & WRITE-Response |
The ADS devices are addressed via a port address and a network address (NETID). The target address of the PLC task is formed in the following manner:
Port address of the PLC task = port number of the run-time system + task number, which should be addressed.
The current task number can be ascertained with the GETCURTASKINDEX function block.
Example:
The first PLC task of the first PLC run-time system on a local computer should be addressed. The port number of the PLC task is shown by:
PORT = 801 + 1 = 802
NETID = ” (empty string)
Comments:
- In order for a request to be routed to the PLC task, the highest-value bit, e.g. IG:=0x80000001, must be entered in the index group parameter when the request is made.
- Each PLC task has 3 Fifos (ADSREADIND Fifo, ADSWRITEIND Fifo and ADSRDWRTIND Fifo), in which incoming requests (indications) are stored temporarily.
Each Fifo can store up to 10 indications until they have been processed (until a response was sent). If, for example, 12 ADSREAD requests are sent to a PLC task simultaneously, 10 requests are stored in the Fifo as indications and two are acknowledged (discarded) with ADS error message 1814 (0x716). In this case, the error code should be analysed and the two failed ADSREAD requests repeated if necessary. The indications are retrieved individually from the associated Fifo by calling the ADSxxxxxxIND instance. Only then can new indications be stored successfully in the Fifo.