*-----------------------------------------------------------------------------
*  PLC Window (little)
*-----------------------------------------------------------------------------
*  Module Description
*
*-----------------------------------------------------------------------------

#define /s    KL_color_black                           K +1
#define /s    KL_color_grey_10                         K +2
#define /s    KL_color_grey_20                         K +3
#define /s    KL_color_grey_40                         K +4
#define /s    KL_color_grey_60                         K +5
#define /s    KL_color_grey_80                         K +6
#define /s    KL_color_light_green                     K +7
#define /s    KL_color_yellow                          K +8
#define /s    KL_color_red                             K +9
#define /s    KL_color_green                           K +10
#define /s    KL_color_dark_blue                       K +11
#define /s    KL_color_turquoise                       K +12
#define /s    KL_color_blue                            K +13
#define /s    KL_color_purple                          K +14
#define /s    KL_color_white                           K +15

#define /s    KL_line_0                                K +0
#define /s    KL_line_1                                K +1
#define /s    KL_column_0                              K +0
#define /s    KL_column_9                              K +9
#define /s    KL_column_11                             K +11
#define /s    KL_column_17                             K +17
#define /s    KL_column_15                             K +15
#define /s    KL_column_19                             K +19

#define /s    KL_max_bar_chart                         K +150
#define /s    KL_display_without_sign_left             K +0
#define /s    KL_display_sign_right                    K +2
#define /s    KL_0_digits_after_point                  K +0
#define /s    KL_3_digits_before_point                 K +3
#define /s    KL_5_digits_before_point                 K +5
#define /s    KL_format_time_h_m_s                     K +13
#define /s    KL_error_common                          K -1
#define /s    KL_error_in_display                      K %01
#define /s    KL_error_in_queue                        K %10
#define /s    KL_inactive                              K +0
#define /s    KL_3_seconds_dwell_time                  K +12
#define /s    KL_15_seconds_delay_time                 K +30
#define /s    KL_100_percent                           K +10000
#define /s    KL_pocket_empty                          K -1
#define /s    KL_max_axis_number                       K +14
#define /s    KL_no_magazine_number                    K +0

#define /s    ML_message_in_PLC_win                    M
#define /s    ML_display_L0_L1_equal                   M
#define /s    ML_axes_in_position                      M
#define /s    ML_spindle_M5                            M
#define /s    ML_message_in_PLC_window_before          M
#define /s /r ML_initialization_ok                     M

#define /s    BL_identifier                            B
#define /s    BL_line_number                           B
#define /s    BL_not_used                              B
#define /s    BL_axis_limit                            B
#define /s    BL_Display_feed_release_flashing         B
#define /s    BL_display_message_flashing              B

#define /s /r BL_display_line                          B[2]
#define /c    BL_display_Z0                            B &BL_display_line + 0
#define /c    BL_display_Z1                            B &BL_display_line + 1

#define /s    WL_S_act_percent                         W
#define /s    WL_drive_utilization_S_absolute          W
#define /s    WL_drive_utilization_absolute            W
#define /s    WL_drive_utilization_S_old               W
#define /s    WL_TC_magazine_pocket_display            W
#define /s    WL_S_override_old                        W
#define /s    WL_F_override                            W
#define /s    WL_F_override_old                        W
#define /s    WL_Fmax_override_old                     W
#define /s    WL_message_index                         W
#define /s    WL_message_index_before                  W

#define /s    WL_motor_utilization                     W[2]
#define /c    WL_drive_utilization_0_old               W &WL_motor_utilization + 0
#define /c    WL_drive_utilization_1_old               W &WL_motor_utilization + 2

#define /s    DL_spindle_actual_rpm                    D

#include Mac_Lib.inc

EXTERN Absolute

GLOBAL PLC_Window

;----------------------------
LBL PLC_Window

  L      MG_SK_mode_line_0
  IFT
    S      MG_clear_screen
    INC    BL_display_Z0
  ENDI

  L      MG_SK_mode_line_1
  IFT
    S      MG_clear_screen
    INC    BL_display_Z1
  ENDI

  LN     MG_pulse_250_ms
  EMT

  RPLY   BL_identifier
  <>     K+0
  EMT

  SUBM   SubWindow
  =      BL_identifier
  ==     K+0
  S      PN_error_submit_spawn_queue_full

EM

