Assign input and output variables to the user-defined function block

Use the steps to:
  • Assign four Boolean input variables to the four L70E controller inputs.
  • Assign output variables to the L70E controller outputs.
  • Map the output variables in the function block to the L70E controller outputs.
After completing the task, the ladder diagram program can detect and control the following events:
When the North-South traffic light is red, or when the North or South sensor is tripped, the traffic light in the East-West direction changes to yellow after five seconds, and then to red in two more seconds.
To assign input and output variables to a user-defined function block
  1. In the ladder editor, open the variable selector for each input variable, and then assign variables according to the following table.
    Assign variables to input variable boxes
    Boolean input variables
    Variable name
    N_CAR_SENSOR
    _IO_EM_DI_00
    S_CAR_SENSOR
    _IO_EM_DI_01
    E_CAR_SENSOR
    _IO_EM_DI_02
    W_CAR_SENSOR
    _IO_EM_DI_03
    TIP:
  2. Assign the six L70E digital outputs according to the following table.
    Assign variables to digital outputs
    Boolean Output Variables
    Variable Name
    NS_RED_LIGHTS
    _IO_EM_DO_00
    NS_YELLOW_LIGHTS
    _IO_EM_DO_01
    NS_GREEN_LIGHTS
    _IO_EM_DO_02
    EW_ RED_LIGHTS
    _IO_EM_DO_03
    EW_ YELLOW_LIGHTS
    _IO_EM_DO_04
    EW_ GREEN_LIGHTS
    _IO_EM_DO_05
    The first function block output that connects directly to the ladder rung is the function block output enabled (ENO) bit. It reflects the status of the input enable (EN) bit. The remaining six function block outputs are "real-world" outputs that connect to the red, yellow, and green traffic lights for each direction.
    When completed, the function block looks similar to the following image:
    How the function block looks like when completed
  3. (optional) Add the comments to the function block: This rung assigns the
    Micro870®
    I/O to the TRAFFIC_CONTROLLER function block.
  4. Build the project by doing one of the following:
    • From the menu bar, select
      Device
      Build
      .
    • Right-click the controller, and then select
      Build
      .
  5. In
    Output
    , view the build result.
  6. (optional) Fix any errors, and then build the project again.
  7. Save the project by doing one of the following:
    • From the menu bar, select save button.
    • From the
      File
      menu, select
      Save
      .
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal