Function
Sets the type of encoder input.
Format
Ret = SmcWSetEncType( Id, AxisNo, EncType )
Parameters
Id
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
SSpecify the Deice ID retrieved by SmcWInit
function.
AxisNo
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify the axis number.
EncType
[ VB.NET: Short ] [ C, C++: short ] [ 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 [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ 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.
VB.NET
Dim Ret As Integer
Dim EncType As Short
Ret = SmcWSetEncType( Id , 1, EncType )
C, C++
long Ret;
short EncType;
Ret = SmcWSetEncType( Id , 1, EncType );
C#
int Ret;
short EncType;
Ret = Smc.WSetEncType( Id , 1, EncType );
Python
Ret = ctypes.c_long()
EncType = ctypes.c_short()
Ret.value = csmc.SmcWSetEncType( Id , 1, EncType )
See Also