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
  1. Configure the initial values for the MyCtrlCfg input variable.
    1. In the local variable grid, expand MyCtrlCfg to view its parameters.
    2. In the
      Initial Value
      column, enter the values for each parameter according to the following table:
      Initial values for the MyCtrlCfg input variable
      Parameter
      Initial Value
      Comments
      MyCtrlCfg.TriggerType
      0
      We only need to retrieve the catalog number once.
      MyCtrlcfg.StrMode
      Leave blank
      Not needed.
  2. Configure initial values for the MyAppCfg input variable.
    1. In the local variable gird, expand MyAppCfg to view its parameters.
    2. In the
      Initial Value
      column, enter the values for each parameter according to the following table:
      Initial values for the MyAppCfg input variable
      Parameter
      Initial value
      MyAppCfg.Service
      14
      MyAppCfg.Class
      01
      MyAppCfg.Instance
      01
      MyAppCfg.Attribute
      07
  3. Configure the initial values for the MyTargetCfg input variable.
    1. In the local variable grid, expand MyTargetCfg to view its parameters.
    2. In the
      Initial Value
      column, enter the values for each parameter according to the following table:
      Initial values for the MyTargetCfg input variable
      Parameter
      Initial Value
      Comments
      MyTargetCfg.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.CipConnMode
      0
      Unconnected is preferred for CIP messages.
      MyTargetCfg.UcmmTimeout
      blank
      Unconnected messages have a timeout default of 3000 milliseconds if their Initial Values are blank.
      MyTargetCfg.ConnMsgTimeout
      blank
      Connected messages have a timeout default of 3000 milliseconds if their initial values are blank.
      MyTargetCfg.ConnClose
      FALSE
      For 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:
      How the variable grid looks like after setting the initial value
  4. Assign the variables to the parameters.
    1. In the ladder diagram POU, double-click the box beside the parameter, and then select Drop-down triangle to open the local variable grid.
    2. In the local variable grid, select and assign a variable to each parameter according to the following table, and then select
      Select
      .
      Initial values for parameters
      Parameter
      Input variable
      Comments
      CtrlCfg
      MyCtrlCfg
      The catalog number must only be retrieved one time, so the MyCtrlCfg.TriggerType initial value is set to 0.
      AppCfg
      MyAppCfg
      The initial values were determined by looking up the object data values for Service, Class, Instance and Attribute.
      Target
      MyTargetCfg
      The initial values are for target device configuration.
      ReqData
      MyReqData
      Because this is a Read message, there is no request data, so the ReqData parameters are not used.
      ReqLength
      MyReqLength
      Because this is a Read message, there is no request data, and the ReqLength parameters are not used.
      ResData
      MyResData
      The 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:
      How the MSG_CIPGENERIC function block looks like
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal