[COLOR=#32B9B9]link[/COLOR][COLOR=#4A55DB]([/COLOR][COLOR=#BC8F8F]"[/COLOR][COLOR=#BC8F8F]your_dll_path[/COLOR][COLOR=#BC8F8F]\TcScilabBridge.dll[/COLOR][COLOR=#BC8F8F]"[/COLOR][COLOR=#000000],[/COLOR] [COLOR=#BC8F8F]"[/COLOR][COLOR=#BC8F8F]sciAdsReadDouble[/COLOR][COLOR=#BC8F8F]"[/COLOR][COLOR=#000000],[/COLOR] [COLOR=#BC8F8F]"[/COLOR][COLOR=#BC8F8F]c[/COLOR][COLOR=#BC8F8F]"[/COLOR][COLOR=#4A55DB])[/COLOR][COLOR=#000000];[/COLOR]
[COLOR=#32B9B9]link[/COLOR][COLOR=#4A55DB]([/COLOR][COLOR=#BC8F8F]"[/COLOR][COLOR=#BC8F8F]your_dll_path[/COLOR][COLOR=#BC8F8F]\TcScilabBridge.dll[/COLOR][COLOR=#BC8F8F]"[/COLOR][COLOR=#000000],[/COLOR] [COLOR=#BC8F8F]"[/COLOR][COLOR=#BC8F8F]sciAdsWriteDouble[/COLOR][COLOR=#BC8F8F]"[/COLOR][COLOR=#000000],[/COLOR] [COLOR=#BC8F8F]"[/COLOR][COLOR=#BC8F8F]c[/COLOR][COLOR=#BC8F8F]"[/COLOR][COLOR=#4A55DB])[/COLOR][COLOR=#000000];[/COLOR]
[COLOR=#B01813]function [PlcVal, TcErr] = AdsReadDouble(PlcVarName)
[PlcVal, TcErr] = fort("sciAdsReadDouble", PlcVarName, 1, "c", "out", [1,1], 2, "d", [1,1], 3, "i");
endfunction
function TcErr = AdsWriteDouble(PlcVarName, PlcVal)
TcErr = fort("sciAdsWriteDouble", PlcVarName, 1, "c", PlcVal, 2, "d", "out", [1,1], 3, "i");
endfunction
function y = ReadTCatToSci(idx)
if idx < 0 or idx > 7 then
y = 0;
else
PlcVarName = strcat([".TCatToSci[", string(floor(idx)), "]"]);
[y, TcErr] = AdsReadDouble(PlcVarName);
end
endfunction
function TcErr = WriteSciToTCat(idx, x)
if idx < 0 or idx > 7 then
TcErr = -1;
else
PlcVarName = strcat([".SciToTCat[", string(floor(idx)), "]"]);
[TcErr] = AdsWriteDouble(PlcVarName, x);
end
endfunction
[/COLOR][COLOR=#B01813][/COLOR]