;----------------------------
LBL SubWindow

  L      MG_M80_workpiece_counter_reset
  AN     NP_M4157_mode_restore_position
  IFT
    S      MG_clear_screen
    S      PN_M4092_quit_M_function

    L      K+0
    =      WG_workpiece_counter
  ENDI

  L      MG_M81_workpiece_counter_plus_1
  IFT
    S      MG_clear_screen
    S      PN_M4092_quit_M_function

    LN     NP_M4158_mode_block_scan
    IFT
      INC    WG_workpiece_counter

      L      WG_workpiece_counter
      >      K+9999
      IFT
        L      K+1
        =      WG_workpiece_counter
      ENDI
    ENDI
  ENDI

  CM     Message_in_PLC_window

  L      MG_clear_screen
  IFT
    R      MG_clear_screen
    CM     9080
    M_display_module_error

    L      K-1
    =      BL_axis_limit
    =      WL_drive_utilization_0_old
    =      WL_drive_utilization_1_old
    =      WL_drive_utilization_S_old
    =      WL_F_override_old
    =      WL_Fmax_override_old
    =      WL_S_override_old
    =      DL_spindle_actual_rpm
  ENDI

  L      ML_message_in_PLC_win
  IFT
    CM     Display_error
  ELSE

    L      BL_display_Z0
    ==     BL_display_Z1
    =      ML_display_L0_L1_equal

    L      K-1
    =      BL_line_number

    REPEAT
      INC    BL_line_number

      L      BL_display_Z0[BL_line_number]
      >      K+18
      IFT
        L      K+0
        =      BL_display_Z0[BL_line_number]
      ENDI

      CASE   BL_display_Z0[BL_line_number]
        CM     Axes_utilization        ;00  X
        CM     Axes_utilization        ;01  Y
        CM     Axes_utilization        ;02  Z
        CM     Axes_utilization        ;03  4
        CM     Axes_utilization        ;04  5
        CM     Axes_utilization        ;05  6
        CM     Axes_utilization        ;06  7
        CM     Axes_utilization        ;07  8
        CM     Axes_utilization        ;08  9
        CM     Axes_utilization        ;09  10
        CM     Axes_utilization        ;10  11
        CM     Axes_utilization        ;11  12
        CM     Axes_utilization        ;12  13
        CM     Axes_utilization        ;13  14
        CM     Nnominal_actual         ;14
        CM     S_torque                ;15
        CM     S_override              ;16
        CM     F_override              ;17
        CM     Fmax_override           ;18
      ENDC

      L      BL_line_number
      >=     KL_line_1
    UNTILT

    CM     Probe_Count_Feed_T_P
    CM     AxisLimit_Time
    CM     AxisLimit
  ENDI

  L      MG_submit_CE_key
  A      MG_machine_parameter_are_read
  CMT    Delete_error_marker

  L      MG_submit_CE_key
  S      MG_clear_screen
  R      MG_submit_CE_key

  LN     MG_commissioning
  A      ML_initialization_ok
  EMT

  CM     9019
  PL     BG_bytes_on_stack
  M_display_module_error

  L      BG_bytes_on_stack
  >      K+0
  S      PN_error_stack_not_empty

  L      ML_initialization_ok
  EMT

  LN     ML_initialization_ok
  S      ML_initialization_ok

  L      K+14
  =      BL_display_Z0

  L      K+15
  =      BL_display_Z1

EM

;----------------------------
LBL Message_in_PLC_window

  L      K-1
  =      WL_message_index

  REPEAT
    INC    WL_message_index

    L      MG_PLC_window_begin[WL_message_index]
    =      ML_message_in_PLC_win

    L      WL_message_index
    >=     K &MG_PLC_window_end - &MG_PLC_window_begin
    O      ML_message_in_PLC_win
  UNTILT

  L      BL_display_message_flashing
  >      K+0
  A      ML_message_in_PLC_win
  AN     MG_clock_3_s
  IFT
    DEC    BL_display_message_flashing
  ENDI

  L      BL_display_message_flashing
  <=     K+0
  A      MG_clock_3_s
  R      ML_message_in_PLC_win

  PS     KL_error_common
  CM     9087
  PLW
  <>     KL_error_in_queue
  A      ML_message_in_PLC_win
  A      I_ESA_control_operational
  S      PN_error_in_PLC_window
  M_display_module_error

  LN     ML_message_in_PLC_win
  R      PN_error_in_PLC_window

  L      ML_message_in_PLC_win
  XO     ML_message_in_PLC_window_before
  S      MG_clear_screen

  L      ML_message_in_PLC_win
  =      ML_message_in_PLC_window_before

  L      WL_message_index
  <>     WL_message_index_before
  IFT
    S      MG_clear_screen

    L      KL_15_seconds_delay_time
    =      BL_display_message_flashing
  ENDI

  L      WL_message_index
  =      WL_message_index_before

