User`s manual

Introduction to Local Logic Programming
GFK-1742A Chapter 10 Introduction to Local Logic Programming 10-27
10
The Local Logic editor is a free-form text editor that allows users to enter programs in the style that
they prefer. The example is of a very simple Local Logic program that does not represent a fully
functional application because it is intended for instructional purposes only. The example program
is a simple timer application that relies on the digital servos position loop sample period (2 mSec)
as a time base. See Chapter 1 for position loop sample periods for other configurations.
IF First_Local_Logic_Sweep THEN (* First execution sweep *)
P001 := 0; (* Initialize P001 to 0 *)
P003 := 0; (* Initialize P003 to 0 *)
P004 := 0; (* Initialize P004 to 0 *)
END_IF;
P001:=P001+2; (* Time in Milliseconds *)
P100:= P001 MOD 1000; (* Check to see if 1 Sec (1000 mSec) Passed) *)
IF P100 = 0 THEN (* Remainder of MOD Operation=0 1 Sec Passed *)
P003:=P003+1; (* Time in Seconds *)
CTL01 := 1;
IF P003 = 60 THEN (* If Seconds = 60 then start over at 0 *)
P003:=0;
END_IF;
END_IF;
IF P100 <> 0 THEN
CTL01 :=0; (* CTL01=0 When not incrementing sec counter *)
END_IF;
P101:=P001 MOD 60000; (* Check to see if 1 Min (60000mSec) Passed *)
IF P101 = 0 THEN (* Remainder of MOD Operation=0 1 Min Passed *)
P004:=P004+1; (* Time in Minutes *)
IF P004 = 60 THEN (* If Minutes = 60 then start over at 0 *)
P004:=0;
END_IF;
END_IF;
Once you type the above program into the text editor, the editor screen will look similar to Figure
10-28.