[r78]: / trunk / Monarco / Monarco_FB / private / Counter / Counter1Config / Get / svnobj  Maximize  Restore  History

Download this file

26 lines (25 with data), 6.4 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
FOR J := 1 TO 2 DO
	awSrvAnwser[J]	 := MEM.PackBytesToWord(THIS^._abyIntRxBuf[1], THIS^._abyIntRxBuf[0]);
END_FOR
/// COUNTER1 Configuration;
///   Mode;
///	   * Off,
///    * Pulse counting,
///    * Quadrature encoder,
///   Direction (only for pulse counting mode):
///     * Up
///     * [FUTURE] external control, low/high = up/down
///   Active Edge (only for pulse counting mode):
///     * Rising
///     * Falling
///     * Both
	eCounterMode.Off					: stConfig.eMode := eCounterMode.Off;				//0x00								                                    
	eCounterMode.QuadratureEncoder		: stConfig.eMode := eCounterMode.QuadratureEncoder;	//0x02
ELSE
	// Weird value returns?
	stConfig.eMode := eCounterMode.Off;
END_CASE
	eCounterDirection.Up 				: stConfig.eDirection := eCounterDirection.Up;					//0x00
uiActiveEdge :=  BOOL_TO_UINT(awSrvAnwser[2].6) + BOOL_TO_UINT(awSrvAnwser[2].7);
CASE uiActiveEdge OF
	eCounterActiveEdge.Falling  		: stConfig.eActiveEdge := eCounterActiveEdge.Falling; 	//0x01