beckhoff TX1000 — 3.2 Sample Machine with Microsoft Silverlight and JavaScript

Samples Silverlight var vUp, vDown, vProgressbar, vCount, vFast, vSlow; ... You have to adjust the URL of the TcAdsWebService as well as the NetID and the port accordingly. The objects of the user interface cannot be easily accessed. For this to work, the objects are assigned to the variables already declared above after the application is started.

function Load(sender, eventArgs) { vUp = sender.findName("pathUp"); vDown = sender.findName("pathDown"); vProgressbar = sender.findName("recProgressbar"); vCount = sender.findName("txbCount"); vFast = sender.findName("ellPointFast"); vSlow = sender.findName("ellPointSlow"); } The Load method does involve assigning the variables, but it is never called until now. This is done by changing the XAML code of the interface in Expression Blend 2. To do this, add Loaded="Load" to the topmost canvas . xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="368" Height="256" x:Name="Page" Loaded="Load" > ...

function loop(x) { Read(netId, port, '16416', '0', '86'); //send soap read request via xmlhttprequest window.setTimeout("loop("+x+")", x); } Reading a PLC variable Read(netId, nPort, indexGroup, indexOffset, cbLen) netId: string that specifies the AMS Net ID on which the PLC can be found nPort: port number of the runtime system indexGroup: IndexGroup of the PLC variable indexOffset: first byte to be written to ncbLen: number of bytes to be written function init() { b64s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; success = 0; errors = 0; loop(refresh); //send request every x seconds } Add onload="init()" to so that the method is executed during loading.

TX1000 25 Version: 1.2