Příklad


Ukázka aplikace v Control Webu, monitorující základní parametry stanice Promos RT pomocí standardního AT-modemu (s použitím ovladače CWDRTMOD).

Soubor RTMODEM.PAR

[COM]
  DRIVER SYSTEM 2
  IRQ 3
  BASE $02F8
  BAUD 19200
  BITS 8
  PARITY NONE
  STOP 1
  OPTIONS 32
  BUFFER_SIZE 1024
END

[MODEM]
{ prikazy pro volajici modem }
{ -------------------------- }
INIT ATE0V1X3&C1&R1&D0H0S0=0#~  { inicializacni prikaz modemu }
INIT_OK #@OK#@             { spravna odpoved na inicializaci }
INIT_TIME 5.0              { maximalni cas pro odpoved }
CONNECT ATDT               { prikaz pro navazani spojeni:
                                 ATDP ..... dial pulse (pulsni volba)
                                 ATDT ..... dial tone  (tonova volba)
                             cely prikaz bude proveden najednou slozenim
                             promennych
                                CONNECT + CUNNECT_NUMBER + CONNECT_ENDCHAR }
CONNECT_ENDCHAR #          { ukoncovaci znak pro prikaz navazani spojeni }
CONNECT_OK CONNECT         { spravna odpoved - spojeni bylo provedeno }
CONNECT_TIME 90.0          { maximalni cas pro provedeni spojeni modemu }
LINEOFF ~~+++~~ATH0#~~     { prikaz pro uzavreni spojeni modemu - zaveseni linky }
LINEOFF_OK #@OK#@          { spravna odpoved na zaveseni linky }
LINEOFF_TIME 3.0           { maximalni cas pro prikaz zaveseni linky }

{ prikazy pro ovladani volaneho modemu }
{ ------------------------------------ }
CONNECT_ANSWER ATA#        { prikaz pro provedeni spojeni modemu }
ANSWER_TIME 30.0           { maximalni cas pro prikaz spojeni }
CONNECT_RING #@RING#@      { zprava rikajici: NEKDO ZVONI !!! }
RING_COUNT 3               { pocet zvoneni, po kterych je proveden prikaz
                             CONNECT_ANSWER }
RING_TIME 10.0             { maximalni cas mezi jednotlivymi zpravami RING,
                             pri prekroceni casu je snulovano pocitadlo
                             zvoneni }
END

[GLOBAL]
  PREFIX $E1 $5C
  SUFFIX NONE
  PRESUFFIX NONE
  ADDRESS $00
  ANSWER_TIME 5.0
  SILENCE_WAIT 500
  RTS_TIME_ON 300
  RTS_TIME_OFF 200
  DEF_ANALOG_IN_ADDR $D61A
  NUM_VARDIS_ERR 3
  STOP_SELF_READING ON
  IDLE_TIME 10
  SLEEP_TIME 0
  SLEEP_COUNT 100
END

[STATION]
  ADDRESS 01
  RETRANSLATION 01
  NAME "PROMOS" ""
  PHONE 0321,722701
  NUM_BINAR_IN 40
  NUM_BINAR_OUT 8
  NUM_ANALOG_IN 16
  NUM_COUNTER_IN 0
  NUM_MEMORY_IN 4
  NUM_MEMORY_OUT 0
  BINAR_IN_XOR NONE
  BINAR_OUT_XOR NONE
  DEF_ANALOG_IN_ADDR FROM_GLOBAL
  DEF_MEMORY_IN
    1   $0001       { $0001-$0040 = AD }
    2   $0002
    3   $0003
    4   $0004
  DEF_MEMORY_END
  DEF_MEMORY_OUT NONE
  DEF_COUNTER_IN NONE
  ORIGINAL_CHANNELS
END

Soubor RTMODEM.DMF

