---
title: "Руководство пользователя Библиотека Standard"
product: "ALTA IDE"
document_number: "№ 1-RU-156534-1.14"
version: "1.14"
language: "ru"
source: "https://docs.owen.ru/product/alta-ide/doc/library_standard_stable"
pdf: "https://docs.owen.ru/download/pdf/5CLrt.rp_biblioteka+standard_1-ru-156534-1.14.pdf"
generated: "2026-10-13"
---

# Руководство пользователя Библиотека Standard

## Содержание

- [Цель документа](#topic-125549)
- [Установка библиотеки](#topic-125550)
- [Описание библиотеки Standard](#topic-125551)
  - [Таймеры](#topic-125552)
    - [TP](#topic-125553)
    - [TON](#topic-125554)
    - [TOF](#topic-125555)
  - [Счетчики](#topic-125556)
    - [CTU](#topic-125557)
    - [CTD](#topic-125558)
    - [CTUD](#topic-125559)
  - [Логические функциональные блоки (триггеры)](#topic-125560)
    - [SR](#topic-125561)
    - [RS](#topic-125562)
  - [Детекторы импульсов](#topic-125563)
    - [R_TRIG](#topic-125564)
    - [F_TRIG](#topic-125565)
  - [Операторы сдвига](#topic-125566)
    - [SHL](#topic-125567)
    - [SHR](#topic-125568)
    - [ROL](#topic-125569)
    - [ROR](#topic-125570)
    - [TO_BIG_ENDIAN, TO_LITTLE_ENDIAN](#topic-125571)
    - [FROM_BIG_ENDIAN, FROM_LITTLE_ENDIAN](#topic-125572)
  - [Строковые функции](#topic-125573)
    - [LEN](#topic-125574)
    - [LEFT](#topic-125575)
    - [RIGHT](#topic-125576)
    - [MID](#topic-125577)
    - [CONCAT](#topic-125578)
    - [FIND](#topic-125579)
    - [INSERT](#topic-125580)
    - [DELETE](#topic-125581)
    - [REPLACE](#topic-125582)
    - [STRING_EQUAL, WSTRING_EQUAL](#topic-125583)
    - [STRING_GREATER, WSTRING_GREATER](#topic-125584)
    - [STRING_LESS, WSTRING_LESS](#topic-125585)
  - [Математические функции](#topic-125586)
    - [ABS](#topic-125587)
    - [SQRT](#topic-125588)
    - [LN](#topic-125589)
    - [LOG](#topic-125590)
    - [EXP](#topic-125591)
    - [SIN](#topic-125592)
    - [COS](#topic-125593)
    - [TAN](#topic-125594)
    - [ASIN](#topic-125595)
    - [ACOS](#topic-125596)
    - [ATAN](#topic-125597)
    - [EXPT](#topic-125598)
    - [TRUNC](#topic-125599)
    - [ROUND](#topic-125600)
    - [ATAN2](#topic-125601)
  - [Операторы выборки](#topic-125602)
    - [MAX](#topic-125603)
    - [MIN](#topic-125604)
    - [LIMIT](#topic-125605)
  - [Валидаторы](#topic-125606)
    - [IS_VALID](#topic-125607)
    - [IS_VALID_BCD](#topic-125608)
  - [Операции с временными типами данных](#topic-125609)
    - [CONCAT_DATE, \_TOD, \_LTOD, \_DT, \_LDT](#topic-125610)
    - [SPLIT_DATE, \_TOD, \_LTOD, \_DT, \_LDT](#topic-125611)
    - [ADD_TIME, \_TOD, \_DT, INSTANT](#topic-125612)
    - [SUB_TIME, \_DATE, \_TOD, \_DT, INSTANT](#topic-125613)
    - [MUL_TIME](#topic-125614)
    - [DIV_TIME](#topic-125615)
    - [TIME](#topic-125616)
    - [INSTANT_NOW](#topic-125617)
  - [Преобразователи](#topic-125618)

<a id="topic-125549"></a>

## Цель документа

Библиотека Standard — это базовый набор функциональных блоков и функций, соответствующих стандарту МЭК 61131-3, обеспечивающих реализацию универсальных операций и типовых задач при программирования ПЛК.

Данный документ содержит описание алгоритмов работы блоков, входные/выходные параметры и типы данных каждого блока, и предназначен для ознакомления с составом библиотеки.

Для полного понимания принципов работы в среде необходимо ознакомиться с руководством пользователя ALTA IDE.

<a id="topic-125550"></a>

## Установка библиотеки

Библиотека Standard установлена в ALTA IDE по умолчанию. Удаление данной библиотеки из проекта невозможно.

<a id="topic-125551"></a>

## Описание библиотеки Standard

Библиотека Standard содержит:

- [таймеры](#topic-125553);
- [счетчики](#topic-125557);
- [логические функциональные блоки (триггеры)](#topic-125561);
- [детекторы импульсов](#topic-125564);
- [операторы сдвига](#topic-125567);
- [строковые функции](#topic-125574);
- [математические функции](#topic-125587);
- [операторы выборки](#topic-125603);
- [валидаторы](#topic-125607);
- [операции с временными типами данных](#topic-125610);
- [преобразователи](#topic-125618).

<a id="topic-125552"></a>

### Таймеры

<a id="topic-125553"></a>

#### TP

**Функциональный блок TP (Pulse Timer)** — повторитель импульсов.

![Диаграмма PT](https://docs.owen.ru/book_img/2421/156474.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| IN | BOOL | Вход импульса |
| PT | TIME | Заданная длительность импульса |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q | BOOL | Выход импульса |
| ET | TIME | Внутреннее время |

Используется для генерирования импульса с заданной продолжительностью. Если IN становится «TRUE», Q становится «TRUE», и начинается отсчет внутреннего времени (ET). Если внутреннее время достигает значения PT, Q становится «FALSE» (независимо от IN). Отсчет внутреннего времени останавливается/сбрасывается, если IN становится «FALSE». Если внутреннее время не достигло значения PT, импульс IN не влияет на внутреннее время. Если внутреннее время достигло значения PT, и IN равен «FALSE», отсчет внутреннего времени останавливается/сбрасывается, и Q становится «FALSE».

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>TPInst<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#E7B639"?>TP<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр TP<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Btn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//кнопка-сигнал<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>PulseOut<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//импульсный выход<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>TPInst<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(IN<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Btn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>, PT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#A4DA65"?>T#200ms<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>);<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>PulseOut<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>TPInst<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.Q;<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125554"></a>

#### TON

**Функциональный блок TON (On Delay Timer)** — таймер с задержкой включения.

![Диаграмма TON](https://docs.owen.ru/book_img/2421/156473.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| IN | BOOL | Вход таймера |
| PT | TIME | Заданное время задержки включения |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q | BOOL | Выход таймера |
| ET | TIME | Внутреннее время |

Если IN становится «TRUE», запускается отсчет внутреннего времени (ET). Если внутреннее время достигает значения PT, Q становится «TRUE». Если IN становится «FALSE», Q становится «FALSE», а подсчет внутреннего времени останавливается/сбрасывается. Если IN становится «FALSE» до того, как внутреннее время достигло значения PT, подсчет внутреннего времени останавливается/сбрасывается, а выход Q не устанавливается в «FALSE».

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>fbTON<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#E7B639"?>TON<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр таймера TON<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Start<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//входной сигнал<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Motor<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//выход<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#5DA35B"?>//вызов таймера каждый цикл<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>fbTON<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(IN<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Start<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>, PT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#A4DA65"?>T#3s<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>);<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5DA35B"?>//выход активируется после выдержки<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Motor<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>fbTON<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.Q;<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125555"></a>

#### TOF

**Функциональный блок TOF (off-delay timer)** — таймер с задержкой отключения.

![Диаграмма TOF](https://docs.owen.ru/book_img/2421/156472.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| IN | BOOL | Вход таймера |
| PT | TIME | Заданное время задержки выключения |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q | BOOL | Выход таймера |
| ET | TIME | Внутреннее время |

Если IN становится «TRUE», Q становится «TRUE».

Если IN становится «FALSE», запускается отсчет внутреннего времени (ET).

Если внутреннее время достигает значения PT, Q становится «FALSE».

Если IN становится «TRUE», Q становится «TRUE», а подсчет внутреннего времени останавливается/сбрасывается.

Если IN становится «TRUE» до того, как внутреннее время достигло значения PT, подсчет внутреннего времени останавливается/сбрасывается, а выход Q не устанавливается в «FALSE».

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>fbTOFF<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#E7B639"?>TOF<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр таймера TOF<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>RunCmd<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//команда "работать"<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Fan<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>    <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//выход на вентилятор<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>fbTOFF<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(IN<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>RunCmd<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>, PT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#A4DA65"?>T#10s<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>);<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Fan<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>fbTOFF<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>.Q;<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125556"></a>

### Счетчики

<a id="topic-125557"></a>

#### CTU

**Функциональный блок CTU (Up Counter)** — инкрементный счётчик.

![CTU](https://docs.owen.ru/book_img/2421/156820.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| CU | BOOL | Вход счета - увеличение на 1 при срабатывании |
| R | BOOL | Сброс счётчика в 0 |
| PV | WORD | Предустановленное значение (уставка) |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q | BOOL | Признак достижения уставки |
| CV | WORD | Текущее значение счетчика |

По каждому фронту на входе CU (переход из FALSE в TRUE) выход CV увеличивается на 1. Выход Q устанавливается в TRUE, когда счетчик достигнет значения заданного PV. Счетчик CV сбрасывается в 0 по входу RESET = TRUE.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>CTU<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр счетчика CTU<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Pulse<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>    <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//импульсы счета<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>ResetBtn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//сброс<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Done<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>     <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Value<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>    <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font?> <?Pub _font Weight="medium" FontColor="white"?>(CU<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>Pulse<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>, R<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ResetBtn<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>, PV<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="violet"?>10<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//считать до 10<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Done<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.Q;<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#5DA35B"?>//TRUE, когда CV &gt;= 10<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Value<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.CV;<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#5DA35B"?>//текущее значение счетчика<?Pub /_font?></code></td></tr></tbody></table></div></div>

Помимо базового CTU, доступны счётчики с другими типами данных:

| Функциональный блок | Тип данных счетчика (PV, CV) |
| --- | --- |
| CTU_INT | INT |
| CTU_DINT | DINT |
| CTU_UDINT | UDINT |
| CTU_LINT | LINT |
| CTU_ULINT | ULINT |

Все перечисленные счетчики полностью повторяют функционал CTU. Отличие только в типе данных: для вызова нужно использовать соответствующее имя блока и в коде указывать верный тип данных для переменных PV и CV.

Например, для счётчика CTU_DINT переменные PV и CV должны быть типа DINT, а не WORD.

<a id="topic-125558"></a>

#### CTD

**Функциональный блок CTD (Counter Down)** — декрементный счётчик.

![CTD](https://docs.owen.ru/book_img/2421/156818.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| CD | BOOL | Вход счета - уменьшение на 1 при срабатывании |
| LD | BOOL | Вход загрузки предустановленного значения |
| PV | WORD | Предустановленное значение (уставка) |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q | BOOL | Признак достижения 0 |
| CV | WORD | Текущее значение счетчика |

По каждому фронту на входе CD (переход из FALSE в TRUE) выход CV уменьшается на 1. Когда счетчик достигнет 0, счет останавливается, выход Q переключается в TRUE. Счетчик CV загружается начальным значением, равным PV по входу LOAD = TRUE.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>CntD<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>     <?Pub _font Weight="medium" FontColor="#E7B639"?>CTD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр счетчика CTD<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>DecPulse<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//импульсы декремента<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>LoadBtn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//загрузить начальное значение<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Zero<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>     <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="bold" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Value<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>    <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>CntD<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(CD<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>DecPulse<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>, LD<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>LoadBtn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>, PV<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="violet"?>10<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//загрузка 10, затем считать
 вниз<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Zero<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>CntD<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.Q;<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#5DA35B"?>//TRUE, когда CV = 0<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Value<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>CntD<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.CV;<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#5DA35B"?>//текущее значение счетчика<?Pub /_font?></code></td></tr></tbody></table></div></div>

Помимо базового CTD, доступны счетчики с другими типами данных:

| Функциональный блок | Тип данных счетчика (PV, CV) |
| --- | --- |
| CTD_INT | INT |
| CTD_DINT | DINT |
| CTD_UDINT | UDINT |
| CTD_LINT | LINT |
| CTD_ULINT | ULINT |

Все перечисленные счетчики полностью повторяют функционал CTD. Отличие только в типе данных: для вызова нужно использовать соответствующее имя блока и в коде указывать верный тип данных для переменных PV и CV.

Например, для счетчика CTD_DINT переменные PV и CV должны быть типа DINT, а не WORD.

<a id="topic-125559"></a>

#### CTUD

**Функциональный блок CTUD (Count Up/Down)** — инкрементный/декрементный счетчик.

![CTUD](https://docs.owen.ru/book_img/2421/156819.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| CU | BOOL | Вход счета - увеличение на 1 при срабатывании |
| CD | BOOL | Вход счета - уменьшение на 1 при срабатывании |
| R | BOOL | Сброс счетчика в 0 |
| LD | BOOL | Вход загрузки предустановленного значения |
| PV | WORD | Предустановленное значение (уставка) |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| QU | BOOL | Признак достижения уставки |
| QD | BOOL | Признак достижения 0 |
| CV | WORD | Текущее значение счетчика |

По входу R счетчик CV сбрасывается в 0, по входу LD загружается значением PV.

По фронту на входе CU счетчик увеличивается на 1. По фронту на входе CD счетчик уменьшается на 1 (до 0).

QU устанавливается в TRUE, когда CV больше или равен PV.

QD устанавливается в TRUE, когда CV равен 0.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>CTUD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр счетчика CTUD<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>UpPulse<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//импульсы счета вверх<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>DnPulse<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//импульсы счета вниз<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>ResetBtn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//сброс<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>LoadBtn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//загрузка PV и CV<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>QU_reach<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="bold" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>QD_zero<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="bold" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Value<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>    <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font?> <?Pub _font Weight="medium" FontColor="white"?>(CU<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>UpPulse<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>, CD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>DnPulse<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>, R<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ResetBtn<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>, LD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>LoadBtn<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>, PV<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="violet"?>10<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>QU_reach<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.QU;<?Pub /_font
?>  <?Pub _font Weight="medium" FontColor="#5DA35B"?>//TRUE, когда CV &gt;= 10<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>QD_zero<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.QD;<?Pub /_font
?>   <?Pub _font Weight="medium" FontColor="#5DA35B"?>//TRUE, когда CV = 0<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Value<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Cnt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.CV;<?Pub /_font
?>     <?Pub _font Weight="medium" FontColor="#5DA35B"?>//текущее значение счетчика<?Pub /_font?></code></td></tr></tbody></table></div></div>

Помимо базового CTUD, доступны счетчики с другими типами данных:

| Функциональный блок | Тип данных счетчика (PV, CV) |
| --- | --- |
| CTUD_INT | INT |
| CTUD_DINT | DINT |
| CTD_UDINT | UDINT |
| CTUD_LINT | LINT |
| CTUD_ULINT | ULINT |

Все перечисленные счетчики полностью повторяют функционал CTUD. Отличие только в типе данных: для вызова нужно использовать соответствующее имя блока и в коде указывать верный тип данных для переменных PV и CV.

Например, для счетчика CTUD_DINT переменные PV и CV должны быть типа DINT, а не WORD.

<a id="topic-125560"></a>

### Логические функциональные блоки (триггеры)

<a id="topic-125561"></a>

#### SR

**Функциональный блок SR (Set-Reset)** — переключатель с доминантой включения.

![SR](https://docs.owen.ru/book_img/2421/156824.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| SET1 | BOOL | Вход установки |
| RESET | BOOL | Вход сброса |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q1 | BOOL | Запоминаемый выход (состояние триггера) |

Функциональный блок с доминирующим входом SET1. Выход Q1 становится «TRUE», когда вход SET1 становится «TRUE». Это состояние сохраняется, даже если SET1 возвращается обратно в «FALSE». Выход Q1 возвращается в «FALSE», когда вход RESET становится «TRUE».

Если входы SET1 и RESET находятся в «TRUE» одновременно, доминирующий вход SET1 установит выход Q1 в «TRUE». Когда функциональный блок вызывается первый раз, начальное состояние Q1 это «FALSE».

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Latch<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#E7B639"?>SR<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр переключателя SR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StartPB<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//установить<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StopPB<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//сбросить<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>MotorOn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Latch<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(SET1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StartPB<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>, RESET<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StopPB<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>);<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>MotorOn<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Latch<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.Q1;<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125562"></a>

#### RS

**Функциональный блок RS (Reset-Set)** — переключатель с доминантой выключения.

![RS](https://docs.owen.ru/book_img/2421/156823.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| SET | BOOL | Вход установки |
| RESET1 | BOOL | Вход сброса |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q1 | BOOL | Запоминаемый выход (состояние триггера) |

Функциональный блок с доминирующим входом RESET1. Выход Q1 становится «TRUE», когда вход SET становится «TRUE». Это состояние сохраняется, даже если SET возвращается обратно в «FALSE». Выход Q1 возвращается в «FALSE», когда вход RESET1 становится «TRUE».

Если входы SET и RESET1 находятся в «TRUE» одновременно, доминирующий вход RESET1 установит выход Q1 в «FALSE». Когда функциональный блок вызывается первый раз, начальное состояние Q1 это «FALSE».

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Latch<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#E7B639"?>RS<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр переключателя RS<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StartPB<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//установить<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StopPB<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//сбросить, доминирует<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>MotorOn<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Latch<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(SET<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StartPB<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>, RESET1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StopPB<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>);<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>MotorOn<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Latch<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.Q1;<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125563"></a>

### Детекторы импульсов

<a id="topic-125564"></a>

#### R_TRIG

**Функциональный блок R_TRIG (Rising Trigger)** — детектор импульсов по переднему фронту.

![r-trig](https://docs.owen.ru/book_img/2421/156822.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| CLK | BOOL | Вход сигнала, по переднему фронту которого выполняется детектирование |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q | BOOL | Выход импульса |

Индикатор нарастания фронта, который генерирует на выходе одиночный импульс при нарастании фронта сигнала. Выход Q становится «TRUE», если происходит переход из «FALSE» в «TRUE» на входе CLK . Выход остается в состоянии «TRUE» от одного выполнения блока до следующего (один цикл); затем выход возвращается в «FALSE».

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>rt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>     <?Pub _font Weight="medium" FontColor="#E7B639"?>R_TRIG<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр R_TRIG<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Button<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//входной сигнал<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Pulse<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//импульс 1 цикл<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>rt<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(CLK<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>Button<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Pulse<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>rt<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.Q;<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#5DA35B"?>//TRUE только при переходе Button FALSE -&gt; TRUE<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#99FFFF"?>IF<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>rt<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>.Q)<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#99FFFF"?>THEN<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>dwCount<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>dwCount<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>+<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#FF99CC"?>1<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#99FFFF"?>END_IF<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125565"></a>

#### F_TRIG

**Функциональный блок F_TRIG (Falling Trigger)** — детектор импульсов по заднему фронту.

![f-trig](https://docs.owen.ru/book_img/2421/156821.png)

**Входные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| CLK | BOOL | Вход сигнала, по заднему фронту которого выполняется детектирование |

**Выходные переменные**

| Имя переменной | Тип данных | Описание |
| --- | --- | --- |
| Q | BOOL | Выход импульса |

Индикатор спада фронта, который генерирует на выходе одиночный импульс при спаде фронта сигнала. Выход Q становится «TRUE», если происходит переход из «TRUE» в «FALSE» на входе CLK . Выход будет оставаться в состоянии «TRUE» от одного выполнения блока до следующего; затем выход возвращается в «FALSE».

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>ft<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>     <?Pub _font Weight="medium" FontColor="#E7B639"?>F_TRIG<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//экземпляр F_TRIG<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Sensor<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//входной сигнал<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>Pulse<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//импульс 1 цикл<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Ft<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(CLK<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>Sensor<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>Pulse<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>ft<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>.Q;<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#5DA35B"?>//TRUE только при переходе Sensor TRUE -&gt; FALSE<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#99FFFF"?>IF<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>rt<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>.Q)<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#99FFFF"?>THEN<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>dwCount<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#7B8DF7"?>dwCount<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>+<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#FF99CC"?>1<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#99FFFF"?>END_IF<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125566"></a>

### Операторы сдвига

<a id="topic-125567"></a>

#### SHL

**Функция SHL (Shift Left)** — побитовый сдвиг влево.

Возвращает в OUT побитный сдвиг операнда IN на N бит влево с заполнением битов справа нулями.

```
OUT:=SHL(in,n)
```

Входные переменные и результат типа BOOL, BYTE, WORD, DWORD или LWORD.

![Побитовый сдвиг влево](https://docs.owen.ru/book_img/2421/156471.png)

*Сдвиг влево, n=1*

В следующем примере представлены различные результаты out_byte и out_word в зависимости от типа входной переменной (BYTE и WORD), хотя их числовые значения равны.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>in_byte<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#45<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>      <?Pub _font
Weight="medium" FontColor="#5DA35B"?>// 2#0100_0101<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>in_word<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#45<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>      <?Pub _font
Weight="medium" FontColor="#5DA35B"?>// 2#0100_0101<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_byte<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_word<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>        <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_byte<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>SHL<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>in_byte<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Результат 2#0001_0100, 16#14<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_word<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>SHL<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>in_word<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Результат 2#1_0001_0100, 16#0114<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125568"></a>

#### SHR

**Функция SHR (Shift Right)** — побитовый сдвиг вправо.

Возвращает в OUT побитный сдвиг операнда IN на N бит вправо с заполнением битов слева нулями.

```
OUT:=SHR(in,n)
```

Входные переменные и результат типа BOOL, BYTE, WORD, DWORD или LWORD.

![Побитовый сдвиг вправо](https://docs.owen.ru/book_img/2421/156470.png)

*Сдвиг вправо, n=1*

Следующий пример подчеркивает зависимость результата от типа входной переменной.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>in_byte<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#45<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>     <?Pub _font
Weight="medium" FontColor="#5DA35B"?>// 2#0100_0101<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>in_word<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#45<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>     <?Pub _font
Weight="medium" FontColor="#5DA35B"?>// 2#0100_0101<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_byte<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_word<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>        <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_byte<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>SHR<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>in_byte<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Результат 2#0001_0001, 16#11<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_word<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>SHR<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>in_word<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Результат 2#0000_0000_0001_0001, 16#0011<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125569"></a>

#### ROL

**Функция ROL (Rotate Left)** — циклический сдвиг влево.

Возвращает в OUT циклический сдвиг аргумента IN на N бит влево, младшие биты последовательно заменяются старшими.

```
OUT:=ROL(in,n)
```

Входные переменные и результат типа BOOL, BYTE, WORD, DWORD или LWORD.

![Циклический сдвиг влево](https://docs.owen.ru/book_img/2421/156469.png)

*Циклический сдвиг влево, n=1*

В следующем примере представлены различные результаты OUT_byte и OUT_word в зависимости от типа входной переменной (BYTE и WORD), хотя числовые их значения равны.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>in_byte<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#45<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>in_word<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#45<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_byte<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_word<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>        <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_byte<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>ROL<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>in_byte<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Результат 16#15<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_word<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>ROL<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>in_word<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Результат 16#0114<?Pub /_font
?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125570"></a>

#### ROR

**Функция ROR (Rotate Right)** — циклический сдвиг вправо.

Возвращает в OUT циклический сдвиг аргумента IN на N бит вправо, старшие биты последовательно заменяются младшими.

```
OUT:=ROR(in,n)
```

Входные переменные и результат типа BOOL, BYTE, WORD, DWORD или LWORD.

![Циклический сдвиг вправо](https://docs.owen.ru/book_img/2421/156468.png)

*Циклический сдвиг вправо, n=1*

Следующий пример подчеркивает зависимость результата от типа входной переменной.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>in_byte<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#45<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>in_word<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#45<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_byte<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_word<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>        <?Pub _font Weight="medium" FontColor="#E7B639"?>BYTE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_byte<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>ROR<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>in_byte<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Результат 16#51<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>out_word<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>ROR<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>in_word<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>n<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Результат 16#4011<?Pub /_font
?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125571"></a>

#### TO_BIG_ENDIAN, TO_LITTLE_ENDIAN

Функции интерпретации порядка байт при обмене данными.

- TO_BIG_ENDIAN — старший байт передаётся первым.
- TO_LITTLE_ENDIAN — младший байт передаётся первым

Входные переменные и результат любого типа, для которого имеет смысл побайтовое представление.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>w<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#1234<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#1234<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>wBE<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>qLE<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>wBE<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>TO_BIG_ENDIAN<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>w<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?>    <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Возвращаемое значение 16#3412<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>qLE<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>TO_LITTLE_ENDIAN<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//Возвращаемое значение 16#1234<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125572"></a>

#### FROM_BIG_ENDIAN, FROM_LITTLE_ENDIAN

Функция интерпретации порядка байт при обмене данными.

- FROM_BIG_ENDIAN — интерпретирует входное значение как записанное в big-endian, и преобразует его в порядок байт, принятых в системе.
- FROM_LITTLE_ENDIAN — интерпретирует входное значение как записанное в little-endian, и преобразует его в порядок байт, принятых в системе.

Входные переменные и результат любого типа, для которого имеет смысл побайтовое представление.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>wFBE<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#3412<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>(*байты 34 12, как если бы пришло от big-endian
значение 16#1234*)<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>wFLE<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#1234<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>(*байты 12 34, как если бы пришло от little-endian
значение 16#1234*)<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>valBE<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>valLE<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>valBE<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>FROM_BIG_ENDIAN<?Pub /_font?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#7B8DF7"?>wFBE<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>);<?Pub /_font?>    <?Pub _font Weight="medium" FontColor="#5DA35B"?>(*на little-endian CPU возвращаемое значение 
16#1234*)<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>valLE<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>FROM_LITTLE_ENDIAN<?Pub /_font?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#7B8DF7"?>wFLE<?Pub /_font
?><?Pub _font Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>(*на little-endian CPU возвращаемое значение 
16#1234*)<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125573"></a>

### Строковые функции

<a id="topic-125574"></a>

#### LEN

Функция, возвращающая длину строки.

Аргумент STR типа STRING, возвращаемое значение типа DINT.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>VarSTRING1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>LEN<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 4<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125575"></a>

#### LEFT

Функция, возвращающая левую часть строки заданной длины.

Входная строка STR типа STRING, размер SIZE типа INT, возвращаемое значение STRING.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>VarSTRING1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>LEFT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF6699"?>3<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ’ALT’<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125576"></a>

#### RIGHT

Функция, возвращающая правую часть строки заданной длины.

Входная строка STR типа STRING, размер SIZE типа INT, возвращаемое значение STRING.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>VarSTRING1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>RIGHT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF6699"?>3<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ’LTA’<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125577"></a>

#### MID

Функция, возвращающая часть строки заданной длины с заданной позиции.

Входная строка STR типа STRING, размер LEN и POS типа INT, возвращаемое значение STRING.

<div><div><table><tbody><tr><td><?PubTbl cell border-bottom-style="none"
border-left-style="none" border-top-style="none"?><code>MID (STR, LEN, POS) </code></td><td><?PubTbl cell border-bottom-style="none" border-right-style="none"
border-top-style="none"?><p>означает: вырезать LEN символов из STR
строки, начиная с POS.</p></td></tr></tbody></table></div></div>

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>VarSTRING1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>MID<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF6699"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF6699"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ’LT’<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125578"></a>

#### CONCAT

Конкатенация (объединение) двух строк.

Обе входных строки STR1 и STR2 и результат типа STRING.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>VarSTRING1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>CONCAT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IDE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ’ALTAIDE’<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125579"></a>

#### FIND

Функция, предназначенная для поиска позиции заданного контекста в строке.

Входные переменные STR1 и STR2 типа STRING, возвращаемое значение INT.

<div><div><table><tbody><tr><td><?PubTbl cell border-bottom-style="none"
border-left-style="none" border-top-style="none"?><code>FIND(STR1, STR2)</code></td><td><?PubTbl cell border-bottom-style="none" border-right-style="none"
border-top-style="none"?><p>означает: найти позицию в строке STR1,
где впервые встречается подстрока STR2.</p></td></tr></tbody></table></div></div>

Нумерация позиций в строке начинается с 1. Если STR2 не найдена, STR1 возвращает 0.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>VarINT1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>FIND<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA IDE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ID<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 6<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125580"></a>

#### INSERT

Функция, предназначенная для вставки одной строки в заданную позицию другой строки.

Входные переменные STR1 и STR2 - типа STRING, POS - типа INT, возвращаемое значение - строка STRING.

<div><div><table><tbody><tr><td><?PubTbl cell
border-bottom-style="none"
border-left-style="none" border-top-style="none"?><code>INSERT(STR1, STR2, POS)</code></td><td><?PubTbl cell border-bottom-style="none" border-right-style="none"
border-top-style="none"?><p>означает: вставить STR2 в STR1 в позиции
POS.</p></td></tr></tbody></table></div></div>

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>VarSTRING1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>INSERT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IDE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ’ALIDETA’<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125581"></a>

#### DELETE

Функция, предназначенная для удаления части строки с заданной позиции.

Входные переменные STR типа STRING, LEN и POS типа INT, возвращаемое значение строка STRING.

<div><div><table><tbody><tr><td><?PubTbl cell
border-bottom-style="none"
border-left-style="none" border-top-style="none"?><code>DELETE(STR, LEN, POS)</code></td><td><?PubTbl cell border-bottom-style="none" border-right-style="none"
border-top-style="none"?><p>означает: удалить LEN символов из STR,
начиная с позиции POS.</p></td></tr></tbody></table></div></div>

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>VarSTRING1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>DELETE<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTAIDE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>3<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ’ALTDE’<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125582"></a>

#### REPLACE

Функция, предназначенная для замены части строки другой строкой с заданной позиции указанной длины.

Входные переменные STR1 и STR2 типа STRING, LEN и POS типа INT, возвращаемое значение строка STRING.

<div><div><table><tbody><tr><td><?PubTbl cell
border-bottom-style="none"
border-left-style="none" border-top-style="none"?><code>REPLACE(STR1, STR2, LEN, POS)</code></td><td><?PubTbl cell border-bottom-style="none" border-right-style="none"
border-top-style="none"?><p>означает: заменить LEN символов строки
STR1 на STR2 начиная с позиции POS.</p></td></tr></tbody></table></div></div>

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="bold" FontColor="#7B8DF7"?>VarSTRING1<?Pub /_font
?> <?Pub _font Weight="bold" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font Weight="bold" FontColor="#009999"?>REPLACE<?Pub /_font?> <?Pub _font
Weight="bold" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="bold" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="bold" FontColor="white"?>’,‘<?Pub /_font?><?Pub _font
Weight="bold" FontColor="#7B8DF7"?>IDE<?Pub /_font?><?Pub _font
Weight="bold" FontColor="white"?>’,<?Pub /_font?><?Pub _font
Weight="bold" FontColor="#FF6699"?>2<?Pub /_font?><?Pub _font
Weight="bold" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="bold" FontColor="#FF6699"?>2<?Pub /_font?><?Pub _font
Weight="bold" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="bold" FontColor="#5DA35B"?>//возвращаемое значение ’AIDEA’<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125583"></a>

#### STRING_EQUAL, WSTRING_EQUAL

Функция, предназначенная для сравнения входных переменных и возврата значения TRUE при совпадении значений.

Входные переменные могут быть типа STRING и WSTRING, возвращаемое значение типа BOOL.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>STRING_EQUAL<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IDE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’);<?Pub /_font?>    <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ‘FALSE’<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>STRING_EQUAL<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’,‘<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>’);<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ‘TRUE’<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>WSTRING_EQUAL<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>("<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>","<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IDE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>");<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ‘FALSE’<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>WSTRING_EQUAL<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>("<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>","<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>ALTA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>");<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение ‘TRUE’<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125584"></a>

#### STRING_GREATER, WSTRING_GREATER

Функция, предназначенная для сравнения входных переменных по лексикографическому признаку и возврата значения TRUE если значение первой переменной больше значения второй.

Входные переменные могут быть типа STRING и WSTRING, возвращаемое значение типа BOOL.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>IN1<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>STRING<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#00CC99"?>‘ALTA’<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>IN2<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>STRING<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#00CC99"?>‘IDE’<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>IN3<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WSTRING<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#00CC99"?>"IDE"<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>IN4<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WSTRING<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#00CC99"?>"ALTA"<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>GS<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>GW<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>GS<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>STRING_GREATER<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IN1<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IN2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>(*возвращаемое значение FALSE, т.к. 'A' 
лексикографически меньше 'I'*)<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>GW<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>WSTRING_GREATER<?Pub /_font?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IN3<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IN4<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>(*возвращаемое значение TRUE, т.к. 'I' 
лексикографически больше 'A'*)<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125585"></a>

#### STRING_LESS, WSTRING_LESS

Функция, предназначенная для сравнения входных переменных по лексикографическому признаку и возврата значения TRUE если значение первой переменной меньше значения второй.

Входные переменные могут быть типа STRING и WSTRING, возвращаемое значение типа BOOL.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>IN1<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>STRING<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#00CC99"?>‘ALTA’<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>IN2<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>STRING<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#00CC99"?>‘IDE’<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>IN3<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WSTRING<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#00CC99"?>"IDE"<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>IN4<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WSTRING<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#00CC99"?>"ALTA"<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>GS<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>GW<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>  <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>GS<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>STRING_LESS<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IN1<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IN2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>(*возвращаемое значение TRUE, т.к. 'A' 
лексикографически меньше 'I'*)<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>GW<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>WSTRING_LESS<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IN3<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>IN4<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>(*возвращаемое значение FALSE, т.к. 'I' 
лексикографически больше 'A'*)<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125586"></a>

### Математические функции

<a id="topic-125587"></a>

#### ABS

Функция, предназначенная для возврата модуля входного числа.

Входная переменная может быть любого числового типа, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>ABS<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#EF7244"?>-<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>5<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 5<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125588"></a>

#### SQRT

Функция, предназначенная для возврата квадратного корня входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>SQRT<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>16.0<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 4.0<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125589"></a>

#### LN

Функция, предназначенная для возврата натурального логарифма входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>LN<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>36.6<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 3.6000482404073<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125590"></a>

#### LOG

Функция, предназначенная для возврата десятичного логарифма входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>LOG<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#EF7244"?><?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>36.6<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 1.5634810853944<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125591"></a>

#### EXP

Функция, предназначенная для возврата значения экспоненты, возведенной в степень входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>EXP<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>2.0<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 7.3890561<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125592"></a>

#### SIN

Функция, предназначенная для возврата значения sin (синуса) входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>SIN<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0.5<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 0.4794255386<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125593"></a>

#### COS

Функция, предназначенная для возврата значения cos (косинуса) входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>COS<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0.7<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 0.7648421873<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125594"></a>

#### TAN

Функция, предназначенная для возврата значения tg (тангенса) входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>TAN<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0.33<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 0.342654129<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125595"></a>

#### ASIN

Функция, предназначенная для возврата значения arcsin (арксинуса) входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>ASIN<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0.5<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 0.5235987756<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125596"></a>

#### ACOS

Функция, предназначенная для возврата значения arccos (арккосинуса) входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>ACOS<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0.7<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 0.7953988302<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125597"></a>

#### ATAN

Функция, предназначенная для возврата значения arctg (арктангенса) входного числа.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>ATAN<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0.33<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 0.3187475604<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125598"></a>

#### EXPT

Функция, предназначенная для возврата значения входного числа IN1 в степени IN2.

Входная переменная IN1 может быть типа REAL и LREAL, IN2 любого числового типа, возвращаемое значение типа REAL и LREAL.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>var1<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>EXPT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>7.1<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 50.41<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125599"></a>

#### TRUNC

Функция, предназначенная для возврата целой части входного числа.

Входная переменная может быть типа REAL и LREAL, возвращаемое значение типа LINT.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>x<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>TRUNC<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>7.9<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 7<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>y<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>TRUNC<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#EF7244"?>-<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0.9<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 0<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125600"></a>

#### ROUND

Функция, предназначенная для округления входного числа до ближайшего целого.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>ROUND<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>2.3<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 2.0<?Pub /_font
?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125601"></a>

#### ATAN2

Функция, предназначенная для возврата значения угла направления вектора.

Входная переменная может быть типа REAL и LREAL, с соответствующим возвращаемым значением.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>q<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>ATAN2<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0.0<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#EF7244"?>-<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>1.0<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 3.141592653589793<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125602"></a>

### Операторы выборки

<a id="topic-125603"></a>

#### MAX

Функция, предназначенная для возврата наибольшего значения из двух входных переменных.

Входные переменные и возвращаемое значение могут быть любого числового типа данных.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>MAX<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>10<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>12<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 12<?Pub /_font
?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125604"></a>

#### MIN

Функция, предназначенная для возврата наименьшего значения из двух входных переменных.

Входные переменные и возвращаемое значение могут быть любого числового типа данных.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>MIN<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>10<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>12<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 10<?Pub /_font
?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125605"></a>

#### LIMIT

Функция, предназначенная для возврата ограниченного значения входной переменной.

Входные переменные и возвращаемое значение могут быть любого числового типа данных.

```
OUT := LIMIT(Min, IN, Max);
```

MIN и MAX задают нижнюю и верхнюю границы значений.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#009999"?>LIMIT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>5<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>10<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?>   <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 5<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>LIMIT<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="bold" FontColor="#EF7244"?>-<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>2<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>10<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 0<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#009999"?>LIMIT<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>0<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="bold" FontColor="#EF7244"?>-<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>15<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#FF99CC"?>10<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 10<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125606"></a>

### Валидаторы

<a id="topic-125607"></a>

#### IS_VALID

Функция, предназначенная для проверки корректности значения: не содержит NaN (Not-a-Number, «не число») и Inf (Infinity, «бесконечность»). Возвращает значение TRUE, если значение корректно.

Входные переменные могут быть типа REAL и LREAL, возвращаемое значение типа BOOL.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>x<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>   <?Pub _font Weight="medium" FontColor="#E7B639"?>LREAL<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>12.5<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="teal"?>IS_VALID<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>x<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение TRUE, т.к. x — корректное число<?Pub /_font?></code></td></tr></tbody></table></div></div>

<a id="topic-125608"></a>

#### IS_VALID_BCD

Функция, предназначенная для проверки корректности значения двоично-десятичного кода и возврата значения TRUE, если значение корректно.

Входные переменные могут быть типа BOOL, BYTE, WORD, DWORD, LWORD, возвращаемое значение типа BOOL.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>bcdVal<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>16#1234<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//BCD: 1-2-3-4<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>    <?Pub _font Weight="medium" FontColor="#E7B639"?>BOOL<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>OUT<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="teal"?>IS_VALID_BCD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>bcdVal<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение TRUE<?Pub /_font
?></code></td></tr></tbody></table></div></div>

<a id="topic-125609"></a>

### Операции с временными типами данных

Подробнее о временных типах данных см. в Руководстве пользователя ALTA IDE.

<a id="topic-125610"></a>

#### CONCAT_DATE, \_TOD, \_LTOD, \_DT, \_LDT

Функция, предназначенная для конкатенации (объединения) целочисленных переменных с возвратом значения во временном формате.

Входные переменные могут быть

- любого целочисленного типа, возвращаемое значение DATE, TOD, LTOD, DT, LDT;

<!-- -->

- типа DATE и TOD, возвращаемое значение DT;
- типа DATE и LTOD, возвращаемое значение DT.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>y<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>INT<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>2026<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>m<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>INT<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>11<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>d<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>INT<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>15<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>myDate<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>DATE<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>myDate<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="teal"?>CONCAT_DATE<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>y<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>m<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>d<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение 2026-11-15<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125611"></a>

#### SPLIT_DATE, \_TOD, \_LTOD, \_DT, \_LDT

Функция, предназначенная для разделения временных переменных.

Входные переменные могут быть типов DATE, TOD, LTOD, DT, LDT, возвращаемое значение INT.

> [!NOTE]
> **Примечание.** В данной реализации возвращаемое значение всегда будет равно 0. Функцию можно использовать для разделения входной временной переменной на выходные переменные целочисленного типа.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>myDate<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>DATE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>D#2026-02-20;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>y<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>INT<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>m<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>INT<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>d<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>INT<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>f<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?>      <?Pub _font Weight="medium" FontColor="#E7B639"?>INT<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>f<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="teal"?>SPLIT_DATE<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>myDate<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>y<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>m<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#7B8DF7"?>d<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//выходные переменные y=2026, m=02, d=20<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125612"></a>

#### ADD_TIME, \_TOD, \_DT, INSTANT

> [!NOTE]
> **Примечание.** В текущей версии ALTA IDE сложение временных типов с помощью функции ADD не поддерживается. Воспользуйтесь оператором "+"

Функции, предназначенные для сложения переменных временных типов.

| Наименование функции | Входные переменные | Выход функции | Пример |
| --- | --- | --- | --- |
| ADD_TIME | TIME | TIME | T#1s + T#500ms = T#1s500ms |
| ADD_TOD_TIME | TIME, TOD | TOD | Прибавляет временной интервал к времени суток, время суток смещается вперед на интервал:<br>T#10s + TOD#12:00:00 = TOD#12:00:10 |
| ADD_DT_TIME | DT, TIME | DT | Прибавляет временной интервал к дате-времени, время суток смещается вперед на интервал:<br>T#1h + DT#2026-02-20-12:00:00 = DT#2026-02-20-13:00:00 |
| ADD_INSTANT_TIME | INSTANT, TIME | INSTANT | T#1h + 25ns = 1h25ns |

<a id="topic-125613"></a>

#### SUB_TIME, \_DATE, \_TOD, \_DT, INSTANT

> [!NOTE]
> **Примечание.** В текущей версии ALTA IDE вычитание временных типов с помощью функции SUB не поддерживается. Воспользуйтесь оператором "-"

Функции, предназначенные для вычитания переменных временных типов.

| Наименование функции | Входные переменные | Выход функции | Пример |
| --- | --- | --- | --- |
| SUB_TIME | TIME | TIME | T#15s - T#8s = T#7s |
| SUB_DATE_DATE | DATE | TIME | D#2026-02-20 - D#2026-02-18 = T#48h |
| SUB_TOD_TIME | TOD, TIME | TOD | TOD#12:00:10 - T#5s = TOD#12:00:05 |
| SUB_TOD_TOD | TOD | TIME | TOD#12:00:10 - TOD#12:00:03 = TIME#7s |
| SUB_DT_TIME | DT, TIME | DT | DT#2026-02-20-12:00:10 - T#5s =  DT#2026-02-20-12:00:05 |
| SUB_DT_DT | DT | TIME | DT#2026-02-20-12:00:10 - DT#2026-02-20-12:00:03 = T#7s |
| SUB_INSTANT_INSTANT | INSTANT | INSTANT | 12ns - 5 ns= T#7ns |
| SUB_INSTANT_INSTANT | INSTANT | TIME | 12ns - T#7ns = 5 ns |

<a id="topic-125614"></a>

#### MUL_TIME

> [!NOTE]
> **Примечание.** В текущей версии ALTA IDE умножение временных типов с помощью функции MUL не поддерживается. Воспользуйтесь оператором "\*"

Функция, предназначенная для умножения временной переменной на число.

Входная переменная TIME и переменная любого числового типа данных, возвращаемое значение типа TIME.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>t<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="teal"?>MUL_TIME<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#66FF66"?>T#2s<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>3<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение T#6s<?Pub /_font
?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125615"></a>

#### DIV_TIME

> [!NOTE]
> **Примечание.** В текущей версии ALTA IDE деление временных типов с помощью функции DIV не поддерживается. Воспользуйтесь оператором "/"

Функция, предназначенная для деления временной переменной на число.

Входная переменная TIME и переменная любого числового типа данных, возвращаемое значение типа TIME.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>t1<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="teal"?>DIV_TIME<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#66FF66"?>T#10s<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>,<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF99CC"?>4<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение T#2s500ms<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125616"></a>

#### TIME

Функция, предназначенная для возврата значения местного времени, начиная с 00.00 текущих суток.

Возвращаемое значение типа TIME.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>CurTime<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>TIME<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>CurTime<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="teal"?>TIME<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>();<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение - текущее время, например T#6h41m30s<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125617"></a>

#### INSTANT_NOW

Функция, предназначенная для возврата значения времени от начала запуска приложения пользователя на устройстве.

Возвращаемое значение типа INSTANT.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>StartTime<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>INSTANT<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>StartTime<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="teal"?>INSTANT_NOW<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>();<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#5DA35B"?>//возвращаемое значение - время от начала запуска 
приложения, например 1h15m30s<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

<a id="topic-125618"></a>

### Преобразователи

Преобразование типов происходит с помощью функций-преобразователей.

Пример:

<div><div><table><tbody><tr><td><?Pub _cellfont Shading="#2E3136"?><code><?Pub _font Weight="medium" FontColor="#5684DD"?>VAR<?Pub /_font
?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>wVal<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>WORD<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#FF6699"?>16#00FA<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>  <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//250<?Pub /_font?>
    <?Pub _font Weight="medium" FontColor="#7B8DF7"?>iVal<?Pub /_font
?><?Pub _font Weight="medium" FontColor="#EF7244"?>:<?Pub /_font?> <?Pub _font Weight="medium" FontColor="#E7B639"?>INT<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>;<?Pub /_font?>
<?Pub _font Weight="medium" FontColor="#5684DD"?>END_VAR<?Pub /_font
?>
<?Pub _font Weight="medium" FontColor="#7B8DF7"?>iVal<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="#EF7244"?>:=<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="teal"?>WORD_TO_INT<?Pub /_font
?> <?Pub _font Weight="medium" FontColor="white"?>(<?Pub /_font?><?Pub _font
Weight="medium" FontColor="#7B8DF7"?>wVal<?Pub /_font?><?Pub _font
Weight="medium" FontColor="white"?>);<?Pub /_font?> <?Pub _font
Weight="medium" FontColor="#5DA35B"?>//iVal = 250<?Pub /_font?>
</code></td></tr></tbody></table></div></div>

| Тип данных | Может быть преобразован |
| --- | --- |
| LWORD | DWORD, WORD, BYTE, BOOL, LREAL, LINT, DINT, INT, SINT, ULINT, UDINT, UINT, USINT, STRING, WSTRING, DATE, LDATE, DT, LDT, TOD, LTOD, TIME, LTIME |
| DWORD | LWORD, WORD, BYTE, BOOL, REAL, LINT, DINT, INT, SINT, ULINT, UDINT, UINT, USINT, STRING, WSTRING |
| WORD | LWORD, DWORD, BYTE, BOOL, LINT, DINT, INT, SINT, ULINT, UDINT, UINT, USINT |
| BYTE | LWORD, DWORD, WORD, BOOL, CHAR, LINT, DINT, INT, SINT, ULINT, UDINT, UINT, USINT, STRING, WSTRING |
| BOOL | LWORD, DWORD, WORD, BYTE, LINT, DINT, INT, SINT, ULINT, UDINT, UINT, USINT |
| CHAR | BYTE, WORD, DWORD, LWORD, STRING, WCHAR |
| WCHAR | WORD, DWORD, LWORD, WSTRING, CHAR |
| REAL | DWORD, STRING, WSTRING, LREAL, LINT, DINT, INT, SINT, ULINT, UDINT, UINT, USINT |
| LREAL | LWORD, STRING, WSTRING, REAL, LINT, DINT, INT, SINT, ULINT, UDINT, UINT, USINT, TIME |
| SINT | LWORD, DWORD, WORD, BYTE, LREAL, REAL, LINT, DINT, INT, ULINT, UDINT, UINT, USINT |
| INT | LWORD, DWORD, WORD, BYTE, LREAL, REAL, LINT, DINT, SINT, ULINT, UDINT, UINT, USINT |
| DINT | LWORD, DWORD, WORD, BYTE, BOOL, LREAL, REAL, LINT, INT, SINT, ULINT, UDINT, UINT, USINT |
| LINT | LWORD, DWORD, WORD, BYTE, STRING, WSTRING, LREAL, REAL, DINT, INT, SINT, ULINT, UDINT, UINT, USINT, TIME, TOD, DATE, BOOL |
| USINT | LWORD, DWORD, WORD, BYTE, STRING, LREAL, REAL, LINT, DINT, INT, SINT, ULINT, UDINT, UINT |
| UINT | LWORD, DWORD, WORD, BYTE, STRING, LREAL, REAL, LINT, DINT, INT, SINT, ULINT, UDINT, USINT |
| UDINT | LWORD, DWORD, WORD, BYTE, STRING, LREAL, REAL, LINT, DINT, INT, SINT, ULINT, UINT, USINT |
| ULINT | LWORD, DWORD, WORD, BYTE, STRING, LREAL, REAL, LINT, DINT, INT, SINT, UDINT, UINT, USINT, DATE, DT, TOD, TIME |
| STRING | LINT, DINT, REAL, LREAL, WSTRING, CHAR |
| WSTRING | LINT, DINT, REAL, LREAL, WCHAR |
| TIME | STRING, WSTRING, LWORD, LINT, ULINT, LREAL |
| DATE | STRING, WSTRING, LWORD, LINT, ULINT |
| TOD | STRING, WSTRING, LWORD, LINT, ULINT |
| DT | STRING, WSTRING, LWORD, LINT, ULINT, DATE, TOD |
