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

Download this file

36 lines (33 with data), 5.6 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
VAR
	stConfig : MNR.stCounter1Config;
	wReq : WORD;
END_VAR
IsGet
/// 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
stConfig   := Counter1Config;
CASE stConfig.eMode OF
	eCounterMode.Off					: 	wReq.0 := FALSE;	//0x00
											wReq.1 := FALSE;
											wReq.2 := FALSE;
										
	eCounterMode.PulseCounting			:  	wReq.0 := TRUE;		//0x01
	eCounterMode.QuadratureEncoder 		:  	wReq.0 := FALSE;	//0x02
											wReq.1 := TRUE;
END_CASE#
CASE stConfig.eDirection OF
	eCounterDirection.up				:  	wReq.3 := FALSE;	//0x00
											wReq.4 := FALSE;
											wReq.5 := FALSE;
									
_eComStatus := THIS^.ServiceRequest( wValue := wReq, eCommand := eServiceCommand.SDC_FIXED_CNT1MODE, xWrite := TRUE );
// update classic status;
//_stCounter1Config := stConfig;