EM

;----------------------------
LBL Display_error

  L      WL_message_index
  X      K+2
  =X

  L      S#D100[X]
  =      SG_message_line_0

  PS     KL_line_0
  PS     KL_column_0
  PS     KL_color_red
  PS     K &SG_message_line_0
  CM     9082
  M_display_module_error

  INCX

  L      S#D100[X]
  =      SG_message_line_1

  PS     KL_line_1
  PS     KL_column_0
  PS     KL_color_red
  PS     K &SG_message_line_1
  CM     9082
  M_display_module_error

EM

;----------------------------
LBL Delete_error_marker

  L      K-1
  =X

  REPEAT
    INCX
    LX
    >=     K &MG_PLC_window_end - &MG_PLC_window_begin
    O      MG_PLC_window_begin[X]
  UNTILT

  L      MG_marker_one
  R      MG_PLC_window_begin[X]

EM

;----------------------------
LBL Axes_utilization

  REPEAT
    LN     DG_controlled_axes
    BT     BL_display_Z0[BL_line_number]
    IFT
      INC    BL_display_Z0[BL_line_number]
    ENDI

    L      DG_controlled_axes
    BT     BL_display_Z0[BL_line_number]
    O[
      L      BL_display_Z0[BL_line_number]
      >=     KL_max_axis_number
    ]
  UNTILT

  L      BL_display_Z0[BL_line_number]
  =X

  PS     WG_drive_utilization_X[X]
  CM     Absolute
  PL     WL_drive_utilization_absolute

  L      WL_drive_utilization_absolute
  ==     WL_drive_utilization_0_old[BL_line_number]
  AN     ML_display_L0_L1_equal
  EMT

  L      WL_drive_utilization_absolute
  =      WL_drive_utilization_0_old[BL_line_number]

  PS     BL_line_number
  PS     KL_color_light_green

  L      MG_gear_change_active
  IFT
    L      K+0
    =      WL_drive_utilization_absolute
  ENDI

  L      WL_drive_utilization_absolute
  >=     K+50
  IFT
    PL     BL_not_used
    PS     KL_color_yellow
  ENDI

  L      WL_drive_utilization_absolute
  >=     K+80
  IFT
    PL     BL_not_used
    PS     KL_color_red
  ENDI

  PS     KL_color_grey_20
  PS     WL_drive_utilization_absolute
  PS     KL_max_bar_chart
  CM     9083
  M_display_module_error

  PS     WL_drive_utilization_absolute
  PS     KL_display_sign_right
  PS     KL_0_digits_after_point
  PS     KL_3_digits_before_point
  PS     K &SG_chart_utilization
  CM     9051
  M_display_module_error

  L      SG_chart_utilization
  +      S"% "
  +      SG_identifier_axis_1[X]
  +      S"[Nm]"
  =      SG_chart_utilization

  PS     BL_line_number
  PS     KL_column_0
  PS     KL_color_black
  PS     K &SG_chart_utilization
  CM     9082
  M_display_module_error

EM

;----------------------------
LBL S_torque

  PS     WG_drive_utilization_S
  CM     Absolute
  PL     WL_drive_utilization_S_absolute

  L      WL_drive_utilization_S_absolute
  ==     WL_drive_utilization_S_old
  AN     ML_display_L0_L1_equal
  EMT

  L      WL_drive_utilization_S_absolute
  =      WL_drive_utilization_S_old

  PS     BL_line_number
  PS     KL_color_light_green

  L      MG_gear_change_active
  IFT
    L      K+0
    =      WL_drive_utilization_S_absolute
  ENDI

  L      WL_drive_utilization_S_absolute
  >=     K+50
  IFT
    PLX
    PS     KL_color_yellow
  ENDI

  L      WL_drive_utilization_S_absolute
  >=     K+80
  IFT
    PLX
    PS     KL_color_red
  ENDI

  L      MG_spindle_stand_still
  IFT
    PLX
    PS     KL_color_grey_10
  ENDI

  PS     KL_color_grey_20
  PS     WL_drive_utilization_S_absolute
  PS     KL_max_bar_chart
  CM     9083
  M_display_module_error

  PS     WL_drive_utilization_S_absolute
  PS     KL_display_sign_right
  PS     KL_0_digits_after_point
  PS     KL_3_digits_before_point
  PS     K &SG_chart_torque
  CM     9051
  M_display_module_error

  L      SG_chart_torque
  +      S"% SLOAD"
  =      SG_chart_torque

  PS     BL_line_number
  PS     KL_column_0
  L      MG_SK_T_torque_monitoring
  IFT
    PS     KL_color_red
  ELSE
    PS     KL_color_black
  ENDI
  PS     K &SG_chart_torque
  CM     9082
  M_display_module_error

