Acyclic data exchange(非同期通信)

Acyclic data exchange”非同期通信”を使ってこのSINA_PARASを実現します。
この非同期通信は以下のTasksできます:
- 大量の”User Data”を交換
- PLCのFunction Blocks READとWRITEでデータを交換。Data block構成はDS47に従う必要があります。一つのRead/Write Jobのサイズは240Byteまで。
↓英語ですが、解説があります。
https://stackoverflow.com/questions/18037422/what-is-cyclic-and-acyclic-communication
SINA_PARA Block解説

Block Paras
- Start:アップパルス入れる度Functionを実行する。
- ReadWrite:0=読み込む、1=書き込む
- ParaNo:パラメータセット番号(1-16まで)
- HardwareID:HwのObject全部自分のIDがついています、そのID。
- AxisNo:Axisの番号、V90PNなら2をいれてください。
- Error:実行中にエラーが発生。
- ErrorId:エラーのときの戻り値。
- BUSY:Function実行中はTrueになり、完成・エラーのときはFalse。
- DONE:Function実行完成。
- Ready:Functionは実行してない状態。
- Diagld:戻り値。
sxParameter

次はFB286のInstanceDBのsxParameterを設定します。
- siParaNo[x]:パラメータの番号
- siIndex:パラメータが配列形なら操作したIndex番号いれてください。
- srValue:書き込むもParasはもし実数の場合はここで値を入れます。
- sdValue:書き込むもParasはもし実数じゃない場合はここで値を入れます。
- syFormat:”swFormat一覧”に参照
- swErrorNo:”swErrorNo一覧”に参照
書き込むの例


この例ではFB286を使ってP2581(整数)、P29120(実数)を書き込むです。
まずHWIDをちゃんと確認しいれて置きます。ReadWriteはいま1の状態です。
なので…
sxParameter[1].siParaNoは2581、つまりP2581です。
sxParameter[1].syFormatは16#04、つまりINT32のFormatです。
sxParameter[1].sdValueは45789、つまりINT32の45789を書き込みます。
sxParameter[2]はsiParaNoは29120、つまりP29120です。
sxParameter[2].syFormatは16#08、つまりRealのFormatです。
sxParameter[2].sdValueは2.567、つまりRealの2.567を書き込みます。
読み込むの例

書き込むの例と同じですが、ReadWriteのところは0に入れます。

なので…
sxParameter[1].siParaNoは2581、つまりP2581です。
sxParameter[1].syFormatは16#04、つまりINT32のFormatです。
sxParameter[1].sdValueは45789に帰ってくるので、つまりINT32の45789に入ります。
sxParameter[2]はsiParaNoは29120、つまりP29120です。
sxParameter[2].syFormatは16#08、つまりRealのFormatです。
sxParameter[2].sdValueは2.567帰ってくるので、つまりRealの2.567に入ります。
*Real以外の戻り値はすべてsdValueに入ります。
SINA_PARA_S Block解説

Block Paras
- Start:アップパルス入れる度Functionを実行する。
- ReadWrite:0=読み込む、1=書き込む
- Parameter:パラメータ番号
- Index:パラメータが配列の場合にIndexを入れます
- ValueWrite1:実数の場合入れるの設定値
- ValueWrite2:実数じゃない場合の設定値
- HardwareID:HwのObject全部自分のIDがついています、そのID。
- AxisNo:Axisの番号、V90PNなら2をいれてください。
- Error:実行中にエラーが発生。
- ErrorId:エラーのときの戻り値。
- BUSY:Function実行中はTrueになり、完成・エラーのときはFalse。
- DONE:Function実行完成。
- Ready:Functionは実行してない状態。
- Diagld:戻り値。
- ValueRead1:実数のParasの戻り値。
- ValueRead2:実数じゃないのParasの戻り値。
- Format:戻り値のData Format。
- ErrorNo:Function実行するときエラーすると値があります。
整数書き込む例

WriteModeで、パラメータ番号2581(整数)に12345をMD82に入れて書き込む。
実数書き込む例

WriteModeで、パラメータ番号29110(実数)に1.235をMD78に入れて書き込む。
整数読み込むの例

