Function
Retrieves the status of specified channel. Supports multi-processing.
Format
Ret = CntReadStatusEx ( Id , ChNo , &Sts )
Parameters
Id
[C: short] [Python: ctypes.c_short]
Specifies the device ID retrieved from CntInit.
ChNo
[C: short] [Python: ctypes.c_short]
Specifies the channel number which you want to get for.
Sts
[C: int *] [Python: ctypes.POINTER(ctypes.c_int)] [ 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 state |
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 |
D4 :B |
B-phase |
0:LOW |
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 [C: long] [Python: ctypes.c_long]
Definition |
Value |
Description |
CNT_ERR_SUCCESS |
0 |
Normal Complete |
CNT_ERR_DLL_INVALID_ID |
10001 |
Invalid ID is specified. |
CNT_ERR_DLL_CALL_DRIVER |
10002 |
Driver cannot be called (failed in ioctl). |
CNT_ERR_DLL_BUFF_ADDRESS |
10101 |
Invalid data buffer address. |
CNT_ERR_SYS_CH_NO |
20201 |
Channel number is outside the range. |
The other errors: (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.
For "Device with usual counter", please use CntReadStatus.
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 CntSetCountErrorEvent
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 CntSetCountMatchEvent
function when you want to recognize the edge of "Counter match"
on the case for the faster frequency pulse.
Example
C |
Ret = CntReadStatusEx
( Id , ChNo , &Sts ); |
Python |
Ret = ccnt.CntReadStatusEx
( Id , ChNo , ctypes.byref(Sts) ) |
See Also
CntStartCount CntReadStatus CntSetCountErrorEvent CntSetCountMatchEvent