EM

;----------------------------
LBL Nnominal_actual

  L      DG_spindle_actual_rpm
  ==     DL_spindle_actual_rpm
  AN     ML_display_L0_L1_equal
  EMT
  L      MG_3D_head_active
  IFT
    L      K+0
    =      DG_spindle_actual_rpm
  ENDI

  L      DG_spindle_actual_rpm
  =      DL_spindle_actual_rpm

  L      DG_spindle_actual_rpm
  X      K+10000
  +[
    L      NP_D356_S_programmed_rpm
    /      K+20
  ]
  /[
    L      NP_D356_S_programmed_rpm
    /      K+10
  ]
  =      WL_S_act_percent

  PS     BL_line_number
  PS     KL_color_red

  L      WL_S_act_percent
  >=     K+60
  A[
    L      WL_S_act_percent
    <=     K+120
  ]
  IFT
    PLX
    PS     KL_color_yellow
  ENDI

  L      WL_S_act_percent
  >=     K+80
  A[
    L      WL_S_act_percent
    <=     K+110
  ]
  IFT
    PLX
    PS     KL_color_light_green
  ENDI

  L      MG_spindle_stand_still
  ON     PN_M4012_S_open_control_loop
  IFT
    PLX
    PS     KL_color_grey_10
  ENDI

  PS     KL_color_grey_20

  L      WL_S_act_percent
  PSW
  <      K+0
  ON     PN_M4012_S_open_control_loop
  O      MG_gear_change_active
  O      PN_M4011_S_speed_from_MP3520_0
  IFT
    PLX
    PS     K+0
  ENDI

  PS     KL_max_bar_chart
  CM     9083
  M_display_module_error

  L      WL_S_act_percent
  PSW
  >      K+150
  IFT
    PLX
    PS     K+150
  ENDI
  PLW
  PSW
  <      K+0
  ON     PN_M4012_S_open_control_loop
  IFT
    PLX
    PS     K+0
  ENDI

  PS     KL_display_sign_right
  PS     KL_0_digits_after_point
  PS     KL_3_digits_before_point
  PS     K &SG_chart_S_actual_rpm
  CM     9051
  M_display_module_error

  L      SG_chart_S_actual_rpm
  +      S"% S-ACT"
  =      SG_chart_S_actual_rpm

  PS     BL_line_number
  PS     KL_column_0
  PS     KL_color_black
  PS     K &SG_chart_S_actual_rpm
  CM     9082
  M_display_module_error

EM

;----------------------------
LBL F_override

  L      PN_W766_factor_feed_override_PLC
  ==     K+0
  IFT
    L      NP_W494_factor_feed_override_NC
    =      WL_F_override
  ELSE
    L      PN_W766_factor_feed_override_PLC
    =      WL_F_override
  ENDI

  L      MG_SK_override_F_100
  IFT
    L      KL_100_percent
    =      WL_F_override
  ENDI

  L      WL_F_override
  ==     WL_F_override_old
  A[
    LN     MG_axes_in_position
    XO     ML_axes_in_position
  ]
  AN     ML_display_L0_L1_equal
  EMT

  L      WL_F_override
  =      WL_F_override_old

  L      MG_axes_in_position
  =      ML_axes_in_position

  PS     BL_line_number

  L      WL_F_override
  <      K+5000
  O[
    L      WL_F_override
    >=     K+12000
  ]
  IFT
    PS     KL_color_red
  ELSE
    L      WL_F_override
    <      K+8000
    O[
      L      WL_F_override
      >=     K+11000
    ]
    IFT
      PS     KL_color_yellow
    ELSE
      PS     KL_color_light_green
    ENDI
  ENDI

  L      MG_axes_in_position
  IFT
    PLX
    PS     KL_color_grey_10
  ENDI

  PS     KL_color_grey_20

  L      WL_F_override
  /      K+100
  PSW
  PS     KL_max_bar_chart
  CM     9083
  M_display_module_error

  L      WL_F_override
  /      K+100
  PSW
  PS     KL_display_sign_right
  PS     KL_0_digits_after_point
  PS     KL_3_digits_before_point
  PS     K &SG_chart_F_override
  CM     9051
  M_display_module_error

  L      SG_chart_F_override
  +      S"% F-OVR"
  =      SG_chart_F_override

  PS     BL_line_number
  PS     KL_column_0
  PS     KL_color_black
  PS     K &SG_chart_F_override
  CM     9082
  M_display_module_error

