Using IEC Objects for IO mapping

Hi

How is the intended use of the IEC Objects for IO-mapping?
I am using a CC100. When referencing the OnboardIO in the program I get a System.NullReferenceException when building.

Writing to the variables and calling the FB cyclically gives the same error message.

OnboardIO.X5_DO := 1;
OnboardIO(
	X12_DI=> , 
	X13_PT1_X13_PT1_=> , 
	X13_PT2_X13_PT2_=> , 
	X14_AI1=> , 
	X14_AI2=> , 
	X5_DO:= , 
	X6_AO1:= , 
	X6_AO2:= );
                ------ Build started: Application: Device.InnovationRoomCC100 -------
                Typify code...
[ERROR]         Internal error:System.NullReferenceException: Object reference not set to an instance of an object.    at _3S.CoDeSys.LanguageModelManager.DirectVariableWrapper..ctor(IDirectVariable dirvar, IVariable2 var)    at _3S.CoDeSys.LanguageModelManager.DirVarLocationTable.TryGetLocationInfo(IDirectVariable dirvar, IVariable2 var, _IDirectLocationInfo& dirlocinfo)    at _3S.CoDeSys.Compiler35190.Phase3_Location.Locator.(_ICompileContext , IMessage& , Boolean& , ISourcePosition , IDirectVariable , IVariable2 a)    at _3S.CoDeSys.LanguageModelManager.CompileContext.LocateAddress(Boolean& bError, IDirectVariable dirvar)    at _3S.CoDeSys.DeviceObject.TaskMapList.Add(Int32 iTaskNbr, VariableCrossRef cref, ICompileContext comcon, VariableDeclaration vd, Int32 nParamBitOffset, Int32 nAddrBitOffset, Int32 nBitSize, String stBaseType, DoubleAddressTaskChecker checker, IDataElement dataElement)    at _3S.CoDeSys.DeviceObject.LanguageModelHelper.GetTaskMappings(Int32 iTaskNbr, AddrToChannelMap map, TaskMapList taskmaplist, DoubleAddressTaskChecker checker, LList`1 directVarCRefList, VariableCrossRef[] variableCRefList, FixedTaskUpdate[] fixedTaskUpdates, ICompileContext comcon, Hashtable htStartAddresses, Boolean bAlwaysMapToNew, Boolean bShowAsError)    at _3S.CoDeSys.DeviceObject.DeviceObject.AddLateLanguageModel(Int32 nProjectHandle, AddLanguageModelEventArgs e)    at _3S.CoDeSys.DeviceObject.DeviceObjectHelper.OnLanguageModelMgr_AddLateLanguageModel(Object sender, AddLanguageModelEventArgs e)    at _3S.CoDeSys.Core.LanguageModel.AddLanguageModelEventHandler.Invoke(Object sender, AddLanguageModelEventArgs e)    at _3S.CoDeSys.Core.LanguageModel.AddLanguageModelEventHandler.Invoke(Object sender, AddLanguageModelEventArgs e)    at _3S.CoDeSys.LanguageModelManager.LanguageModelManagerConsolidated.OnAddLateLanguageModel(AddLanguageModelEventArgs e)    at _3S.CoDeSys.Compiler35190.CompilerPhases.CompilerPhase3_Locator.()    at ..()    at ..()
                Build complete -- 1 errors, 2 warnings : No download possible

The IO can be mapped in the other tab ‘Onboard-IO I/O Mapping’ by entering a variable name in the table. Is this what you are looking to do?

Thanks for the Reply @WagoKurt!
And sorry for my late response. Let me give some more details to my questions. I am aware of the IO-mapping, however I was hoping that the tab for “Onboard-IO IEC Objects” would provide me a way to do the IO-mapping from my plc code without all the clicking involved in the normal mapping.

Its been a while since I used Codesys and I think the tab for “IEC Objects” is new?

Onboard-IO is my name for the onboard IO of the CC100.

When typing OnboardIO. in PLC_PRG Autocomplete gives me suggestions

image

The instance is also visible in the input assistance

Maybe I am wrong, but I assume that the point of this object is to be able to map my IO from the PLC code, which is exactly what I want. For example by writing

OnboardIO.X5_DO.0 := PumpStart;

Or by calling the body of the function block with the correct


OnboardIO(
	X12_DI=> , 
	X13_PT1_X13_PT1_=> , 
	X13_PT2_X13_PT2_=> , 
	X14_AI1=> , 
	X14_AI2=> , 
	X5_DO:= , 
	X6_AO1:= , 
	X6_AO2:= );

However, when I try to build the program I get the following exception

------ Build started: Application: Device.InnovationRoomCC100 -------
                Typify code...
[ERROR]         Internal error:System.NullReferenceException: Object reference not set to an instance of an object.    at _3S.CoDeSys.LanguageModelManager.DirectVariableWrapper..ctor(IDirectVariable dirvar, IVariable2 var)    at _3S.CoDeSys.LanguageModelManager.DirVarLocationTable.TryGetLocationInfo(IDirectVariable dirvar, IVariable2 var, _IDirectLocationInfo& dirlocinfo)    at _3S.CoDeSys.Compiler35190.Phase3_Location.Locator.(_ICompileContext , IMessage& , Boolean& , ISourcePosition , IDirectVariable , IVariable2 a)    at _3S.CoDeSys.LanguageModelManager.CompileContext.LocateAddress(Boolean& bError, IDirectVariable dirvar)    at _3S.CoDeSys.DeviceObject.TaskMapList.Add(Int32 iTaskNbr, VariableCrossRef cref, ICompileContext comcon, VariableDeclaration vd, Int32 nParamBitOffset, Int32 nAddrBitOffset, Int32 nBitSize, String stBaseType, DoubleAddressTaskChecker checker, IDataElement dataElement)    at _3S.CoDeSys.DeviceObject.LanguageModelHelper.GetTaskMappings(Int32 iTaskNbr, AddrToChannelMap map, TaskMapList taskmaplist, DoubleAddressTaskChecker checker, LList`1 directVarCRefList, VariableCrossRef[] variableCRefList, FixedTaskUpdate[] fixedTaskUpdates, ICompileContext comcon, Hashtable htStartAddresses, Boolean bAlwaysMapToNew, Boolean bShowAsError)    at _3S.CoDeSys.DeviceObject.DeviceObject.AddLateLanguageModel(Int32 nProjectHandle, AddLanguageModelEventArgs e)    at _3S.CoDeSys.DeviceObject.DeviceObjectHelper.OnLanguageModelMgr_AddLateLanguageModel(Object sender, AddLanguageModelEventArgs e)    at _3S.CoDeSys.Core.LanguageModel.AddLanguageModelEventHandler.Invoke(Object sender, AddLanguageModelEventArgs e)    at _3S.CoDeSys.Core.LanguageModel.AddLanguageModelEventHandler.Invoke(Object sender, AddLanguageModelEventArgs e)    at _3S.CoDeSys.LanguageModelManager.LanguageModelManagerConsolidated.OnAddLateLanguageModel(AddLanguageModelEventArgs e)    at _3S.CoDeSys.Compiler35190.CompilerPhases.CompilerPhase3_Locator.()    at ..()    at ..()
                Build complete -- 1 errors, 2 warnings : No download possible

So my questions are:

  • What is the intention of the object instance named OnboardIO of type OnboardIO_FB in my application?
  • If it is for mapping my IO from PLC-code. How am I supposed to use it?

From the Device tab, go to PLC Settings and turn on “enable symbolic access for I/O”. Then you can use the IEC object.