BLINK (FB) ¶ FUNCTION_BLOCK BLINK Simulates a blinking signal (turning on and off for specific durations) InOut: Scope Name Type Comment Input ENABLE BOOL TRUE : Starts blinking FALSE : Stops blinking whereas OUT keeps its value TIMELOW TIME Time for OUT to be FALSE TIMEHIGH TIME Time for OUT to be TRUE Output OUT BOOL Output value, starts with FALSE and switches between TRUE and FALSE for the given high and low times
FREQ_MEASURE (FB) ¶ FUNCTION_BLOCK FREQ_MEASURE Measures the frequency of a signal InOut: Scope Name Type Initial Comment Input IN BOOL Input signal PERIODS INT (1..10) 1 A period is the time between two rising edges of the input signal. OUT will equal the average frequency during the given PERIODS (number of periods; minimal 1 maximal 10). The function block will not work unless this value is between 1 and 10. RESET BOOL Reset measurement Output OUT REAL Frequency [Hz] VALID BOOL FALSE : As long as the first measure has been finished. Or time distance between two rising edges > 3 * OUT . (Indicates that something is wrong with the inputs)
GEN (FB) ¶ FUNCTION_BLOCK GEN Generates periodic functions of different, given types The generation may be done relative to a specific time base or a given call-count base ( BASE ). An example set of available types of periodic functions are shown in the following image. InOut: Scope Name Type Initial Comment Input MODE GEN_MODE Types available: TRIANGLE : Triangular from - AMPLITUDE to + AMPLITUDE TRIANGLE_POS : Triangular from 0 to + AMPLITUDE SAWTOOTH_RISE : Sawtooth increasing from - AMPLITUDE to + AMPLITUDE SAWTOOTH_FALL : Sawtooth decreasing from + AMPLITUDE to - AMPLITUDE RECTANGLE : Rectangular switching from - AMPLITUDE to + AMPLITUDE SINE : Sine COSINE : Cosine BASE BOOL FALSE : Period referring to call ( CYCLES ) TRUE : Period referring to time ( PERIOD ) PERIOD TIME TIME#1s0ms Period time, only relevant if BASE = TRUE CYCLES INT 1000 Number of calls per period, only relevant if BASE = FALSE AMPLITUDE INT Amplitud of the function to be generated RESET BOOL TRUE : Sets OUT to zero Output OUT INT Generated function value
TimerSwitch ¶ A timer switch is a clock that switches a number of outputs on or off at set times. The switching times are individually configurable. The following snippet exposes the definition of a specific TimeZone . Example The main islands of New Zealand use New Zealand Standard Time (NZST), 12 hours in advance of UTC. During summer months — from the last Sunday in September until the first Sunday in April — daylight saving time (NZDT) is observed and clocks are advanced one hour. See: https://en.wikipedia.org/wiki/Time_in_New_Zealand tzTimeZoneNZST : TimeZone := ( iBias := 12 * 60 (* T#1M *) , asgPeriod := [ ( (* (NZDT -> NZST) - First Sunday in April at 03:00:00.000 (NZDT) *) sName:='NZST', dtDate := (uiMonth := 4, eWeekday := WEEKDAY.SUNDAY, uiDay := 1, uiHour := 3) ),( (* (NZST -> NZDT) - Last Sunday in September at 02:00:00.000 (NZST) *) sName := 'NZDT', dtDate := (uiMonth := 9, eWeekday := WEEKDAY.SUNDAY, uiDay := 5, uiHour := 2), iBias := 60 (* T#1M *) )] ); Note Due to current deficiencies in the compiler, no constants can be used for the tzTimeZone input of the TimerSwitch block. It is therefore necessary to declare a variable of type TimeZone and then assign the values of the predefined constants (e.g. TSW.gc_tzTimeZoneCET or TSW.gc_tzTimeZoneUTC ) to this variable. tzTimeZoneUTC : TimeZone := TSW.gc_tzTimeZoneUTC ; myTimerSwitch : TimerSwitch := ( tzTimeZone := tzTimeZoneUTC ); Due to another deficiencies in the compiler, the data type of the input aslSchedule of the TimerSwitch block is displayed wrongly. The following would be correct: FUNCTION_BLOCK PUBLIC FINAL TimerSwitch EXTENDS CBML.LConC IMPLEMENTS ITimeSwitch , IDateTimeProvider VAR_INPUT CONSTANT /// Source for the current date and time information in milliseconds since 1.1.1970 00:00:00.000 itfDateTimeProvider : IDateTimeProvider := Globals.g_dtpDateTimeProvider ; /// Compensation speed [ms/h] for the transition from one time zone period to another. tCompensationSpeed : TIME ; END_VAR VAR_IN_OUT (* CONSTANT *) /// Switching Schedule aslSchedule : ARRAY [*] OF Schedule ; END_VAR [...] Enums ERROR (Enum) PERIOD (Enum) WEEKDAY (Enum) FunctionBlocks DateTimeProvider (FunctionBlock) GetDateTime (Method) TimerSwitch (FunctionBlock) IDateTimeProvider GetDateTime (Method) Functions CombineDateTime (Function) DateTimeFromWeek (Function) DayOfWeek (Function) GetDateTime (Function) GetLocalDateTime (Function) GetTimeStampsDifference (Function) IsLeapYear (Function) JoinDateTime (Function) LocalDateTime (Function) SeparateDateTime (Function) SplitDateTime (Function) WeekOfYear (Function) GlobalConstants DAY_FLAGS (GVL) TSW (GVL) Interfaces IDateTimeProvider (Interface) GetDateTime (Method) Structs DateTime (Struct) Schedule (Struct) Segment (Struct) TimeZone (Struct) Types DAY (Alias) DAYS (Alias) HOUR (Alias) MILLISECOND (Alias) MINUTE (Alias) MONTH (Alias) SECOND (Alias) TZ_NAME (Alias) WEEK (Alias) YEAR (Alias)
Enums ¶ ERROR (Enum) PERIOD (Enum) WEEKDAY (Enum)
ERROR (ENUM) ¶ TYPE ERROR : Attributes: qualified_only InOut: Name Initial NO_ERROR WRONG_CONFIGURATION 2 RTC_HIGHRES_NOT_SUPPORTED SYS_TIMEZONE_NOT_SUPPORTED
PERIOD (ENUM) ¶ TYPE PERIOD : Attributes: qualified_only InOut: Name Initial UNKNOWN 0 STANDARD 1 DAYLIGHT 2
POINT (STRUCT) ¶ TYPE POINT : STRUCT InOut: Name Type X DINT Y DINT
PT_SIZE (STRUCT) ¶ TYPE PT_SIZE : STRUCT InOut: Name Type Comment pString POINTER TO BYTE Pointer to the text uiSize UINT Size of the text
Encoding ¶ BASE64 (Function)