Lenze PLC Designer PLC Designer (R2-x) CANopen for Runti Instrukcja Użytkownika Strona 22

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 56
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 21
L-force | PLC Designer - CANopen for Runtime Systems
CANopen-Master library
DMS 2.0 EN 05/2009 TD29 21
dwDataOffset : DWORD; (* After the data transfer the number of actually read
resp. written bytes appears in this variable.*)
dwDataReadLength : DWORD; (* The estimated length of a SDO upload (from the
1. response message).*)
ucUploadRequest: BYTE;
bLastToggle: BOOL;
iCurSDODataLen : INT;
ucDownloadRequest: BYTE;
END_VAR
In order to be able to use this module, for each simultaneous transfer a static instance of the module
must be created (static means: not as a local variable of a function). It is not possible (per CANopen
definition) to open multiple SDO channels to the same slave at the same time.
Send SDO (expedited Mode):
The input parameters to be passed to the module: address (NodeID) of the target node, (0-based)
number of the CAN network on which the module should work, the 4 data bytes, index and subindex
of the target object. Further on the mode in which the module should work must be passed: For
sending of
- 4 Bytes: mode 16#23,
- 3 Bytes: mode 16#27,
- 2 Bytes: mode 16#2B,
- 1 Byte: mode 16#2F.
Example: If a 4-byte value should be written to a SDO server, the call of the module must look like
shown in the following:
sdo(
Enable:= TRUE,
wDrvNr:= 0,
ucNodeId:= 2,
wIndex:= 16#4002,
bySubIndex:= 0,
ucModus:= 16#23,
aAbortCode:=aAbort,
ucByte0 := DWORD_TO_BYTE(dwWrite),
ucByte1 := DWORD_TO_BYTE(SHR(dwWrite,8)),
ucByte2 := DWORD_TO_BYTE(SHR(dwWrite,16)),
ucByte3 := DWORD_TO_BYTE(SHR(dwWrite,24)));
Thereby sdo is an instance of CanOpenSendSDO.
To check whether the transfer has been terminated for example could be programmed like follows::
IF (sdo.bAnswerRec OR NOT sdo.bWaitForAnswer) then
….. (* Transfer is terminated. If bAnswerRec is not TRUE, an error has occurred.*)
END_IF
Przeglądanie stron 21
1 2 ... 17 18 19 20 21 22 23 24 25 26 27 ... 55 56

Komentarze do niniejszej Instrukcji

Brak uwag