beckhoff TE1000 — 5.9.3.3 ReadWrite

How To | Reading / Writing Data 5.9.3.2 Write | Write The Write-TcValue Cmdlet can be called via IndexGroup/IndexOffset (Raw Data), via Handle or with Symbolic Information (Symbol path or Symbol Object). If symbolic information is used, then the calls will be type safe and the write data is automatically mapped to appropriate (Plc) Data on the target side, dynamically.

Write Symbolic Data PS> $session = New-TcSession -NetId 1.2.3.4.5.6 -Port 851 PS> $projectNameSymbol = $session | Get-TcSymbol -path "*ProjectName" PS> $projectNameSymbol InstanceName DataType Size InstancePath ------------ -------- ---- ------------ ProjectName STRING(63) 64 TwinCAT_SystemInfoVarList._AppInfo.ProjectName PS> $projectNameSymbol | Read-TcValue OldProjectName PS> $projectNameSymbol | Write-TcValue -Value "NewProjectName" -force PS> $projectNameSymbol | ReadTcValue NewProjectName This example shows how to create a session, determining the Symbol 'ProjectName within the _AppInfo Struct on a running PLC project and reading its value.

After that, the Value will be overwritten with 'NewProjectName'. Write IndexGroup/IndexOffset Data Write-TcValue -session $session -IndexGroup 0x4040 -IndexOffset 0x1247A8 -Value "NewProjectName" Writes a string typed Value to the specified IndexGroup/IndexOffset Address. 5.9.3.3 ReadWrite | ReadWrite ADS ReadWrite requests send data to the ADS Server and get a Data response in one roundtrip. The Powershell command to request an ADS ReadWrite is the Send-TcReadWrite Cmdlet.

Send an ADS ReadWrite Request with IndexGroup/IndexOffset (Return Data as string) PS> Send-TcReadWrite -NetId 1.2.3.4.5.6 -Port 851 -IndexGroup SymbolValueByName -IndexOffset 0 - WriteValue "TwinCAT_SystemInfoVarList._AppInfo.ProjectName" -ReadType string -ReadLength 1024 ReadWrite access of process image on target '1.2.3.4.5.6:851': Start ReadWrite operation WriteData: 'TwinCAT_SystemInfoVarList._AppInfo.ProjectName'(IG:0xf004,IO:0 x0000,Len:47), Read: Type 'System.String' (Len:'1024) on target '1.2.3.4.5.6:851'? [Y] Yes[A] Yes to All[N] No[L] No to All[S] Suspend[?] Help(default is "Y"): y ADS_DynSymbols Sends a Read/Write request with index group 0xf004 (SymbolValueByName) and offset 0.

The write data will be initialized with the project symbol path and an returned (read) string (Default encoded) returned. Send an ADS ReadWrite Request with IndexGroup/IndexOffset (return data as byte{}) PS> Send-TcReadWrite -NetId 1.2.3.4.5.6 -Port 851 -IndexGroup SymbolValueByName - WriteValue "TwinCAT_SystemInfoVarList._AppInfo.ProjectName" -ReadLength 64 | format-hex ReadWrite access of process image on target '1.2.3.4.5.6:851': Start ReadWrite operation WriteData: 'TwinCAT_SystemInfoVarList._AppInfo.ProjectName'(IG:0xf004,IO:0 x0000,Len:47), Read: Type 'System.Byte[]' (Len:'64) on target '1.2.3.4.5.6:851'? [Y] Yes[A] Yes to All[N] No[L] No to All[S] Suspend[?] Help(default is "Y"):

y TE1000 26 Version: 1.5.0