SmcWSetEncType


Function

Sets the type of encoder input.

 

Format

Ret = SmcWSetEncType( Id, AxisNo, EncType )

 

Parameters

Id [ C, C++: short ] [ Python: ctypes.c_short ]

Specify the device ID retrieved by SmcWInit function.

 

AxisNo [ C, C++: short ] [ Python: ctypes.c_short ]

Specify the axis number.

 

EncType [ C, C++: short ] [ Python: ctypes.c_short ]

Set the type of encoder input.

0

A/B (*1) 1x

1

A/B (*1) 2x

2

A/B (*1) 4x

3

U/D (*2)

4

Unused

 (*1) Multiply a 90 phase difference.
 (*2) Count up when the A signal rises, count down when the B signal falls.

 

Return Value

Ret [ C, C++: long ] [ Python: ctypes.c_long ]

0

Terminated normally

Non-zero

Terminated abnormally

See also: Error code details

 

Initial Value

0 : A/B 1x

 

Remarks

The encoder counter is treated as preset value when "4 : Unused" is been set to EncType.

This function cannot be executed when the device is in operation.

After "Initial Setting function" is executed, it is necessary to execute SmcWSetInitParam.

Refer to "About Initial Setting function".

 

Example

The encoder input form of axis number 1 is set.

 

C, C++

long Ret;

short EncType;

Ret = SmcWSetEncType( Id , 1, EncType );

 

Python

Ret = ctypes.c_long()

EncType = ctypes.c_short()

Ret.value = csmc.SmcWSetEncType( Id , 1, EncType )

 

See Also

SmcWGetEncType