Funciones DP-V1
6
Apéndice
VAR_TEMP
MVLK_Resp : STRUCT
ResponseReference : BYTE ;
ResponseId : BYTE ;
Axis : BYTE ;
No_of_Parameter : BYTE ; //RESP: No of Parameters
Attachment : ARRAY
BYTE ;
END_STRUCT ;
fTempError : BOOL ;
fTempBusy : BOOL ;
fTempDone : BOOL ;
fTempValid: BOOL ;
dwTempStatus : DWORD ;
END_VAR
BEGIN
NETWORK
TITLE =Insert transfer parameter in Movilink structure
U
#fActivate;
FP
#fAuxflag; //Si no se inicia ni se procesa ningún servicio
O
#fBusy; //de parámetro,
SPBN
END; //...se abandona la función
U
#fStaticBusy; //Si está activado static Busy, ya se había efectuado el servicio Write,
SPBN
NEWR; //vaya en este caso a otra consulta
U
#fDPV1WriteDone; //Si se ha finalizado sin fallo el servicio Write, vaya a READ
SPB
READ;
SPA
WRIT; //De lo contrario, vaya a WRITE
NEWR: NOP
0; //Inicialización:
UN
#fStaticBusy; //Bits y valores de salida se resetean
S
#fStaticBusy; //Salida y bit de marca Busy se resetean
S
#fBusy;
R
#fDone; //DoneBit se resetea
L
0;
T
#bError; //Valores de salida, fallos y datos se ponen a CERO
T
#dwData;
L
#Drive_IO_Address; //Convertir DriveAddress de Int a DWord
T
#dwStaticDriveAddr;
//Llevar los datos a estructura de Movilink (aquí se suministran los parámetros de entrada sólo para los valores
//variables de la estructura)
L
#bAxis;
T
#MVLK_Req.Axis;
L
#bService; //Byte de servicio se multiplica con 10 hex
SLW
4;
T
#MVLK_Req.Attribute;
L
#bService;
SPL
ERUI; //Vaya a servicio Error MVLK
SPA
ERUI; // 0x00 No Service
SPA
ZEHN; // 0x01 Read Parameter
SPA
SEXZ; // 0x02 Write Parameter
SPA
SEXZ; // 0x03 Write Parameter volatile
SPA
ZEHN; // 0x04 Read Min
SPA
ZEHN; // 0x05 Read Max
SPA
ZEHN; // 0x06 Read Default
SPA
ZEHN; // 0x07 Read Scale
SPA
ZEHN; // 0x08 Read Attribute
SPA
ZEHN; // 0x09 Read EEPROM
ERUI: NOP
0; // Fallo servicio MVLK no permitido
L
3; //FalloMovilink
T
#bError;
L
DW#16#501; //MLER_ILLEGAL_SERVICE
SET
;
S
#fDone; //Busybit y Donebit se resetean
R
#fBusy;
R
#fStaticBusy;
R
#fDPV1WriteDone;
BEA
; //Finalizar la función
SEXZ: NOP
0;
SET
;
S
#fStaticWriteReq; //Indica para la evaluación de los datos que fue un MVLK-Write-Request
L
16;
SPA
LEN; //Vaya a definición de longitud
ZEHN: NOP
0;
SET
;
R
#fStaticWriteReq; //Indica para la evaluación de los datos que fue un MVLK-Read-Request
L
10;
LEN:
NOP
0;
T
#iStaticReqLength;
L
#wParameterIndex;
T
#MVLK_Req.ParameterNumber;
L
#wSubIndex;
T
#MVLK_Req.Subindex;
L
#dwWriteData; //Datos se escriben en la estructura, no importa si se trata de acceso de escritura o
T
#MVLK_Req.WriteData;
48
//Estructura Movilink Response
//RESP: Response reference
//RESP: Response ID
//RESP: Axis
[0 .. 7 ] OF //REQ: Data
//de lectura
Manual – Interface de bus de campo PROFIBUS DP-V1 UFP11A