Vai al contenuto

Use example

Declare some variables, inside a PLC module:graph1: GS_SCOPE_PAR;graph1fb : GFB_SCOPE;counter : real;value : real;firsttime : bool := true;resetdata : bool := false;Init the Function Block graph1fb as follows:if firsttime thenfirsttime := false;graph1.num_sample := 1000;graph1.minx := 0;graph1.maxx := 999;graph1.miny := 0.0;graph1.maxy := 99.9;graph1.comma := 1;graph1.t_sample := 10;graph1.oneshot := false;counter := 0.0;end_if;Make sure to execute the Function Block inside a PLC module:value := counter;graph1fb(en_fb := true, reset := resetdata, in := value, scope_par := adr(graph1));if resetdata thenresetdata := false;end_if;counter := counter + 1.0;if counter > 100.0 thencounter := 0.0;end_if;Drop a TrendDisplay widget on a screen page and declare “GRAPH1” as “s1_label”. Execute the program.