SDO communication from the PLC

ADS blocks are used for SDO communication from the PLC. These function blocks can be used for sending SDO telegrams and receiving the response of the slave (ADSWRITE/ADSREAD).

Input parameters

Description

NETID

ADS NetID of the CAN interface

Port number

0x1000hex + NodeId (slave number)

IDXGRP

SDO Index

IDXOFFS

SDO Subindex

LEN

Length of SDO data (1...4)

Manual network management

The CANopen state (STOPPED, PRE-OPERATIONAL, OPERATIONAL) of a CANopen slave can be changed via ADS write control. In this case the AMS address should be set as for SDO communication. The other parameter are listed in the following table:

ADS State

Device State

CANopen state transition

ADSSTATE_RUN (5)

0

OP->PREOP

ADSSTATE_RUN (5)

1

PREOP->OP

ADSSTATE_STOP (6)

0

OP->STOP

ADSSTATE_RUN (5)

1

STOP->OP (with communication reset)

ADSSTATE_RUN (5)

3

STOP->OP (without communication reset)

ADSSTATE_STOP (6)

0

PREOP->STOP

ADSSTATE_RUN (5)

2

STOP->PREOP (without communication reset)

Restarting the CAN interface

The ADSWRTCTL function block can be used to stop and restart the CAN interface. It should be stopped first before restarting it.

Input parameters

Description

NETID

ADS NetID of the CAN interface

Port number

200dec

ADSSTATE

ADSSTATE_STOP, ADSSTATE_RUN

DEVSTATE

0

LEN

0

SRCADDR

0