Function
Retrieves the status of specified channel. Supports multi-processing.
Format
Ret = CntReadStatusEx ( Id , ChNo , Sts )
Parameters
Id
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify the device ID retrieved from CntInit.
ChNo
[ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short
]
Specify the channel number for retrieving.
Sts
[ VB.NET: Integer ] [ C, C++: unsigned long * ] [ C#: out uint ] [ Python:
ctypes.POINTER(ctypes.c_ulong) ]
Specify the address of the variable that retrieves the status. Each bit
is defined as the following Definition.
D11 |
D10 |
D9 |
D8 |
D7 |
D6 |
D5 |
D4 |
D3 |
D2 |
D1 |
D0 |
ALM |
AI |
FE |
CA |
BO |
Z |
A |
B |
U/D |
EQ1 |
EQ0 |
U |
Bit |
Description |
Value |
D0 :U |
General-purpose input status |
0:LOW |
D1 :EQ0 |
Count match register 0 |
0:Matched |
D2 :EQ1 |
Count match register 1 |
0:Matched |
D3 :U/D |
UP/DOWN |
0:In up-count |
D5 :A |
A-phase |
0:LOW |
D6 :Z |
Z-phase |
0:Positive logic=LOW /Negative
logic=HIGH |
D7 :BO |
Borrow |
0:Borrow undetection |
D8 :CA |
Carry |
0:Carry undetection |
D9 :FE |
Filter error |
0:Filter error undetection |
D10:AI |
Abnormal input error |
0:Abnormal input error undetection |
D11:ALM |
Disconnection alarm error |
0:Alarm error undetection |
Return Value
Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]
Definition |
Value |
Description |
CNT_ERR_SUCCESS |
0 |
Normality completion |
CNT_ERR_SYS_RECOVERED_FROM_STANDBY |
7 |
Execute the function CntResetDevice to return from the standby mode. |
CNT_ERR_DLL_INVALID_ID |
10001 |
Invalid ID was specified. |
CNT_ERR_DLL_CALL_DRIVER |
10002 |
CNT driver can't be called (Failed in the device I/O control). |
CNT_ERR_DLL_BUFF_ADDRESS |
10101 |
Invalid data buffer address. |
CNT_ERR_SYS_NOT_SUPPORTED |
20001 |
This function can't be used by this device. |
CNT_ERR_SYS_CH_NO |
20201 |
Channel number is out of range. |
The others: (See also: Details of Error Code)
Initial Value
0
Remarks
Retrieves the status of specified channel.
Status can be used to confirm whether the signal of each phase of the
counter operates.
As for a general-purpose input, it is more convenient to use specific function
CntInputDIByte.
Please use CntReadStatus, except for "Device with sampling function".
When the status was read, "Filter error"(D9:FE),
"Abnormal input error"(D10:AI), "Disconnection alarm error"(D11:ALM)
are cleared.
But, if the notify of counter error is enabled by CntNotifyCounterError
function, these status is always 0.
"Count match register 0"(D1:EQ)
is "0:Matched" on the moment which the count value is equal
as "Count match register".
On the other case, "Count match register 0"(D1:EQ) is "1:Not
matched".
Please use CntNotifyCountUp function
when you want to recognize the edge of "Counter match" on the
case for the faster frequency pulse.
Example
Retrieves the status of channel 0.
VB.NET |
Dim Ret As Integer |
C, C++ |
long Ret; |
C# |
int Ret; |
Python |
Ret = ctypes.c_long() |
See Also
CntInputDIByte CntReadStatus CntNotifyCounterError CntNotifyCountUp