begin
   1 -  96  boolean input     
  97 - 192  boolean output
 193 - 256  real input
 257 - 304  real input
 305 - 404  real bidirectional
 405 - 434  real input
 450 - 459  real input
 460 - 463  boolean output
 464 - 465  boolean input
 466 - 470  boolean bidirectional
 471        boolean output
 472        boolean output
 473        boolean output
 474        boolean output
 475        boolean output
 476        boolean output
 477 - 478  boolean input
 479 - 499  real input
 60000 shortcard output
 60001 shortcard output
 60002 cardinal output
 60003 boolean output
 60004 - 60009 shortcard input
 60010 - 60017 real input
 65533 - 65534  real output
 65535  boolean output
end.

Soubor RTMODEM.CW

directories
  '*.dbf' = '.\DBF';
end_directories;

settings
  operation_mode = real_time;
  independent_procedure_execution = true;
end_settings;

const
  crok = 0;
  cmes = 1;
  cden = 2;
  chod = 3;
  cmin = 4;
  csec = 5;
end_const;

var
  stoppp = boolean, false;
  make_read_ai = boolean, false;
  make_read_mi = boolean, false;
  make_read_bi = boolean, false;
  make_write = boolean, false;
  make_restart = boolean, false;
  nul_new_bi = boolean, false;
  nul_new_ai = boolean, false;
  nul_new_chyba_rizeni = boolean, false;
  nul_new_mi = boolean, false;
  time_ai = array[ crok..csec ] of cardinal, 0;
  time_bi = array[ crok..csec ] of cardinal, 0;
end_var;

driver
  v = 'cwdrtmod.DLL', 'RTMODEM.DMF', 'RTMODEM.PAR';
end_driver;

channel
  ai1 = real, 193, v, input;
  ai1a = real, 201, v, input;
  ai2 = real, 194, v, input;
  ai2a = real, 202, v, input;
  ai3 = real, 195, v, input;
  ai3a = real, 203, v, input;
  ai4 = real, 196, v, input;
  ai4a = real, 204, v, input;
  ai5 = real, 197, v, input;
  ai5a = real, 205, v, input;
  ai6 = real, 198, v, input;
  ai6a = real, 206, v, input;
  ai7 = real, 199, v, input;
  ai7a = real, 207, v, input;
  ai8 = real, 200, v, input;
  ai8a = real, 208, v, input;
  bi1 = boolean, 1, v, input;
  bi2 = boolean, 2, v, input;
  bi3 = boolean, 3, v, input;
  bi4 = boolean, 4, v, input;
  bi5 = boolean, 5, v, input;
  bi6 = boolean, 6, v, input;
  bi7 = boolean, 7, v, input;
  bi8 = boolean, 8, v, input;
  biX =  array[ 9..40 ] of boolean, v, input;
  bo1 = boolean, 97, v, output, false;
  bo2 = boolean, 98, v, output, false;
  bo3 = boolean, 99, v, output, false;
  bo4 = boolean, 100, v, output, false;
  bo5 = boolean, 101, v, output, false;
  bo6 = boolean, 102, v, output, false;
  bo7 = boolean, 103, v, output, false;
  bo8 = boolean, 104, v, output, false;
  errors_counter = real, 454, v, input;
  errors_no_answer = real, 450, v, input;
  komunikace = boolean, 464, v, input;
  last_com_error = boolean, 465, v, input;
  mi1 = real, 405, v, input;
  mi2 = real, 406, v, input;
  mi3 = real, 407, v, input;
  mi4 = real, 408, v, input;
  modem_connect = boolean, 476, v, output, false;
  modem_connected = boolean, 478, v, input;
  modem_connecting = boolean, 477, v, input;
  new_ai = boolean, 467, v, bidirectional, false;
  new_bi = boolean, 466, v, bidirectional, false;
  new_chyba_rizeni = boolean, 470, v, bidirectional, false;
  new_mi = boolean, 469, v, bidirectional, false;
  read_ai = boolean, 475, v, output, false;
  read_bi = boolean, 472, v, output, false;
  read_mi = boolean, 473, v, output, false;
  silencetime = real, 452, v, input;
  stav_linky = real, 495, v, input;
  transmit_messages = real, 490, v, input;
  transmit_messages_prior = real, 497, v, input;
  write_bo = boolean, 462, v, output, false;
  write_restart = boolean, 471, v, output, false;