EM

;----------------------------
LBL Fmax_override

#if CFG_override_rapid_traverse_instead_spindle  = "inactive"

  INC    BL_display_Z0[BL_line_number]

EM

#endif

  L      NP_W752_rapid_traverse_override_PLC
  ==     WL_Fmax_override_old
  A[
    LN     MG_axes_in_position
    XO     ML_axes_in_position
  ]
  AN     ML_display_L0_L1_equal
  EMT

  L      NP_W752_rapid_traverse_override_PLC
  =      WL_Fmax_override_old

  L      MG_axes_in_position
  =      ML_axes_in_position

  PS     BL_line_number

  L      NP_W752_rapid_traverse_override_PLC
  <      K+5000
  O[
    L      NP_W752_rapid_traverse_override_PLC
    >=     K+12000
  ]
  IFT
    PS     KL_color_red
  ELSE
    L      NP_W752_rapid_traverse_override_PLC
    <      K+8000
    O[
      L      NP_W752_rapid_traverse_override_PLC
      >=     K+11000
    ]
    IFT
      PS     KL_color_yellow
    ELSE
      PS     KL_color_light_green
    ENDI
  ENDI

  L      MG_axes_in_position
  IFT
    PLX
    PS     KL_color_grey_10
  ENDI

  PS     KL_color_grey_20

  L      NP_W752_rapid_traverse_override_PLC
  /      K+100
  PSW
  PS     KL_max_bar_chart
  CM     9083
  M_display_module_error

  L      NP_W752_rapid_traverse_override_PLC
  /      K+100
  PSW
  PS     KL_display_sign_right
  PS     KL_0_digits_after_point
  PS     KL_3_digits_before_point
  PS     K &SG_chart_Fmax_override
  CM     9051
  M_display_module_error

  L      SG_chart_Fmax_override
  +      S"% F-MAX"
  =      SG_chart_Fmax_override

  PS     BL_line_number
  PS     KL_column_0
  PS     KL_color_black
  PS     K &SG_chart_Fmax_override
  CM     9082
  M_display_module_error

EM

;----------------------------
LBL S_override

  L      PN_W764_S_override_PLC
  ==     WL_S_override_old
  A[
    LN     MG_spindle_stand_still
    A      PN_M4012_S_open_control_loop
    XO     ML_spindle_M5
  ]
  AN     ML_display_L0_L1_equal
  EMT

  L      PN_W764_S_override_PLC
  =      WL_S_override_old

  PS     BL_line_number

  L      PN_W764_S_override_PLC
  <      K+8000
  O[
    L      PN_W764_S_override_PLC
    >=     K+11000
  ]
  IFT
    L      PN_W764_S_override_PLC
    <      K+6000
    O[
      L      PN_W764_S_override_PLC
      >=     K+12000
    ]
    IFT
      PS     KL_color_red
    ELSE
      PS     KL_color_yellow
    ENDI
  ELSE
    L      PN_W764_S_override_PLC
    <      K+6000
    O[
      L      PN_W764_S_override_PLC
      >=     K+12000
    ]
    IFT
      PS     KL_color_red
    ELSE
      PS     KL_color_light_green
    ENDI
  ENDI

  L      MG_spindle_stand_still
  ON     PN_M4012_S_open_control_loop
  =      ML_spindle_M5
  IFT
    PLX
    PS     KL_color_grey_10
  ENDI

  PS     KL_color_grey_20
  L      PN_W764_S_override_PLC
  /      K+100
  PSW
  PS     KL_max_bar_chart
  CM     9083
  M_display_module_error

  L      PN_W764_S_override_PLC
  /      K+100
  PSW
  PS     KL_display_sign_right
  PS     KL_0_digits_after_point
  PS     KL_3_digits_before_point
  PS     K &SG_chart_S_override
  CM     9051
  M_display_module_error

  L      SG_chart_S_override
  +      S"% S-OVR"
  =      SG_chart_S_override

  PS     BL_line_number
  PS     KL_column_0
  PS     KL_color_black
  PS     K &SG_chart_S_override
  CM     9082
  M_display_module_error

