Show array of asci byts in HMI through string

dear developpers, i am using the axf2152 plc. in some c++ code I create a message that i would like to show in the HMI. since string variables can not be used as an out-port or in-port I was thinking to pass an array of bytes (ascii). in iec61131 how to put the array of bytes in a string to eventually show some text on the screen? or is there a better way to show some text created in a c++ program on the HMI screen? Is there some sample code available? kind regards nick peeters

Hi Nick, As of firmware version 2020.0, String variables can now be used as ports. ~ Martin.

dear martin, updated everything to the latest firmware. after compiling the folowiing: cmd.exe /c ““C:\\Program Files\\PHOENIX CONTACT\\PLCnCLI 2020.0 LTS/plcncli.exe” generate code -p"C:/Users/hybride/eclipse-workspace/IO_comunication_catcher” -s"src"" Generating all files with the ‘code’ generator for C:\\Users\\hybride\\eclipse-workspace\\IO_comunication_catcher. The data type ‘string’ is not known. For ports and port structures only known data types can be used. Apparently it is stil not working. I think I have to go back to my first question how to put an array of bytes in a string with iec61131? kind regards nick

Sorry, I should have been clearer. This table in the Info Center shows that C++ variables of type StaticString can be used as a port variable. This is now supported in PLCnext Engineer version 2020.0. StaticString is actually a class template, and you must declare variables of this type with a size parameter. C++ variables of type StaticString can be connected to IEC variables of type STRING, and variables of type StaticString \t\t\t \t\t`` can be connected to IEC variables of type STRING[n], where n is a positive integer. Hope this helps. ~ Martin.

dear devellopers, the upgrade to 2020 is a complete disaster. I cannot connect anny ports of the structures I created, it imediately crashes plc next engineer. with the folowing error: PLCnext Engineer, Version 2020.0 (Build 4.0.250.0) Unexpected Exception

======================================================================
Object reference not set to an instance of an object. Exception chain:
----------------------------------------------------------------------
NullReferenceException ====================================================================== Details
---------------------------------------------------------------------- NullReferenceException

Message:
------------------------------
Object reference not set to an instance of an object. Stack trace:
------------------------------
at Ade.DataList.RoleFactories.PortMemberFactory.d__17.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__19.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__17.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__18.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__17.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__19.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__17.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__19.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__17.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__19.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__17.MoveNext()
at Ade.DataList.RoleFactories.PortMemberFactory.d__6.MoveNext()
at Ade.DataList.UI.ViewModel.DatumRowViewModel.d__107.MoveNext()
at System.Linq.Enumerable.d__233.MoveNext() at System.Linq.Enumerable.d__414.MoveNext()
at System.Linq.Enumerable.d__233.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Ade.DataList.UI.ViewModel.DatumRowViewModel.GetVirtualRoleMembersToJoin(IDataList dataList, IRoleMemberFactory roleMemberFactory, ISpecification1 roleSpec)
at Ade.DataList.UI.ViewModel.DatumRowViewModel.GetJoinableRoles(String roleTypeName, IDataList dataList, IRoleMemberFactory roleMemberFactory, IRole roleToRewire)
at Ade.DataList.UI.ViewModel.DataListViewModel.CreateJoinableRolesTree(DatumRowViewModel datumViewModel, String roleTypeName)
at Ade.DataList.UI.ViewModel.DataListViewModel.OnBeginEdit(Object context, String columnName)
at Ade.TelerikIntegration.TreeBrowserControlGridViewColumn.CreateCellEditElement(GridViewCell cell, Object dataItem)
at Telerik.Windows.Controls.GridView.GridViewCell.SetEditorContent()
at Telerik.Windows.Controls.GridView.GridViewCell.ShowEditor()
at Telerik.Windows.Controls.GridView.GridViewCell.IsInEditModeChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at Telerik.Windows.Controls.GridView.GridViewDataControl.SwitchCellToEditMode(GridViewCell cell)
at Telerik.Windows.Controls.GridView.GridViewDataControl.BeginEdit(GridViewCell gridViewCell, RoutedEventArgs editEventArgs)
at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCellMouseDown(GridViewCell cell, MouseButtonEventArgs args)
at Telerik.Windows.Controls.GridView.GridViewCell.OnMouseLeftButtonDown(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseDownThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at Ade.Application.ApplicationStarter.Run()
at (String )
at PCWorxNext.Startup.Main(String args)" it takes to much time to debug this error so for the time being i would like to know how to put the character array in a string in iec61131. than I __ will downgrade back to 2019.0

Hi Nick, To convert a byte array to STRING, use the BUF_TO_STRING function block. There is information on how to use this FB in the PLCnext Engineer help system. ~ Martin.