ReadModeで、パラメータ番号2581(整数)の値がValueRead1(MD86)に戻る。
実数読み込むの例

ReadModeで、パラメータ番号29110(実数)の値がValueRead2(MD90)に戻る。
swErrorNo一覧
- 00 hex The target parameter number does not exist.
- 01 hex Parameter value can’t be modified.
- 02 hex The modified value exceeds the parameter value range.
- 03 hex The target parameter index does not exist.
- 04 hex Using the index to visit the parameter without any index.
- 05 hex The data structure is not correct.
- 06 hex Using a value not equal to 0 to modify parameter value is forbidden.
- 07 hex Can’t modify the parameter description.
- 09 hex The target parameter description does not exist.
- 0B hex No access to modify parameter value.
- 0F hex The target text array does not exist.
- 11 hex Can’t modify parameter during drive is running.
- 14 hex Parameter value error.
- 15 hex The response data length.
- 16 hex Parameter address is not correct.
- 17 hex The format is not correct.
- 18 hex The quantity of the parameter value is not correct.
- 19 hex The target drive does not exist.
- 6B hex No access to modify parameter value while drive enabled.
- 6C hex Unknown unit.
- 6E hex Only can be modified while P0010=3.
- 6F hex Only can be modified while P0010=2.
- 70 hex Only can be modified while P0010=1.
- 71 hex Only can be modified while P0010=0.
- 72 hex Only can be modified while P0010=30.
- 73 hex Only can be modified while P0010=95.
- 74 hex Only can be modified while P0010=5.
- 75 hex Only can be modified while P0010<>0.
- 76 hex Only can be modified while P0010=29.
- 77 hex Can’t modify parameter value while downloading.
- 81 hex Can’t modify parameter value while downloading.
- 82 hex P0806 is forbidden. 83 hex BICO is not correct.
- 84 hex Drive does not receive the modify task.
- 85 hex Undefined communication method.
- 86 hex Only can be modified while P0010=15.
- 87 hex It’s forbidden due to the protection level.
- C8 hex The parameter value is lower than the minimum value.
- C9 hex The parameter value is higher than the maximum value.
- CC hex It’s forbidden to modify parameter value.
syFormat一覧
- 02hex:int8
- 03hex:int16
- 04hex:int32
- 05hex:uint8
- 06hex:uint16
- 07hex:uint32
- 08hex:real
- 10hex:String
- 13hex:Time
- 41hex:Byte
- 42hex:word
- 43hex:Dword
ErrorID一覧

ErrorID[1]
- 0x000 No fault active
- 0x001 Internal telegram error active
- 0x002 Parameterization error active
- 0x003 Error active when calling SFB
ErrorID[2]
- 0x00 No fault during parameter access
- 0x01 1. Parameter access error Evaluation, see swParameter[1].ErrorNo
- 0x02 2. Parameter access error Evaluation, see swParameter[2].ErrorNo
- 0x04 3. Parameter access error Evaluation, see swParameter[3].ErrorNo
- 0x08 4. Parameter access error Evaluation, see swParameter[4].ErrorNo
- 0x10 5. Parameter access error Evaluation, see swParameter[5].ErrorNo
- 0x20 6. Parameter access error Evaluation, see swParameter[6].ErrorNo
- 0x40 7. Parameter access error Evaluation, see swParameter[7].ErrorNo
- 0x80 8. Parameter access error Evaluation, see swParameter[8].ErrorNo
- 0x100 9. Parameter access error Evaluation, see swParameter[9].ErrorNo
- 0x200 10. Parameter access error Evaluation, see swParameter[10].ErrorNo
- 0x400 11. Parameter access error Evaluation, see swParameter[11].ErrorNo
- 0x800 12. Parameter access error Evaluation, see swParameter[12].ErrorNo
- 0x1000 13. Parameter access error Evaluation, see swParameter[13].ErrorNo
- 0x2000 14. Parameter access error Evaluation, see swParameter[14].ErrorNo
- 0x4000 15. Parameter access error Evaluation, see swParameter[15].ErrorNo
- 0x8000 16. Parameter access error Evaluation, see swParameter[16].ErrorNo