EM

;----------------------------
LBL Probe_Count_Feed_T_P

;Line 0, Column 11..16

  L      S"      "
  =      SG_Z0_FEED_TC_standby_pocket

#if CFG_Tool_changing_system  ! "TC_type_04"
  L      MG_TC_auto_active
  IFT
    *$WS
    L      NP_W268_tool_magazine_number
    >      KL_no_magazine_number
    IFT
      PS     NP_W268_tool_magazine_number
      PS     KL_display_without_sign_left
      PS     KL_0_digits_after_point
      PS     KL_3_digits_before_point
      PS     K &SG_TC_mag_number
      CM     9051
      M_display_module_error

      L      SG_TC_mag_number
      +      S"."
      =      SG_TC_mag_number
    ENDI

    L      MG_SK_TC_mag_load_active
    IFT
      L      STG_TC_mag[BG_TC_mag_index_Tool_Call].WG_TC_magazine_actual_pocket
      +      DG_TC_mag_1_offset_load_position[BG_TC_mag_index_Tool_Call]
      -      K+1
      MOD    STG_TC_mag[BG_TC_mag_index_Tool_Call].WG_MP7261_TC_magazine_max_pocket
      +      K+1
      =      WL_TC_magazine_pocket_display
    ELSE
      L      STG_TC_mag[BG_TC_mag_index_Tool_Call].WG_TC_magazine_actual_pocket
      =      WL_TC_magazine_pocket_display
    ENDI

    PS     WL_TC_magazine_pocket_display
    PS     KL_display_without_sign_left
    PS     KL_0_digits_after_point
    PS     KL_3_digits_before_point
    PS     K &SG_value
    CM     9051
    M_display_module_error

    L      S"P"
    +      SG_TC_mag_number
    +      SG_value
    OVWR   SG_Z0_FEED_TC_standby_pocket
  ENDI
#endif

  L      MG_display_feed_release_in_PLC_window
  IFT
    L      BL_Display_feed_release_flashing
    <=     K+0
    IFT
      L      MG_clock_1_s
      R      MG_display_feed_release_in_PLC_window
    ELSE
      DEC    BL_Display_feed_release_flashing
    ENDI
  ELSE
    L      KL_3_seconds_dwell_time
    =      BL_Display_feed_release_flashing
  ENDI

  L      MG_display_feed_release_in_PLC_window
  IFT
    L      S"FEED"
    =      SG_Z0_FEED_TC_standby_pocket
  ENDI

  PS     KL_line_0
  PS     KL_column_11

  L      MG_display_feed_release_in_PLC_window
  O      MG_TC_magazine_n_start_active
  IFT
    PS     KL_color_red
  ELSE
    PS     KL_color_black
  ENDI

  PS     K &SG_Z0_FEED_TC_standby_pocket
  CM     9082
  M_display_module_error

;Line 0, Column 17..23

  L      S"         "
  =      SG_Z0_count_probe_end_off_T_standby

#if CFG_Tool_changing_system  ! "TC_type_04"
  L      MG_TC_auto_active
  IFT
    PS     WG_T_number_standby_tool
    PS     KL_display_without_sign_left
    PS     KL_0_digits_after_point
    PS     KL_5_digits_before_point
    PS     K &SG_value
    CM     9051
    M_display_module_error

    L      WG_T_number_standby_tool
    ==     KL_pocket_empty
    IFT
      L      S"       "
      =      SG_value
    ENDI

    L      S"-T"
    +      SG_value
    OVWR   SG_Z0_count_probe_end_off_T_standby
  ENDI
