Bon ben c'est bon, j'écris un petit wrapper autour de cette fonction :
FUNCTION_BLOCK CanUser_SDOdownload
(*
This function block starts a SDO download transfer and sends the data (max 4 byte) to the SDO server.
The data transfer from the SDO client to the SDO server is made by an "expedited CAN transfer".
The SDO client sends the data with index and subindex to the SDO server. Afterwards the SDO server confirms the receipt of the data.
Input parameter
wDrvNr CAN driver number (default: 0, more supported driver numbers are dependent on the used device)
bNodeNr CAN node number: 1..127
bLen Data length: 1..4
wIndex Index
bSubIndex Subindex
bTxByte0 Data byte 1
bTxByte1 Data byte 2
bTxByte2 Data byte 3
bTxByte3 Data byte 4
Output parameter
xReady FALSE ... Action runs
TRUE ... Action done
iStatus 1 ... OK
0 ... Wait
-1 ... Communication-Timeout (500ms)
-2 ... Abort
-3 ... Send-Error
-4 ... wrong node number
-5 ... wrong data length
-7 ... wrong wDrvNr
dwAbortCode Additional error code from CAN driver
Possible error codes are to be taken from the CiA DS301 (Abort code).
Input / Output parameter
xStart Level controlled Start/Stop of action: If the action is done the function block resets xStart automatically.
FALSE ... Stop action
TRUE ... Start action
Note:
The command byte of the SDO will be built by the FB as "initiate download request" with datasize inicated (see also description from CANopen, DS301).
bit-no. description
5..7 css: client command specifier 1 ... initiate download request
4 x: not used, always 0
2..3 n: only valid if e = 1 and S = 1, otherwise 0. If valid it indicates the number of bytes that do not contain data.
1 e: transfer type 1 ... expedited transfer
0 s: size indicator 1 ... data set size is indicated
*)
(ya la fonction symétrique en Rx)
Il suffira de passer une structure de donnée custom en paramètre, avec index, subindex et datalength.
Ensuite, j'écris un header bien documenté, basé sur ça :
http://www.mirari.fr/mrSt#G13.20074210 , pour pouvoir lire/écrire tous les paramètres accessibles en SDO. J'ai juste à extraire les index/subindex/datalength.
Et pouf.
Le patron voulait avoir un nouveau mode de coulage de niveau avec des têtes volumétriques. On savait pas faire. Il sera servi.