end_channel;

timer
end_timer;

instrument

  window panel panel_1;
    owner = background;
    position = 17, 42, 766, 517;
    win_disable = zoom, maximize;
    win_title = 'PROMOS RT - AT-MODEM test';
  end_panel;

  label id_2;
    owner = panel_1;
    position = 283, 403;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'write            read';
  end_label;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 338, 258, 80, 141;
    expression = transmit_messages;
    mode = vertical_bar;
    content = med;
    range_to = 20;
    low_limit = 10;
    high_limit = 15;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  switch id_3;
    owner = panel_1;
    position = 619, 13, 137, 25;
    output = make_read_mi;
    mode = text_button;
    true_text = 'MI';
    false_text = 'MI';
    receivers = prg_make_read_mi;
    mono = 0.1, true;
    colors
      false_paper = green;
    end_colors;
  end_switch;

  switch id_3;
    owner = panel_1;
    position = 505, 19, 34, 25;
    output = nul_new_mi;
    mode = text_button;
    true_text = 'NUL';
    false_text = 'NUL';
    receivers = prg_nul_mi;
    mono = 0.1, true;
  end_switch;

  indicator id_1;
    timer = 0.1;
    owner = panel_1;
    position = 540, 5;
    expression = new_mi;
  end_indicator;

  label id_2;
    owner = panel_1;
    position = 404, 6;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'see .PAR     New Data';
  end_label;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 330, 9, 71, 16;
    expression = mi4;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 255, 9, 71, 16;
    expression = mi3;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 180, 9, 71, 16;
    expression = mi2;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 105, 9, 71, 16;
    expression = mi1;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  label id_2;
    owner = panel_1;
    position = 8, 9;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'memory inputs';
  end_label;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 9, 67, 71, 16;
    expression = ai1a;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 84, 67, 71, 16;
    expression = ai2a;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 159, 67, 71, 16;
    expression = ai3a;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 234, 67, 71, 16;
    expression = ai4a;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 309, 67, 71, 16;
    expression = ai5a;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 384, 67, 71, 16;
    expression = ai6a;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 459, 67, 71, 16;
    expression = ai7a;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 534, 67, 71, 16;
    expression = ai8a;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  label id_2;
    owner = panel_1;
    position = 273, 428;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'Connecting...';
    text = '(spojuje se)';
  end_label;

  label id_2;
    owner = panel_1;
    position = 204, 428;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'ON LINE';
    text = '(spojeno)';
  end_label;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 289, 461;
    expression = modem_connecting;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 214, 461;
    expression = modem_connected;
  end_indicator;

  label id_2;
    owner = panel_1;
    position = 135, 437;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'connect';
  end_label;

  switch id_3;
    owner = panel_1;
    position = 136, 453, 48, 48;
    output = modem_connect;
    true_text = 'WRITE DATA';
    false_text = 'WRITE DATA';
    colors
      false_paper = lred;
    end_colors;
  end_switch;

  multi_label id_1;
    timer = 0.05;
    owner = panel_1;
    position = 8, 423;
    frame = 1;
    item
      font = 'MS Sans Serif (Central European)', 8, bold;
      text = 'free';
      expression = stav_linky = 0;
      paper = lgray;
      ink = black;
      blink_paper = white;
      blink_ink = red;
    end_item;
    item
      font = 'MS Sans Serif (Central European)', 8, bold;
      text = 'transmit';
      expression = stav_linky = 1;
      paper = lgray;
      ink = black;
      blink_paper = white;
      blink_ink = red;
    end_item;
    item
      font = 'MS Sans Serif (Central European)', 8, bold;
      text = 'receive';
      expression = stav_linky = 2;
      paper = lgray;
      ink = black;
      blink_paper = white;
      blink_ink = red;
    end_item;
    item
      font = 'MS Sans Serif (Central European)', 8, bold;
      text = 'silence';
      expression = stav_linky = 3;
      paper = lgray;
      ink = black;
      blink_paper = white;
      blink_ink = red;
    end_item;
    item
      font = 'MS Sans Serif (Central European)', 8, bold;
      text = 'answer AH';
      expression = stav_linky = 5;
      paper = lgray;
      ink = black;
      blink_paper = white;
      blink_ink = red;
    end_item;
    item
      font = 'MS Sans Serif (Central European)', 8, bold;
      text = 'error';
      expression = stav_linky = 255;
      paper = lgray;
      ink = black;
      blink_paper = white;
      blink_ink = red;
    end_item;
  end_multi_label;

  label id_2;
    owner = panel_1;
    position = 8, 407;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'line state';
  end_label;

  switch id_3;
    owner = panel_1;
    position = 13, 474, 61, 28;
    output = stoppp;
    mode = text_button;
    true_text = 'STOP';
    false_text = 'STOP';
    receivers = prg_stop;
    mono = 0.1, true;
    colors
      false_paper = red;
      false_ink = lyellow;
    end_colors;
  end_switch;

  indicator id_1;
    timer = 0.5;
    owner = panel_1;
    position = 1, 484;
    expression = hsec > 50;
    font = 'Arial (Central European)', 18, bolditalic;
    true_text = '.';
    font = 'Arial (Central European)', 18, bolditalic;
    false_text = '.';
    colors
      true_tshadow = lgray;
      true_bshadow = lgray;
      false_ink = white;
      false_tshadow = lgray;
      false_bshadow = lgray;
    end_colors;
  end_indicator;

  chart graf;
    owner = panel_1;
    position = 457, 407, 300, 101;
    mode = flow_graph;
    range_from = -50;
    range_to = 150;
    low_limit = -20;
    history = 75;
    item
      expression = ai1;
      color = white;
    end_item;
    item
      expression = ai2;
      color = lyellow;
    end_item;
    item
      expression = ai3;
      color = lmagenta;
    end_item;
    item
      expression = ai4;
      color = lred;
    end_item;
    item
      expression = ai5;
      color = lcyan;
    end_item;
    item
      expression = ai6;
      color = lgreen;
    end_item;
    item
      expression = ai7;
      color = lblue;
    end_item;
    item
      expression = ai8;
      color = lgray;
    end_item;
  end_chart;

  archiver analogy;
    owner = panel_1;
    position = 639, 369, 119, 28;
    win_title = 'Archiv analogu';
    file_name = 'AI_';
    file_length = month;
    item
      name = 'AD1';
      type = numeric;
      length = 5;
      dec_places = 1;
      expression = ai1;
    end_item;
    item
      name = 'AD2';
      type = numeric;
      length = 5;
      dec_places = 1;
      expression = ai2;
    end_item;
    item
      name = 'AD3';
      type = numeric;
      length = 5;
      dec_places = 1;
      expression = ai3;
    end_item;
    item
      name = 'AD4';
      type = numeric;
      length = 5;
      dec_places = 1;
      expression = ai4;
    end_item;
    item
      name = 'AD5';
      type = numeric;
      length = 5;
      dec_places = 1;
      expression = ai5;
    end_item;
    item
      name = 'AD6';
      type = numeric;
      length = 5;
      dec_places = 1;
      expression = ai6;
    end_item;
    item
      name = 'AD7';
      type = numeric;
      length = 5;
      dec_places = 1;
      expression = ai7;
    end_item;
    item
      name = 'AD8';
      type = numeric;
      length = 5;
      dec_places = 1;
      expression = ai8;
    end_item;
  end_archiver;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 737, 274, 27, 27;
    expression = time_bi[ csec ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 709, 274, 27, 27;
    expression = time_bi[ cmin ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 681, 274, 27, 27;
    expression = time_bi[ chod ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 627, 274, 48, 27;
    expression = time_bi[ crok ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 599, 274, 27, 27;
    expression = time_bi[ cmes ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 571, 274, 27, 27;
    expression = time_bi[ cden ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  switch id_3;
    owner = panel_1;
    position = 620, 103, 136, 48;
    output = make_read_bi;
    mode = text_button;
    true_text = 'READ BINARS';
    false_text = 'READ BINARS';
    receivers = prg_make_read_bi;
    mono = 0.1, true;
    colors
      false_paper = green;
    end_colors;
  end_switch;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 737, 315, 27, 27;
    expression = time_ai[ csec ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 709, 315, 27, 27;
    expression = time_ai[ cmin ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 681, 315, 27, 27;
    expression = time_ai[ chod ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 627, 315, 48, 27;
    expression = time_ai[ crok ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 599, 315, 27, 27;
    expression = time_ai[ cmes ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 571, 315, 27, 27;
    expression = time_ai[ cden ];
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  switch id_3;
    owner = panel_1;
    position = 433, 361, 34, 25;
    output = nul_new_chyba_rizeni;
    mode = text_button;
    true_text = 'NUL';
    false_text = 'NUL';
    receivers = prg_nul_chyba_rizeni;
    mono = 0.1, true;
  end_switch;

  switch id_3;
    owner = panel_1;
    position = 433, 317, 34, 25;
    output = nul_new_ai;
    mode = text_button;
    true_text = 'NUL';
    false_text = 'NUL';
    receivers = prg_nul_ai;
    mono = 0.1, true;
  end_switch;

  switch id_3;
    owner = panel_1;
    position = 433, 274, 34, 25;
    output = nul_new_bi;
    mode = text_button;
    true_text = 'NUL';
    false_text = 'NUL';
    receivers = prg_nul_bi;
    mono = 0.1, true;
  end_switch;

  label id_2;
    owner = panel_1;
    position = 510, 359;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'Error of control';
    text = '(voltage startup)';
  end_label;

  indicator id_1;
    timer = 0.1;
    owner = panel_1;
    position = 471, 352;
    expression = new_chyba_rizeni;
  end_indicator;

  label id_2;
    owner = panel_1;
    position = 510, 320;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'Analog In';
  end_label;

  label id_2;
    owner = panel_1;
    position = 473, 244;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'New Data';
  end_label;

  label id_2;
    owner = panel_1;
    position = 510, 280;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'Binary In';
  end_label;

  indicator id_1;
    timer = 0.1;
    owner = panel_1;
    position = 471, 264;
    expression = new_bi;
  end_indicator;

  indicator id_1;
    timer = 0.1;
    owner = panel_1;
    position = 471, 308;
    expression = new_ai;
  end_indicator;

  switch id_3;
    owner = panel_1;
    position = 620, 217, 136, 48;
    output = make_restart;
    mode = text_button;
    true_text = 'WRITE RESTART';
    false_text = 'WRITE RESTART';
    receivers = prg_make_restart;
    mono = 0.1, true;
    colors
      false_paper = lred;
    end_colors;
  end_switch;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 253, 258, 80, 141;
    expression = transmit_messages_prior;
    mode = vertical_bar;
    content = med;
    range_to = 20;
    low_limit = 10;
    high_limit = 15;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  label id_2;
    owner = panel_1;
    position = 283, 243;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'messages in buffer';
  end_label;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 146, 275, 62, 27;
    expression = silencetime;
    mode = text_display;
    range_from = -9999;
    range_to = 999999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    mask = '@@@@@';
    colors
      ink = black;
    end_colors;
  end_meter;

  label id_2;
    owner = panel_1;
    position = 118, 243;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'time from last mess';
    text = '    (silence time)';
  end_label;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 188, 371, 57, 27;
    expression = errors_no_answer;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    mask = '@@@@@';
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 188, 340, 57, 27;
    expression = errors_counter;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 0;
    font = 'Courier New (Central European)', 12, bold;
    mask = '@@@@@';
    colors
      ink = black;
    end_colors;
  end_meter;

  label id_2;
    owner = panel_1;
    position = 98, 318;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'error counter';
    text = ' ';
    text = '   - in mess';
    text = ' ';
    text = '   - no answer';
  end_label;

  label id_2;
    owner = panel_1;
    position = 8, 318;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'error in last';
    text = 'communication';
  end_label;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 32, 350;
    expression = last_com_error;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 32, 260;
    expression = komunikace;
  end_indicator;

  label id_2;
    owner = panel_1;
    position = 8, 242;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'wait for answer';
  end_label;

  switch id_3;
    owner = panel_1;
    position = 620, 43, 136, 48;
    output = make_read_ai;
    mode = text_button;
    true_text = 'READ ANALOGS';
    false_text = 'READ ANALOGS';
    receivers = prg_make_read_ai;
    mono = 0.1, true;
    colors
      false_paper = green;
    end_colors;
  end_switch;

  switch id_3;
    owner = panel_1;
    position = 620, 160, 136, 48;
    output = make_write;
    mode = text_button;
    true_text = 'WRITE DATA';
    false_text = 'WRITE DATA';
    receivers = prg_make_write;
    mono = 0.1, true;
    colors
      false_paper = lred;
    end_colors;
  end_switch;

  switch id_2;
    owner = panel_1;
    position = 546, 160, 48, 48;
    output = bo8;
    true_icon = 'JEDNA.ICO';
    false_icon = 'NULA.ICO';
  end_switch;

  switch id_2;
    owner = panel_1;
    position = 471, 160, 48, 48;
    output = bo7;
    true_icon = 'JEDNA.ICO';
    false_icon = 'NULA.ICO';
  end_switch;

  switch id_2;
    owner = panel_1;
    position = 396, 160, 48, 48;
    output = bo6;
    true_icon = 'JEDNA.ICO';
    false_icon = 'NULA.ICO';
  end_switch;

  switch id_2;
    owner = panel_1;
    position = 321, 160, 48, 48;
    output = bo5;
    true_icon = 'JEDNA.ICO';
    false_icon = 'NULA.ICO';
  end_switch;

  switch id_2;
    owner = panel_1;
    position = 246, 160, 48, 48;
    output = bo4;
    true_icon = 'JEDNA.ICO';
    false_icon = 'NULA.ICO';
  end_switch;

  switch id_2;
    owner = panel_1;
    position = 171, 160, 48, 48;
    output = bo3;
    true_icon = 'JEDNA.ICO';
    false_icon = 'NULA.ICO';
  end_switch;

  switch id_2;
    owner = panel_1;
    position = 96, 160, 48, 48;
    output = bo2;
    true_icon = 'JEDNA.ICO';
    false_icon = 'NULA.ICO';
  end_switch;

  switch id_2;
    owner = panel_1;
    position = 21, 160, 48, 48;
    output = bo1;
    true_icon = 'JEDNA.ICO';
    false_icon = 'NULA.ICO';
  end_switch;

  label id_2;
    owner = panel_1;
    position = 8, 140;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'binary outputs';
  end_label;

  label id_2;
    owner = panel_1;
    position = 8, 82;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'binary inputs';
  end_label;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 551, 100;
    expression = bi8;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 476, 100;
    expression = bi7;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 401, 100;
    expression = bi6;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 326, 100;
    expression = bi5;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 251, 100;
    expression = bi4;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 176, 100;
    expression = bi3;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 101, 100;
    expression = bi2;
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_1;
    position = 26, 100;
    expression = bi1;
  end_indicator;

  label id_2;
    owner = panel_1;
    position = 8, 31;
    font = 'MS Sans Serif (Central European)', 8, bold;
    text = 'analog inputs';
  end_label;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 534, 49, 71, 16;
    expression = ai8;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 459, 49, 71, 16;
    expression = ai7;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 384, 49, 71, 16;
    expression = ai6;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 309, 49, 71, 16;
    expression = ai5;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 234, 49, 71, 16;
    expression = ai4;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 159, 49, 71, 16;
    expression = ai3;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 84, 49, 71, 16;
    expression = ai2;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  meter id_1;
    timer = 1;
    owner = panel_1;
    position = 9, 49, 71, 16;
    expression = ai1;
    mode = text_display;
    range_from = -9999;
    range_to = 9999;
    dec_places = 1;
    font = 'Courier New (Central European)', 12, bold;
    colors
      ink = black;
    end_colors;
  end_meter;

  window monitor id_2;
    owner = background;
    position = 9, 163, 445, 275;
    watch
      channel = biX[ 9 ];
    end_watch;
  end_monitor;

  window panel panel_2;
    timer = 1;
    owner = background;
    position = 9, 27, 356, 83;
  end_panel;

  indicator id_1;
    timer = 1;
    owner = panel_2;
    position = 12, 11;
    expression = biX[ 9 ];
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_2;
    position = 52, 11;
    expression = biX[ 10 ];
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_2;
    position = 92, 11;
    expression = biX[ 11 ];
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_2;
    position = 132, 11;
    expression = biX[ 12 ];
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_2;
    position = 172, 11;
    expression = biX[ 13 ];
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_2;
    position = 212, 11;
    expression = biX[ 14 ];
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_2;
    position = 252, 11;
    expression = biX[ 15 ];
  end_indicator;

  indicator id_1;
    timer = 1;
    owner = panel_2;
    position = 292, 11;
    expression = biX[ 16 ];
  end_indicator;

  program prg_make_read_ai;
    
    procedure OnActivate();
    begin
      if make_read_ai then
        read_ai = not read_ai;    (* nastartuje prenos *)
        repeat
          pause 0;
        until komunikace;         (* pocka, az zacne komunikace *)
        repeat
          pause 0;
        until not komunikace;     (* pocka, az dokonci komunikaci *)
        if new_ai then            (* prisly nova data ? *)
          time_ai[crok] = year;
          time_ai[cmes] = month;
          time_ai[cden] = day;
          time_ai[chod] = hour;
          time_ai[cmin] = minute;
          time_ai[csec] = second; (* ano -> zmeni posledni cas nacteni *)
          pause 1;                (* pocka, aby uz data byly prekodovany do kanalu *)
          analogy.DoArchive();    (* a provede zapis na disk *)
          send graf;              (* a pohne rolujicim grafem *)
          new_ai = false;         (* na konec shodi "flag" novych dat *)
        end;
      end;
    end_procedure;
    
  end_program;

  program prg_make_read_bi;
    
    procedure OnActivate();
    begin
      if make_read_bi then
        read_bi = not read_bi;
        repeat
          pause 0;
        until komunikace;
        repeat
          pause 0;
        until not komunikace;
        if new_bi then
          time_bi[crok] = year;
          time_bi[cmes] = month;
          time_bi[cden] = day;
          time_bi[chod] = hour;
          time_bi[cmin] = minute;
          time_bi[csec] = second;
        end;
      end;
    end_procedure;
    
  end_program;

  program prg_make_write;
    
    procedure OnActivate();
    begin
      if make_write then
        write_bo = not write_bo;
      end;
    end_procedure;
    
  end_program;

  program prg_make_restart;
    
    procedure OnActivate();
    begin
      if make_restart then
        write_restart = not write_restart;
      end;
    end_procedure;
    
  end_program;

  program prg_nul_ai;
    
    procedure OnActivate();
    begin
      if nul_new_ai then
        new_ai = false;
      end;
    end_procedure;
    
  end_program;

  program prg_nul_chyba_rizeni;
    
    procedure OnActivate();
    begin
      if nul_new_chyba_rizeni then
        new_chyba_rizeni = false;
      end;
    end_procedure;
    
  end_program;

  program prg_stop;
    
    procedure OnActivate();
    begin
      if stoppp then
        system.StopApplication();
      end;
    end_procedure;
    
  end_program;

  program prg_nul_bi;
    
    procedure OnActivate();
    begin
      if nul_new_bi then
        new_bi = false;
      end;
    end_procedure;
    
  end_program;

  program prg_nul_mi;
    
    procedure OnActivate();
    begin
      if nul_new_mi then
        new_mi = false;
      end;
    end_procedure;
    
  end_program;

  program prg_make_read_mi;
    
    procedure OnActivate();
    begin
      if make_read_mi then
        read_mi = not read_mi;
      end;
    end_procedure;
    
  end_program;

end_instrument;