[r10]: / trunk / I2C_Template / I2CTemplate / connector / AfterReadInputs / svnobj  Maximize  Restore  History

Download this file

20 lines (19 with data), 2.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
METHOD AfterReadInputs : INT
VAR
	Buffer : ARRAY[0..3] OF BYTE;
	len: dINT;
SUPER^.AfterReadInputs();
IF _iState = 10 THEN
	timer(IN:=TRUE);
	IF timer.Q THEN	
		len := Read(ADR(Buffer), 4);
		IF len = 4 THEN
			xValid := (lrDistance >= lrMinDistance AND lrDistance <= lrMaxDistance);
			xNewMeasurement := TRUE;
		ELSE
			xValid := FALSE;
		END_IF
		Write8(0, 16#51);	//new measurement
		timer(IN:=FALSE);
	END_IF		
END_IF