#endif

  L      WG_workpiece_counter
  >      K+0
  IFT
    PS     WG_workpiece_counter
    PS     KL_display_without_sign_left
    PS     KL_0_digits_after_point
    PS     KL_5_digits_before_point
    PS     K &SG_value
    CM     9051
    M_display_module_error

    L      S"         "
    =      SG_Z0_count_probe_end_off_T_standby

    L      S" ST:"
    +      SG_value
    OVWR   SG_Z0_count_probe_end_off_T_standby
  ENDI

  L      MG_touch_probe_active
  A      MG_clock_1_s
  IFT
    L      S"  PROBE  "
    =      SG_Z0_count_probe_end_off_T_standby
  ENDI

  L      MG_auto_power_off_after_END_PGM
  AN     MG_clock_1_s
  IFT
    L      S"END OFF  "
    =      SG_Z0_count_probe_end_off_T_standby
  ENDI

  PS     KL_line_0
  PS     KL_column_17

  L      MG_touch_probe_active
  A      MG_clock_1_s
  O[
    L      MG_auto_power_off_after_END_PGM
    AN     MG_clock_1_s
  ]
  IFT
    PS     KL_color_red
  ELSE
    PS     KL_color_black
  ENDI

  PS     K &SG_Z0_count_probe_end_off_T_standby
  CM     9082
  M_display_module_error

EM

;----------------------------
LBL AxisLimit_Time

;line 1, column 11..18

  LB     MG_axis_limit_1
  ==     BL_axis_limit
  EMT

  L      MG_alternating_table_on
  IFT
    L      S"TABLE"
    =      SG_limit_table
  ELSE
    L      S"LIMIT"
    =      SG_limit_table
  ENDI

  LN     MG_axis_limit_1
  AN     MG_axis_limit_2
  AN     MG_axis_limit_3
  IFT
    L      SG_limit_table
    +      S"???"
    =      SG_limit_table
  ENDI

  L      MG_axis_limit_1
  IFT
    L      SG_limit_table
    +      S" 1 "
    =      SG_limit_table
  ENDI

  L      MG_axis_limit_2
  IFT
    L      SG_limit_table
    +      S" 2 "
    =      SG_limit_table
  ENDI

  L      MG_axis_limit_3
  IFT
    L      SG_limit_table
    +      S" 3 "
    =      SG_limit_table
  ENDI

  PS     KL_line_1
  PS     KL_column_11

  L      MG_SK_working_area_monitoring_off
  A      MG_clock_1_s
  IFT
    PS     KL_color_red
  ELSE
    PS     KL_color_yellow
  ENDI

  PS     K &SG_limit_table
  CM     9082
  M_display_module_error

;line 1, column 19..23

  L      BG_PLC_preset_number
  >      KL_inactive
  IFT
    PS     BG_PLC_preset_number
    PS     KL_display_without_sign_left
    PS     KL_0_digits_after_point
    PS     KL_3_digits_before_point
    PS     K &SG_value
    CM     9051

    M_display_module_error

    L      S"     "
    =      SG_clock_PLC_preset

    L      S"DAT"
    +      SG_value
    OVWR   SG_clock_PLC_preset

    PS     KL_line_1
    PS     KL_column_19
    PS     KL_color_yellow
    PS     K &SG_clock_PLC_preset
    CM     9082

    M_display_module_error
  ELSE
    PS     DG_real_time
    PS     K &SG_clock_PLC_preset
    PS     KL_format_time_h_m_s
    CM     9055

    M_display_module_error

    L      K+5
    =X

    L      S""
    =      SG_clock_PLC_preset^X

    PS     KL_line_1
    PS     KL_column_19
    PS     KL_color_black
    PS     K &SG_clock_PLC_preset
    CM     9082

    M_display_module_error
  ENDI

EM

;----------------------------
LBL AxisLimit

#if CFG_Pallet_changer = "PC_2_turn"   ;* KF
  L      I_PC_position_in_1
  IFT
    L      S"A "
    =      SG_pal_set
  ENDI

  L      I_PC_position_in_2
  IFT
    L      S"B "
    =      SG_pal_set
  ENDI

  L      S"PAL - "
  +      SG_pal_set
  =      SG_limit_table_dat

#else

  L      S"     "
  =      SG_limit_table_dat

#endif

  PS     KL_line_1
  PS     KL_column_19
  PS     KL_color_blue
  PS     K &SG_limit_table_dat
  CM     9082
  M_display_module_error(KG_error_module_9082)

EM
