[r46]: / repair_ballast / Vision_doorgeefluik / Plc Logic / Application / subprogs / controlCamera / svnobj  Maximize  Restore  History

Download this file

41 lines (39 with data), 4.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
FUNCTION_BLOCK controlCamera
VAR_INPUT
	xTrigger:BOOL;
	xContinuous: BOOL;
	iCount:INT;
	xDataReady:BOOL;
	tTimeOut:TIME;
END_VAR
VAR_OUTPUT
	xTriggerOut:BOOL;
	xLogData:BOOL;
	tTimeOutCounter:int;
	tTime:TIME;
VAR
	iStep:INT:=0;
	tStartTime:TIME;
// Control block for camera trigger and repeat function
// Also monitors possible time outs on the camera
CASE iStep OF
	0: // start timer start trigger
		xTriggerOut := xTrigger;
		IF xTrigger THEN
			tStartTime := TIME();
			IF iCount > 0 THEN
				iCount := iCount - 1;
			END_IF
			iStep:=iStep + 10;
		END_IF
		
	10: // stop timer if data ready
		IF xDataReady THEN
			// stop timer
			xTriggerOut := FALSE;
			tTime := TIME() - tStartTime;
			xLogData := iCount > 0;
		ELSIF (TIME() - tStartTime) > tTimeOut THEN
	20: // falling edge of trigger
		IF NOT xTrigger OR xContinuous OR iCount > 0 THEN
			iStep := 0;
END_CASE