Configure initial values for variables
Use the following steps to add initial values to the input variables that you previously created, and then assign the variables to the correct MSG_CIPGENERIC function block input parameter.
To configure initial values for variables
- Configure the initial values for the MyCtrlCfg input variable.
- In the local variable grid, expand MyCtrlCfg to view its parameters.
- In theInitial Valuecolumn, enter the values for each parameter according to the following table:Initial values for the MyCtrlCfg input variableParameterInitial ValueCommentsMyCtrlCfg.TriggerType0We only need to retrieve the catalog number once.MyCtrlcfg.StrModeLeave blankNot needed.
- Configure initial values for the MyAppCfg input variable.
- In the local variable gird, expand MyAppCfg to view its parameters.
- In theInitial Valuecolumn, enter the values for each parameter according to the following table:Initial values for the MyAppCfg input variableParameterInitial valueMyAppCfg.Service14MyAppCfg.Class01MyAppCfg.Instance01MyAppCfg.Attribute07
- Configure the initial values for the MyTargetCfg input variable.
- In the local variable grid, expand MyTargetCfg to view its parameters.
- In theInitial Valuecolumn, enter the values for each parameter according to the following table:Initial values for the MyTargetCfg input variableParameterInitial ValueCommentsMyTargetCfg.Path'4,192.168.100.4'The first '4' indicates that the message is being sent out of the embedded Ethernet port.192.168.100.4 is the IP address of the drive Ethernet interface.MyTargetCfg.CipConnMode0Unconnected is preferred for CIP messages.MyTargetCfg.UcmmTimeoutblankUnconnected messages have a timeout default of 3000 milliseconds if their Initial Values are blank.MyTargetCfg.ConnMsgTimeoutblankConnected messages have a timeout default of 3000 milliseconds if their initial values are blank.MyTargetCfg.ConnCloseFALSEFor Connected messaging, the CIP connection could be closed immediately after completion of the message instruction by setting the initial value to TRUE.The parameters in the local variable grid look similar to the following image:
- Assign the variables to the parameters.
- In the ladder diagram POU, double-click the box beside the parameter, and then select
to open the local variable grid.
- In the local variable grid, select and assign a variable to each parameter according to the following table, and then selectSelect.Initial values for parametersParameterInput variableCommentsCtrlCfgMyCtrlCfgThe catalog number must only be retrieved one time, so the MyCtrlCfg.TriggerType initial value is set to 0.AppCfgMyAppCfgThe initial values were determined by looking up the object data values for Service, Class, Instance and Attribute.TargetMyTargetCfgThe initial values are for target device configuration.ReqDataMyReqDataBecause this is a Read message, there is no request data, so the ReqData parameters are not used.ReqLengthMyReqLengthBecause this is a Read message, there is no request data, and the ReqLength parameters are not used.ResDataMyResDataThe catalog number string is stored in the array in the ODVA short string format.The first array element defines the strength length and the rest store the string character's hexadecimal value.The maximum number of characters is 80, plus the length element, so MyResData is defined as a 1 dimension array with 81 elements.The instance of the MSG_CIPGENERIC function block looks similar to the following image:
Provide Feedback