TM_1ms_FB

Timer for 1ms intervals (0 to 32.767s)

This timer for 0.001s units works as an ON-delay timer. If the start contact of the function block is in the ON state, the preset time SV (set value) is started. When this time has elapsed, the timer contact T turns ON.

Parameters

Input

start (BOOL)

start contact

each time a rising edge is detected, the set value SV is copied to the elapsed value EV and the timer is started

SV (INT, WORD)

set value

the defined ON-delay time (0 to 32.767s)

Output

T (BOOL)

timer contact

is set when the time defined at SV has elapsed, this means when EV becomes 0

EV (INT, WORD)

elapsed value

count value from which 1 is subtracted every 0.001s while the timer is running

The value can be changed during counting operation by writing to the variable from the programming editor.

Remarks

  • The number of available timers is limited and depends on the settings in the system registers 5 and 6.

  • For the timer function blocks the compiler automatically assigns a NUM* address to every timer instance. The addresses are assigned counting downwards, starting at the highest possible address.

Time chart

  1.  (1) download PROG mode
  2.  (2) RUN mode

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

	VAR
		Alarm_control: TM_1ms_FB;
		Start_contact: BOOL:=FALSE;
		Alarm_Relay_1: BOOL:=FALSE;
		Alarm_Relay_2: BOOL:=FALSE;
	END_VAR

This example uses variables. You may also use constants for the input variables.

POU body

As soon the variable Start_contact becomes TRUE, the timer Alarm_control will be started. The variable EV of the timer is set to the value of SV. As long as Start_contact is TRUE, the value 1 is subtracted from EV every 1ms. When EV reaches the value 0 (after 1 second as SV = 1000 with the timer type TM_1ms_FB), the variable Alarm_Relay_2 becomes TRUE.

As soon as the value of the variable EV of the timer is smaller than or equal to 500 (after 0.5s) and EV is unequal 0, Alarm_Relay_1 is set to TRUE.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_VARIN,,Start_Contact,7,2,9,4,);
B(B_VARIN,,1000,7,3,9,5,);
B(B_VAROUT,,Alarm_Relay_2,16,2,18,4,);
B(B_FB,TM_1ms_FB!,Alarm_control,9,1,16,5,,?Bstart?BSV?AT?AEV);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 8 ;
        NETWORK_BODY
B(B_F,@LE-2!,Instance,11,0,16,3,,?D?D?C);
B(B_VARIN,,Alarm_control.EV,9,0,11,2,);
B(B_VARIN,,500,9,1,11,3,);
B(B_F,@NE!,Instance,11,5,16,8,,?D?D?C);
B(B_VARIN,,0,9,6,11,8,);
B(B_VARIN,,Alarm_control.EV,9,5,11,7,);
B(B_F,@AND-2!,Instance,20,2,25,5,,?D?D?C);
B(B_VAROUT,,Alarm_Relay_1,25,2,27,4,);
L(16,1,17,1);
L(17,1,17,3);
L(17,3,20,3);
L(17,4,20,4);
L(17,4,17,6);
L(16,6,17,6);
L(1,0,1,8);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

Alarm_Control( start:= Start_Contact ,
        SV:= 1000,
        T=> Alarm_Relay_2 ,
        EV=> Alarm_Control.EV );
(*The ON-delay time is 1000ms*)
Alarm_Relay_1:= Alarm_Control.EV <= 500 & Alarm_Control.EV <> 0;
(*Alarm_Relay_1 is set to TRUE after 500ms*)

IL body

If you want to call the function block in an instruction list, enter the following:

CAL

Alarm_control (start:=Start_contact,

SV:= 1000 ,

T:= Alarm_Relay_2)

LD

Alarm_control.EV

LE

500

AND(

Alarm_control.EV

NE

0

)

ST

Alarm_Relay_1

Modified on: 2019-01-26Feedback on this pagePanasonic hotline