11: // InfoData (read once): Axis name
fbAdsReadEx(
NETID:=stControl.stNc.stAccess.sAdsNetId,
PORT:=stControl.stNc.stAccess.nNcTaskPort,
IDXGRP:=stControl.stNc.stAccess.nIdxGrpBase+stAxis.NcToPlc.AxisId,
IDXOFFS:=16#2,
LEN:=SIZEOF(aAxisName),
DESTADDR:=ADR(aAxisName),
READ:=TRUE,
TMOUT:=DEFAULT_ADS_TIMEOUT);
IF NOT fbAdsReadEx.BUSY THEN
fbAdsReadEx(
NETID:=stControl.stNc.stAccess.sAdsNetId,
PORT:=stControl.stNc.stAccess.nNcTaskPort,
IDXGRP:=stControl.stNc.stAccess.nIdxGrpBase+stAxis.NcToPlc.AxisId,
IDXOFFS:=16#2,
LEN:=SIZEOF(aAxisName),
DESTADDR:=ADR(aAxisName),
READ:=FALSE,
TMOUT:=DEFAULT_ADS_TIMEOUT);
IF NOT fbAdsReadEx.ERR THEN
FOR nLoop:= 0 TO 31 DO
aByteMaxStringLength[nLoop]:=aAxisName[nLoop];
END_FOR
stControl.stNc.stAxisInfo.sAxisName:=BYTEARR_TO_MAXSTRING(aByteMaxStringLength);
nInfoDataRead:=nInfoDataRead+1;
END_IF;
nParamReadingStep:=nParamReadingStep+1;
END_IF
12: // InfoData (read once): Axis unit
fbAdsReadEx(
NETID:=stControl.stNc.stAccess.sAdsNetId,
PORT:=stControl.stNc.stAccess.nNcTaskPort,
IDXGRP:=stControl.stNc.stAccess.nIdxGrpBase+stAxis.NcToPlc.AxisId,
IDXOFFS:=16#5,
LEN:=SIZEOF(aAxisUnit),
DESTADDR:=ADR(aAxisUnit),
READ:=TRUE,
TMOUT:=DEFAULT_ADS_TIMEOUT);
IF NOT fbAdsReadEx.BUSY THEN
fbAdsReadEx(
NETID:=stControl.stNc.stAccess.sAdsNetId,
PORT:=stControl.stNc.stAccess.nNcTaskPort,
IDXGRP:=stControl.stNc.stAccess.nIdxGrpBase+stAxis.NcToPlc.AxisId,
IDXOFFS:=16#5,
LEN:=SIZEOF(aAxisUnit),
DESTADDR:=ADR(aAxisUnit),
READ:=FALSE,
TMOUT:=DEFAULT_ADS_TIMEOUT);
IF NOT fbAdsReadEx.ERR THEN
FOR nLoop:= 0 TO 11 DO
aByteMaxStringLength[nLoop]:=aAxisUnit[nLoop];
END_FOR
stControl.stNc.stAxisInfo.sBaseUnit:=BYTEARR_TO_MAXSTRING(aByteMaxStringLength);
nInfoDataRead:=nInfoDataRead+1;
END_IF;
nParamReadingStep:=nParamReadingStep+1;
END_IF
13: // InfoData (read once): Axis unit interpretation
fbAdsReadEx(
NETID:=stControl.stNc.stAccess.sAdsNetId,
PORT:=stControl.stNc.stAccess.nNcTaskPort,
IDXGRP:=stControl.stNc.stAccess.nIdxGrpBase+stAxis.NcToPlc.AxisId,
IDXOFFS:=16#26,
LEN:=SIZEOF(nAdsReadUINT32Value),
DESTADDR:=ADR(nAdsReadUINT32Value),
READ:=TRUE,
TMOUT:=DEFAULT_ADS_TIMEOUT);
IF NOT fbAdsReadEx.BUSY THEN
fbAdsReadEx(
NETID:=stControl.stNc.stAccess.sAdsNetId,
PORT:=stControl.stNc.stAccess.nNcTaskPort,
IDXGRP:=stControl.stNc.stAccess.nIdxGrpBase+stAxis.NcToPlc.AxisId,
IDXOFFS:=16#26,
LEN:=SIZEOF(nAdsReadUINT32Value),
DESTADDR:=ADR(nAdsReadUINT32Value),
READ:=FALSE,
TMOUT:=DEFAULT_ADS_TIMEOUT);
IF NOT fbAdsReadEx.ERR THEN
stControl.stNc.stAxisInfo.bVelUnitPerMin:=nAdsReadUINT32Value.0;
stControl.stNc.stAxisInfo.bVelUnitPerSec:=NOT nAdsReadUINT32Value.0;
stControl.stNc.stAxisInfo.bPosInThousands:=nAdsReadUINT32Value.1;
stControl.stNc.stAxisInfo.bPosModuloDisp:=nAdsReadUINT32Value.2;
IF stControl.stNc.stAxisInfo.bVelUnitPerMin THEN
stControl.stNc.stAxisInfo.sVelocityUnit:=CONCAT(stControl.stNc.stAxisInfo.sBaseUnit,'/min');
ELSE
stControl.stNc.stAxisInfo.sVelocityUnit:=CONCAT(stControl.stNc.stAxisInfo.sBaseUnit,'/s');
END_IF
stControl.stNc.stAxisInfo.sAccelerationUnit:=CONCAT(stControl.stNc.stAxisInfo.sBaseUnit,'/s2');
stControl.stNc.stAxisInfo.sJerkUnit:=CONCAT(stControl.stNc.stAxisInfo.sBaseUnit,'/s3');
nInfoDataRead:=nInfoDataRead+1;
END_IF;
nParamReadingStep:=nParamReadingStep+1;
END_IF
14: // InfoData (read once): Axis type
fbAdsReadEx(
NETID:=stControl.stNc.stAccess.sAdsNetId,
PORT:=stControl.stNc.stAccess.nNcTaskPort,
IDXGRP:=stControl.stNc.stAccess.nIdxGrpBase+stAxis.NcToPlc.AxisId,
IDXOFFS:=16#3,
LEN:=SIZEOF(nAdsReadUINT32Value),
DESTADDR:=ADR(nAdsReadUINT32Value),
READ:=TRUE,
TMOUT:=DEFAULT_ADS_TIMEOUT);
IF NOT fbAdsReadEx.BUSY THEN
fbAdsReadEx(
NETID:=stControl.stNc.stAccess.sAdsNetId,
PORT:=stControl.stNc.stAccess.nNcTaskPort,
IDXGRP:=stControl.stNc.stAccess.nIdxGrpBase+stAxis.NcToPlc.AxisId,
IDXOFFS:=16#3,
LEN:=SIZEOF(nAdsReadUINT32Value),
DESTADDR:=ADR(nAdsReadUINT32Value),
READ:=FALSE,
TMOUT:=DEFAULT_ADS_TIMEOUT);
IF NOT fbAdsReadEx.ERR THEN
stControl.stNc.stAxisInfo.nAxisType:=nAdsReadUINT32Value;
nInfoDataRead:=nInfoDataRead+1;
END_IF;
nParamReadingStep:=nParamReadingStep+1;
END_IF