Files
PLC_Library/plc_src/POU/Fastwel/DIM764_DI.st
T

27 lines
741 B
Smalltalk
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(*
===============================================================================
Project : PLC_Library
Device : -
Path : Fastwel
Name : DIM764_DI
Type : FUNCTION
===============================================================================
*)
FUNCTION DIM764_DI : REAL
(*
На выходе - Частота в Гц
*)
VAR_INPUT
IN: DWORD; (* Значение периода/интервала с модуля, единицы АЦП *)
RANGE: BYTE; (* 0-Period; 1-Interval; *)
END_VAR
(*----- IMPLEMENTATION -----*)
CASE RANGE OF
0 : IF(IN=0) THEN DIM764_DI:=0; ELSE DIM764_DI := 50000000.0/DWORD_TO_REAL(IN); END_IF;
1 : DIM764_DI:=DWORD_TO_REAL(IN)/50.0;
ELSE
DIM764_DI:=0;
END_CASE;
END_FUNCTION